feat(govern): use Duo Agent Platform key names in audit events

What does this MR do and why?

Step 1 of https://gitlab.com/gitlab-org/gitlab/-/work_items/635002: glab's audit events now use the same details keys as GitLab Duo Agent Platform (DAP).

The audit event details view already shows DAP's content keys (content, tool_args) as collapsible blocks. glab used the MCP server's names, so prompts and tool arguments showed up as one-line attributes.

Event Before After
ai_user_input_received input, input_truncated content, content_truncated, content_length, input_type: "message"
ai_tool_invoked arguments tool_args
ai_llm_response_received model, input_tokens, output_tokens model_name, prompt_token_count, completion_token_count
  • content_length is the character count of the whole prompt, as in DAP.
  • tool_args is always an object, as in DAP. Codex arguments that are a string or array are wrapped in {"input": ...}.
  • outcome, agent_initiated, duration_s, error_message and the cache token counts keep their names. DAP has no tool outcome keys.

The old keys are not sent alongside the new ones. Sending prompt text and arguments twice could push an event over GitLab's 10 KB per-event limit, which rejects the whole batch. Nothing in GitLab reads the old keys: the server only reads tool_name, and the docs don't name keys.

Event IDs don't depend on details, so deduplication is unchanged. Events synced before this keep the old keys, so a session synced across the upgrade has both shapes.

GitLab's MCP server still records arguments. Aligning it is a follow-up.

How has this been tested?

  • go test ./internal/commands/govern/...
  • New TestAuditEvents_ToolArgsAreObjects, and the existing limits tests now check the renamed keys and content_length.

Merge request reports

Loading
Loading