feat(agent): approval queue + notification + accept/reject (#779)#846
Conversation
Phase 1 completes: the auto_with_approval path. When an action's autonomy level is auto_with_approval, the write-actions layer (#778) now STAGES it for a one-tap maintainer decision instead of just auditing 'queued'. - migration 0045 + schema agent_pending_actions + AgentPendingActionRecord — at most one row per (repo, pull, action_class); a decided row is sticky. - db: createPendingAgentActionIfAbsent (idempotent stage), listPendingAgentActions, getPendingAgentAction, setPendingAgentActionStatus. - executor: requiresApproval → stageForApproval (persist the action's execute-time params + notify the maintainer ONCE via the #535 notifications service, badge channel) → audit queued. Re-evaluation never duplicates the row or re-notifies. - services/agent-approval-queue: decidePendingAgentAction — accept runs the staged action LIVE (the accept IS the approval, so the executor's approval gate is bypassed; the kill-switch + write-permission gates still apply), reject cancels. Either decision is sticky + idempotent and records an agent.pending_action.* audit that feeds the trust loop. - API (maintainer-scoped, per-repo): GET .../agent/pending-actions, POST .../pending-actions/:id/{accept,reject}. The id is scoped to the repo so no one can decide another repo's queue via a guessed id. Tests: staging (pending row + notification + idempotency), repository dedup, accept (executes + accepted + audit) / reject / already-decided / not-found / denied-execution, the exported helpers, and the routes (list, accept, reject, invalid verb, 404 cross-repo, 409 re-decide, non-operator forbidden, operator session identity). New code 100% covered; full suite green (2089).
|
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. |
|
gittensory · advisory review Reviewed 9 changed file(s) — two independent AI reviewers. Changed files (9)
Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
|
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 #846 +/- ##
==========================================
+ Coverage 96.64% 96.66% +0.01%
==========================================
Files 104 105 +1
Lines 14411 14476 +65
Branches 5243 5266 +23
==========================================
+ Hits 13928 13993 +65
Misses 105 105
Partials 378 378 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #779
What & why
This completes Phase 1 (#769) — the
auto_with_approvalpath. When an action's autonomy level isauto_with_approval, the write-actions layer (#778) now stages it for a one-tap maintainer decision instead of executing. Accept/reject feeds the trust loop.How
0045_agent_pending_actions+agentPendingActionsschema +AgentPendingActionRecord. At most one row per(repo, pull, action_class); a decided row is sticky (re-evaluation never re-stages it). Repo fns:createPendingAgentActionIfAbsent(idempotent),listPendingAgentActions,getPendingAgentAction,setPendingAgentActionStatus.requiresApproval→stageForApproval: persist the action's execute-time params + notify the maintainer once (reusing the feat(notifications): event-to-subscription-to-delivery service #535 notifications service, badge channel) → auditqueued. Re-evaluation neither duplicates the row nor re-notifies.decidePendingAgentAction:agent.pending_action.*audit event (the trust-loop signal).GET /v1/repos/:owner/:repo/agent/pending-actions,POST .../pending-actions/:id/accept,POST .../pending-actions/:id/reject. The id is scoped to the repo so no one can decide another repo's queue via a guessed id.Safety
pull_requests: writereadiness — an accept on a paused or under-permissioned repo records anerror, it does not silently mutate.Tests
Staging (pending row + notification + idempotency), repository dedup, accept/reject/already-decided/not-found/denied-execution, the exported helpers (
actionParams,pendingActionToPlanned), and the routes (list, accept, reject, invalid verb, 404 cross-repo, 409 re-decide, non-operator forbidden, operator-session identity). New code 100% covered; full suite green (2089 passed).