feat(agent): agent audit feed — surface executed actions + approval decisions (#784) - #935
feat(agent): agent audit feed — surface executed actions + approval decisions (#784)#935oktofeesh1 wants to merge 1 commit into
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 — Blockers foundReviewed 5 changed file(s) — two independent AI reviewers, synthesized.
Merge readiness: ❌ CI is red — approval withheld until it's green. Failing: see the checks tab. Summary The change introduces a new audit‑feed feature across MCP, API routes, and DB layer with corresponding tests. While functional, it outputs raw audit event fields (actor, detail) without sanitising against the project's public‑safe word list, risking leakage of forbidden terms. This is a concrete privacy/security defect. 🛑 Hard blockers — must fix before merge
💡 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. |
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).
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.02%); new lines fully covered.🤖 Generated with Claude Code