Skip to content

feat(review): trusted-agent auto-approval is the default - #576

Open
plind-junior wants to merge 1 commit into
testfrom
feat/auto-approve-default
Open

feat(review): trusted-agent auto-approval is the default#576
plind-junior wants to merge 1 commit into
testfrom
feat/auto-approve-default

Conversation

@plind-junior

@plind-junior plind-junior commented Jul 28, 2026

Copy link
Copy Markdown
Member

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 through proposals.approve(), lands one audit event, and carries the auto_approved stamp.

the new proposals.auto_approve_pending drain 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.py exercises 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_role from config.yaml and every write is behind vouch review again.

Summary by CodeRabbit

  • New Features
    • New knowledge captured is automatically approved by default.
    • Claims, pages, entities, and relationships can be approved automatically when eligible.
    • Duplicate claims are rejected automatically.
  • Bug Fixes
    • Protected pages, conflicting references, and deletion requests remain pending for review.
    • Approval failures no longer interrupt capture finalization.
  • Configuration
    • Remove approver_role from the configuration to restore human review.
    • Receipt-based approval remains available when trusted-agent approval is disabled.

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.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The 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.

Changes

Auto-approval flow

Layer / File(s) Summary
Review gate configuration
src/vouch/storage.py, CHANGELOG.md, tests/test_trusted_agent_auto_approve.py
The starter configuration defaults to approver_role: trusted-agent, documents the approval modes, and verifies the defaults.
Pending proposal drain
src/vouch/proposals.py, tests/test_trusted_agent_auto_approve.py
auto_approve_pending() drains eligible claims, pages, entities, and relations through the normal approval path, while retaining protected, duplicate, conflicting, and delete proposals; receipt-only fallback remains supported.
Capture finalization integration
src/vouch/capture.py
Capture finalization uses the new drain on early and normal paths and records the approved count as auto_approved.
Closed-gate regression coverage
tests/test_adopt.py, tests/test_delete.py, tests/test_jsonl_server.py
Existing gate and self-approval tests explicitly disable automatic approval settings.との

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
Loading

Possibly related PRs

  • vouchdev/vouch#486: Introduced the receipt-gated proposal auto-approval flow extended here.
  • vouchdev/vouch#522: Modified the same capture backlog drain and proposal approval pipeline.
  • vouchdev/vouch#525: Updated the receipt-based pending resolution flow used by this drain.

Suggested reviewers: dripsmvcp, jsdevninja

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: trusted-agent auto-approval is now the default review behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-approve-default

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance mcp mcp, jsonl, and http surfaces storage kb storage, migrations, schemas, and proposals tests tests and fixtures size: M 200-499 changed non-doc lines labels Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe8fb5 and dce7a7e.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • src/vouch/capture.py
  • src/vouch/proposals.py
  • src/vouch/storage.py
  • tests/test_adopt.py
  • tests/test_delete.py
  • tests/test_jsonl_server.py
  • tests/test_trusted_agent_auto_approve.py

Comment thread src/vouch/proposals.py
Comment on lines +700 to +705
approved.append(
approve(
store, proposal.id, approved_by=approver,
reason="trusted-agent — auto-approved",
)
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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_approved stamp” 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-L83
  • CHANGELOG.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.

@github-actions github-actions Bot added the ci: passing ci is green label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: passing ci is green docs documentation, specs, examples, and repo guidance mcp mcp, jsonl, and http surfaces size: M 200-499 changed non-doc lines storage kb storage, migrations, schemas, and proposals tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant