feat(agent): agent audit feed — surface executed actions + approval decisions (#784) - #937
Merged
JSONbored merged 1 commit intoJun 20, 2026
Conversation
…ecisions (JSONbored#784) The agent writes an audit trail (agent.action.<class> from the executor, agent.pending_action.accepted|rejected from the approval queue) but nothing could read it back. This adds the read side across HTTP + MCP: - DB: listAgentAuditEvents(repoFullName, since?, limit) — repo-scoped via the `repo#<...>` targetKey range (lower `repo#`, upper bound `repo#` + U+FFFF so no delimiter-adjacent key is wrongly excluded), filtered to agent.action.* / agent.pending_action.*, newest first, capped at 200. - HTTP: GET /v1/repos/:owner/:repo/agent/audit-feed — maintainer-scoped. Validates `since` (ISO-8601 -> 400) and `limit` (integer 1-200 -> 400) at the API layer. Documented in the OpenAPI spec. - MCP: gittensory_get_agent_audit_feed {owner, repo, since?, limit?} — maintainer-manage scoped; `since` is schema-validated as ISO-8601 and `limit` capped at 200. - Public/private: the free-form `detail` is scrubbed with sanitizePublicComment before leaving either surface; only public-safe action posture is selected. Tests cover repo-scoping, newest-first ordering, since/limit filters + their 400 / schema rejections, detail sanitisation (and null-detail passthrough), the maintainer-access gate, and a non-numeric targetKey -> null pullNumber. Full test:coverage green (branches 97.02%); new lines fully covered. Closes JSONbored#784 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
reviewbot — ⏳ Waiting for CI to finish before the gate review. |
Contributor
|
|
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #937 +/- ##
=======================================
Coverage 96.61% 96.62%
=======================================
Files 110 110
Lines 14954 14988 +34
Branches 5404 5414 +10
=======================================
+ Hits 14448 14482 +34
Misses 104 104
Partials 402 402 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closed
12 tasks
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #784. Second of two focused PRs for Phase 3's agent automation control surface (the first, #934, added the MCP approval-queue list/decide tools and is merged). Rebased onto current main; supersedes #935/#936 (closed) with the review feedback fully addressed.
What this adds
The agent already writes an audit trail (
agent.action.<class>,agent.pending_action.accepted|rejected) but nothing could read it back. This adds the read side:listAgentAuditEvents(repoFullName, since?, limit)— repo-scoped via therepo#<...>targetKey range, filtered to agent events, newest first, capped at 200.GET /v1/repos/:owner/:repo/agent/audit-feed— maintainer-scoped,?since=ISO&limit=N. Now in the OpenAPI spec.gittensory_get_agent_audit_feed {owner, repo, since?, limit?}— maintainer-manage scoped.Review feedback addressed (from #936)
detailis scrubbed withsanitizePublicCommentbefore it leaves the endpoint or the MCP tool (defense-in-depth on the public/private boundary). Other fields are controlled vocab (eventType/outcome) or logins (actor).sincevalidation: HTTP returns 400 for a non-ISO-8601since; the MCP schema validates it asz.string().datetime().limitbound: HTTP returns 400 for a non-integer or out-of-1–200limit(no longer silently clamped); the MCP schema caps at 200.repo#+U+FFFFso no delimiter-adjacent key is wrongly excluded.npm run ui:openapi:checkpasses.Scope on #784
With #934 (MCP list/decide) and the merged CLI
maintaincommands +get_automation_state/propose_actionMCP tools, this completes the CLI + MCP + HTTP control surface. The dashboard Automation tab is owner-led visual work, intentionally separate.Tests
Repo-scoping, ordering, since/limit filters + their 400/schema rejections, detail sanitisation (+ null passthrough), the maintainer-access gate, non-numeric targetKey → null pullNumber. Full
npm run test:coveragegreen (branches 97.03%); new lines fully covered.🤖 Generated with Claude Code