feat(agent): agent audit feed — surface executed actions + approval decisions (#784) - #936
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 — no query, route, or MCP tool. This adds the read side of Phase 3's audit feed across HTTP + MCP: - DB: listAgentAuditEvents(repoFullName, since?, limit) — repo-scoped via the `repo#pr` targetKey prefix range (mirrors listPrVisibilitySkipAuditEvents), filtered to agent.action.* / agent.pending_action.*, newest first, capped 200. - HTTP: GET /v1/repos/:owner/:repo/agent/audit-feed — maintainer-scoped, ?since=ISO&limit=N. Read-only and public-safe (action posture only — no trust/score metadata is selected). - MCP: gittensory_get_agent_audit_feed {owner, repo, since?, limit?} — maintainer-manage scoped. Tests: route + MCP each assert repo-scoping (excludes other repos and non-agent events), newest-first ordering, since/limit filters, 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>
|
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 ⛔ Maintainer review — Not mergedReviewed 5 changed file(s) — two independent AI reviewers, synthesized.
Merge readiness: ✅ Mergeable ( Summary The change adds a new audit‑feed tool and HTTP endpoint, implements the supporting DB query, and includes comprehensive tests. The implementation respects the maintainer‑only access controls, uses parameterised queries, clamps limits, and avoids exposing any forbidden public terms. No correctness, security, or regression issues are detected. 💡 Nits — non-blocking, optional
This repo uses one-shot review: a rejected PR is closed, not iterated in place. Address the above and open a new focused PR. |
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
|
|
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 #936 +/- ##
=======================================
Coverage 96.61% 96.62%
=======================================
Files 110 110
Lines 14954 14981 +27
Branches 5404 5412 +8
=======================================
+ Hits 14448 14475 +27
Misses 104 104
Partials 402 402 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 already merged). Rebased onto current main (post-#934).
Why
The agent already writes an audit trail —
agent.action.<class>from the executor andagent.pending_action.accepted|rejectedfrom the approval queue — but nothing could read it back: no query, no route, no MCP tool. This adds the read side of the audit feed.What this adds
listAgentAuditEvents(repoFullName, since?, limit)— repo-scoped via therepo#prtargetKey prefix range (mirrorslistPrVisibilitySkipAuditEvents), filtered toagent.action.*/agent.pending_action.*, newest first, capped at 200.GET /v1/repos/:owner/:repo/agent/audit-feed— maintainer-scoped,?since=ISO&limit=N. Read-only and public-safe (only the action posture is selected — no trust/score metadata).gittensory_get_agent_audit_feed {owner, repo, since?, limit?}— maintainer-manage scoped.Scope note on #784
Together with #934 (MCP list/decide approval tools) and the already-merged CLI
maintaincommands +get_automation_state/propose_actionMCP tools, this completes the CLI + MCP + HTTP control surface for agent automation. The dashboard Automation tab is owner-led visual work and is intentionally tracked separately; this closes the backend/control-surface deliverable of #784.Tests
routes-agent-approval.test.ts+mcp-automation-state.test.ts: repo-scoping (excludes other repos and non-agent events), newest-first ordering,since/limitfilters, the maintainer-access gate, and a non-numeric targetKey →nullpullNumber. Fullnpm run test:coveragegreen (branches 97.03%); new lines fully covered.🤖 Generated with Claude Code