feat(review): trusted-agent auto-approval is the default - #576
feat(review): trusted-agent auto-approval is the default#576plind-junior wants to merge 1 commit into
Conversation
one compiled session was filling the review queue with hundreds of pending proposals — 1268 piled up in this repo alone — which made the human approve step the bottleneck the ungated compilers don't have. the starter config now ships review.approver_role: trusted-agent, so a fresh kb approves the capturing agent's proposals with no human step. the gate machinery is unchanged, not bypassed: every write still flows through proposals.approve(), lands one audit event, and carries the auto_approved stamp. the new proposals.auto_approve_pending drain (called from capture finalize in place of the receipt-only drain) clears claims, pages, entities and relations under trusted-agent and falls back to the receipt gate otherwise; duplicates of durable claims are rejected instead of re-piling, and protected page kinds, dead-reference pages, id conflicts and delete proposals still wait for a reviewer. remove approver_role from config.yaml to put writes back behind vouch review. tests that assert the closed-gate behaviour now pin the gate closed explicitly instead of relying on the old default.
WalkthroughThe starter configuration now enables trusted-agent auto-approval. Pending proposals are drained during capture finalization through a new gate-aware function that preserves protected, conflicting, duplicate, and delete proposal safeguards, with tests covering trusted-agent, receipt-only, and closed-gate behavior. ChangesAuto-approval flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Capture as capture.finalize_all_except
participant Proposals as proposals.auto_approve_pending
participant Store as KBStore
Capture->>Proposals: drain pending proposals
Proposals->>Store: inspect review settings and pending proposals
Proposals->>Store: resolve or approve eligible proposals
Store-->>Proposals: approval results
Proposals-->>Capture: approved proposal list
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/vouch/proposals.py`:
- Around line 700-705: Update the auto-approval flow in src/vouch/proposals.py
around approve() so page, entity, and relation approvals persist an
auto_approved provenance stamp, and extend the relevant model serialization to
include it; update tests/test_trusted_agent_auto_approve.py lines 47-83 to
verify persisted provenance for pages, entities, relations, and claims; update
CHANGELOG.md lines 10-18 so the auto_approved stamp claim remains only when all
durable artifact types support it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8f66b4fe-3e0f-4728-b55b-443fd53216d6
📒 Files selected for processing (8)
CHANGELOG.mdsrc/vouch/capture.pysrc/vouch/proposals.pysrc/vouch/storage.pytests/test_adopt.pytests/test_delete.pytests/test_jsonl_server.pytests/test_trusted_agent_auto_approve.py
| approved.append( | ||
| approve( | ||
| store, proposal.id, approved_by=approver, | ||
| reason="trusted-agent — auto-approved", | ||
| ) | ||
| ) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
persist the auto_approved stamp for every durable artifact.
approve() stamps only Claim; pages, entities, and relations approved here have no equivalent durable provenance field. This breaks the new default’s stated audit contract.
src/vouch/proposals.py#L700-L705: add persistent auto-approval provenance for page, entity, and relation approvals, including their model serialization.tests/test_trusted_agent_auto_approve.py#L47-L83: assert persisted provenance for each auto-approved artifact type, including entities.CHANGELOG.md#L10-L18: retain the “auto_approvedstamp” claim only once non-claim artifacts carry it.
📍 Affects 3 files
src/vouch/proposals.py#L700-L705(this comment)tests/test_trusted_agent_auto_approve.py#L47-L83CHANGELOG.md#L10-L18
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/vouch/proposals.py` around lines 700 - 705, Update the auto-approval flow
in src/vouch/proposals.py around approve() so page, entity, and relation
approvals persist an auto_approved provenance stamp, and extend the relevant
model serialization to include it; update
tests/test_trusted_agent_auto_approve.py lines 47-83 to verify persisted
provenance for pages, entities, relations, and claims; update CHANGELOG.md lines
10-18 so the auto_approved stamp claim remains only when all durable artifact
types support it.
one compiled session fills the review queue with hundreds of pending proposals — 1268 piled up in the vouch repo's own kb before this change. the human approve step was the bottleneck, and the head-to-head with ungated compilers (ditto-harness) showed the queue, not the gate, was the thing costing us.
this makes auto-approval the default. the starter config now ships
review.approver_role: trusted-agent, so a fresh kb approves the capturing agent's proposals with no human step. nothing bypasses the gate: every write still flows throughproposals.approve(), lands one audit event, and carries theauto_approvedstamp.the new
proposals.auto_approve_pendingdrain replaces the receipt-only drain in capture finalize. under trusted-agent it clears claims, pages, entities and relations; without trusted-agent it falls back to the receipt gate, and with no gate open it is a no-op. duplicates of durable claims are rejected instead of re-piling. protected page kinds, dead-reference pages, id conflicts and delete proposals still wait for a reviewer — that residue is exactly the human-call set.tests that asserted closed-gate behaviour relied on the old starter default; they now pin the gate closed explicitly, which also keeps them meaningful. new coverage in
tests/test_trusted_agent_auto_approve.pyexercises the drain across kinds, the protected-kind and delete holds, the duplicate rejection, and the fallback ladder.opting back into human review is one config edit: remove
approver_rolefromconfig.yamland every write is behindvouch reviewagain.Summary by CodeRabbit
approver_rolefrom the configuration to restore human review.