Skip to content

chore: Extend the completion gate to require fresh code-review evidence, not just verification - #654

Merged
getappz merged 2 commits into
masterfrom
task/182-extend-the-completion-gate-to-require-fr
Sep 7, 2026
Merged

getappz merged 2 commits into
masterfrom
task/182-extend-the-completion-gate-to-require-fr

Conversation

@getappz

@getappz getappz commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Status: Implementation is complete and verified.

This branch already had a full implementation checkpointed from a prior session (commits 1472f79/eefa054, "wip(sdd-loop): task 0 checkpoint"). I reviewed it against the task spec and it matches exactly:

  • ReviewEvidence struct in src/optimize/runtime.rs, parallel to VerificationEvidence, with has_fresh_review/invalidate_review using the same VERIFICATION_FRESHNESS_SECS window.
  • is_review_completion() triggers on the ReportFindings tool call specifically (not Skill/Task/Agent dispatch) — the doc comment explains why: dispatch only proves a skill loaded or an agent was backgrounded, not that review work happened. This is a real, documented coverage gap: a requesting-code-review subagent dispatch that only returns prose won't be picked up.
  • completion_gate_reason (src/hook_redirect.rs) now takes has_fresh_review: bool and blocks done/check_merge with a review-specific message, mirroring the verification message's style.
  • Wired through hook.rs (PreToolUse) and hook_completion_gate.rs (PostToolUse records evidence on ReportFindings success, invalidates both verification and review evidence on mutating tool calls).
  • Open question resolved explicitly: applies universally (human or dispatched agent), with reasoning in the doc comment — flagged as a judgment call for you to override if wrong, not treated as settled.

Verification performed this session:

  • cargo build --lib — clean.
  • cargo test --bin agentflare -- completion_gate review — all 30+ new/updated tests pass (hook_redirect::, hook_completion_gate::, optimize::runtime::).
  • Full cargo test --bin agentflare — 109/110 pass; the one failure (mcp_prompts::tests::optimize_review_returns_full_skill_body) is unrelated (untouched flare-code crate) and I confirmed it also fails identically on a clean master checkout.
  • cargo clippy on the touched files — no warnings. Workspace-wide -D warnings clippy has pre-existing failures in unrelated crates (agent-registry, flare-workflow) that I confirmed also exist on master.

Concerns: none blocking. Two things worth your attention:

  1. The two commits are still labeled "wip(sdd-loop): task 0 checkpoint" — want me to squash/reword before this goes further, or leave as-is for now?
  2. The known coverage gap (backgrounded subagent review dispatch not auto-detected) is real and documented in code, not silently swept under.

Opened by claude-code on flared:51bb8de6c33b for item #182 via agentflare.

Summary by CodeRabbit

  • New Features

    • Completion and merge checks now require both recent verification and review evidence.
    • Successful findings reports are recognized as review evidence.
    • Review evidence includes freshness tracking and is maintained throughout a session.
  • Bug Fixes

    • Verification and review evidence are cleared after changes that may affect their validity.
    • Completion checks now provide separate feedback when verification or review evidence is missing or outdated.
    • Added coverage for review reporting and evidence expiration scenarios.

shiva added 2 commits September 7, 2026 14:02
Agentflare-Branch: task/182-extend-the-completion-gate-to-require-fr
Agentflare-Item: 182-extend-the-completion-gate-to-require-fr
Agentflare-Branch: task/182-extend-the-completion-gate-to-require-fr
Agentflare-Item: 182-extend-the-completion-gate-to-require-fr
@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 744a2ec2-dda7-4226-8224-89f47d075d1a

📥 Commits

Reviewing files that changed from the base of the PR and between cc326f0 and eefa054.

📒 Files selected for processing (4)
  • src/hook.rs
  • src/hook_completion_gate.rs
  • src/hook_redirect.rs
  • src/optimize/runtime.rs

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The completion gate now requires fresh verification and review evidence. Runtime state records ReportFindings review evidence, invalidates evidence after mutations, and initializes review state across session paths.

Changes

Review evidence completion gate

Layer / File(s) Summary
Runtime review evidence state
src/optimize/runtime.rs
SessionRecord stores optional ReviewEvidence. Only ReportFindings completes review. Freshness and invalidation helpers use the verification freshness window. Tests cover detection, freshness, invalidation, and updated fixtures.
PostToolUse review recording
src/hook_completion_gate.rs
The PostToolUse hook records successful review evidence and invalidates review and verification evidence after mutations. Parsing coverage validates ReportFindings handling.
Completion gate integration
src/hook.rs, src/hook_redirect.rs
Session initialization includes last_review. Completion requests require fresh verification and review evidence. Tests cover missing and valid review evidence.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to eefa0

The completion gate now requires fresh review evidence alongside verification evidence, with review state recorded, invalidated after mutations, and checked before completion actions. The change is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: requiring fresh code-review evidence in the completion gate alongside verification evidence.
Description check ✅ Passed The description provides a detailed summary, test results, risk notes, known limitations, and compatibility context. It does not use the template headings or checkbox format, but it includes the requi…
Docstring Coverage ✅ Passed Docstring coverage is 92.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 4 files.
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 task/182-extend-the-completion-gate-to-require-fr

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

@getappz

getappz commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

Tracking this PR for automated review (flared:c997d745ae66).

@getappz
getappz merged commit 11533bc into master Sep 7, 2026
2 of 17 checks passed
@getappz
getappz deleted the task/182-extend-the-completion-gate-to-require-fr branch September 7, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant