Link connected agents to the Audit events tab filtered by agent type
Each connected agent row in the Most used agents card now opens the Audit events tab filtered to that agent, as in the design prototype. The tab gets an Agent filter token for that, seeded from the URL like the Triggered by and Project tokens the Developer activity and Project exposure cards already use.
This MR targets master and merges ahead of the backend. The agentType argument it needs lands in Add agentType filter to the AI governance sessi... (!261754). Until then, everything here sits behind a new wip flag, ai_governance_audit_events_filters, off by default. With the flag off, nothing changes on the page and no query sends agentType.
Changes
- New wip flag
ai_governance_audit_events_filters, pushed by the group and project governance controllers. The name is generic on purpose: the Tool (toolName, Link Top tools rows to Audit events filtered by... (!263159)) and Action type (actionType, #637211+) filters are meant to join the same flag and queries. - Audit events sessions queries:
- The session fields move into a shared fragment, so the queries below do not repeat them.
- Two new queries,
get_agent_artifacts_ai_governance_sessions_filteredandget_project_agent_artifacts_ai_governance_sessions_filtered, are the existing ones plusagentType. The table uses them only when the flag andai_governance_sessions_apiare both on. The existing queries are unchanged apart from the fragment. - Both new queries are listed in
config/known_invalid_graphql_queries.yml, sographql-verifyskips them until !261754 merges. That follows the frontend GraphQL guide. The entries come out, and the flag can go, once the backend is on master (work item #637206+).
- Audit events filtered search: an Agent token,
isoperator only, behind the flag. Options are the connected agent types (Claude Code, Cursor, OpenCode, Codex) plus Unknown, the agent type MCP sessions get when the client's name matches no known agent.agentTypejoins the URL-seeded filter types; a URLagentTypeis dropped when the token is not shown. - Most used agents: with the flag on, connected rows link to that agent's connected sessions of the last 30 days, the window the card ranks on (
?tab=agent-artifacts&agentType=<type>&agentClass=EXTERNAL&startTimeAfter=...), with the same hover and chevron as the other linked rows. With theai_governance_dashboard_side_panelsflag on too, a click opens those sessions in the dashboard side panel instead, like the Developer and Project cards; Ctrl, Cmd or Shift-click still opens the tab. With the filters flag off the rows stay plain text, as today. Catalog and GitLab-maintained agent rows keep their link to the agent page. - Specs for the flag on and off, the query choice, the token, the URL seeding and the row link.
How to test
You need the backend from !261754, or the offsite demo branch that includes it. ClickHouse is not required.
- Enable both flags for the group:
Feature.enable(:ai_governance_sessions_api)andFeature.enable(:ai_governance_audit_events_filters). - Open Automate > Governance, then Dashboard. In Most used agents, select Connected agents and click a row, for example Claude Code.
- The Audit events tab opens with
Agent = Claude Codeset, listing only that agent's sessions. - In the filter bar, pick Agent > Unknown to list MCP sessions from clients that matched no known agent.
- Disable
ai_governance_audit_events_filters: the Agent token is gone, connected rows are plain text, and the table loads as before.
Out of scope
- Catalog and GitLab-maintained agents: a follow-up adds a filter for their sessions and links those rows too.
- A negated (
is not) Agent filter. - Agents by provider (Open agent sessions from Agents by provider in ... (!269916 - merged)) sends its slice as
agent. Once it merges, a one-line follow-up renames that toagentType, so a slice click opens the side panel with the Agent token set.
Screenshots
Taken with the backend from !261754 and the flag on.
Most used agents, connected rows (All agents, 7 days):
| Before | After |
|---|---|
![]() |
![]() |
Audit events tab, opened from the Claude Code row:
| Before | After |
|---|---|
![]() |
![]() |
Related
- Issue: #632558+ and gitlab-org/software-supply-chain-security/compliance/engineering/gaig#42+
- Workflow: #637206+
- 19.6 release plan: #633507+



