feat(minder): send tool output and model responses in audit events
Description
glab minder audit sync now sends tool output and the text of model responses in its audit events, using the keys Duo Agent Platform records:
- Tool response and failure events:
response_content,response_length,response_content_bytesandresponse_content_truncated.error_messagestays on failures. - Model response events:
response_content,response_content_bytes,response_content_truncatedandfinish_reason.
Content is redacted whole, then measured, then cut. Text over 16 KiB keeps its first and last 8 KiB with a marker, as DAP does, and less if the event would go over the 32 KB per-event limit, which glab targets with a 512-byte margin. GitLab before 19.6 rejects a whole batch if any event is over 10 KB, with "details payload too large (max 10 KB per event)". glab reads the limit from that error, refits the batch to it once and retries, and fits later batches to it for the rest of the run. An event that still doesn't fit is skipped and counted by the fallback sync. A hook leaves such events to the fallback sync, which records them for glab minder doctor. response_content_bytes is always the size of the full redacted text.
Claude Code writes one response as several transcript entries with the same message ID. When a read ends partway through one, and its last entry is less than a minute old, the cursor stops at the start of that message, so the next read sends the whole response under the same event ID. The fallback sync can otherwise post a partial response that GitLab deduplicates.
What each agent sends:
- Claude Code: tool results, assistant text and stop reasons.
- Codex: tool call outputs, and assistant text with the next token count.
- OpenCode: tool output.
- Cursor: the text of assistant turns, under a new event ID per turn.
Existing event IDs are unchanged. The audit sync and setup help text describe what is sent, and the docs are regenerated.
Existing users: people who already ran glab minder setup are not asked again. After upgrading glab, their tool output and model responses are sent in audit events, after secret redaction and cut to fit GitLab's per-event limit. From GitLab 19.7, a top-level group can turn off audit event content for external agents, and GitLab then keeps only the events' metadata. On GitLab 19.6 and earlier there is no such setting, so the content is stored.
Related to gitlab-org/gitlab#635002
How has this been tested?
- Unit tests for the excerpt and fit logic, redaction before the cut, each agent's parser, the hold-back of a streaming response, and a fake older GitLab with a 10 KB limit.
go test ./internal/commands/govern/...and golangci-lint.