Skip to content

fix(review): gate merges on attached verification - #1271

Merged
vincentkoc merged 1 commit into
mainfrom
fix/proof-gate-integrity
Aug 28, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/proof-gate-integrity

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where ClawSweeper could render an attached live verification as failed while stale review metadata still emitted a pass/automerge verdict. The mismatch was visible on openclaw/openclaw#129535, where noisy build and bundler warnings appeared in the captured CLI output even though the attached verification was presented as passing.

Why This Change Was Made

Attached live verification is now an identity-bound authoritative input across report parsing, presentation, labels, trusted review markers, the comment router, and the automerge shepherd. Failed, malformed, legacy, action-only, stale-head, or superseded verification cannot authorize landing; the final merge gate refreshes the exact-head review and comments immediately before merge.

Execution-environment failures remain maintainer/infrastructure-owned and preserve any independently recorded contributor proof. Maintainer proof authorization is durable but scoped to the reviewed head and cannot bypass later findings, security decisions, checks, mergeability, or review state.

User Impact

Operators will no longer see warning-laden or otherwise failed proof treated as a successful merge signal. ClawSweeper now requires an observed expect_text or expect_output result before attached verification can clear the proof gate, and routes proof-runner setup failures to maintainers instead of contributors.

OpenClaw Bay Impact

OpenClaw Bay is unaffected. This changes ClawSweeper review publication and automerge gating only; no Bay dashboard or data contract changes.

Documentation Impact

No public documentation change is needed. Existing ClawSweeper contributor guidance already requires observed real behavior, exact-head review, and current proof before landing; this repair makes runtime enforcement match that contract.

Evidence

  • Before fix: a report with an attached failed verification rendered FAIL but emitted <!-- clawsweeper-verdict:pass ... -->.
  • After fix: the same report emits needs-human with live_verification=failed; trusted routing and the automerge shepherd both refuse the pass.
  • Action-only verification now fails closed unless at least one expect_text or expect_output observation is satisfied.
  • Execution-phase runner/setup failures preserve recorded proof and select status: needs maintainer proof decision, not status: needs proof.
  • Direct TypeScript builds passed for tsconfig.json and tsconfig.repair.json.
  • Focused proof, label, presentation, router, and shepherd suites passed, including 318 tests on the final review cycle.
  • A reviewer-initiated broad local corpus was non-authoritative on this host because live Codex/auth and host-only lanes failed outside their CI fixtures; no failure touched the changed proof-gate surface.
  • Oxfmt, oxlint, and git diff --check passed.
  • Fresh committed-branch Codex review found no actionable defects on the final head.
  • Local pnpm run check cannot run from this shared-module worktree because pnpm attempts dependency reconciliation; exact-head Linux CI is the full repository gate.

Accepted review findings:

  • Require an observed outcome before clearing proof: fixed by deriving pass only from a completed drive with a satisfied output/text expectation.
  • Route proof-runner failures away from contributors: fixed by preserving the recorded proof for execution failures and routing the workflow state to maintainer handling.
  • Require every expectation to succeed: fixed by requiring every recorded assertion to report satisfied: true.
  • Keep late maintainer approval authoritative: fixed by propagating validated approval into the final merge gate without bypassing later blockers.
  • Classify repairable states before the exact-review merge gate: fixed so failed checks and behind heads still enter their existing repair lanes.
  • Let validated approval pass the pause label only at final merge: fixed while retaining pause labels until merge succeeds.
  • Bind receipts to the exact reviewed plan: fixed with a canonical plan digest covering the surface, terminal completion, entry, payoff, and ordered steps.
  • Bind every outcome to every hashed plan step: fixed by requiring exact outcome cardinality, order, action, and subject/assertion; omitted, reordered, replaced, or extra outcomes fail closed.
  • Recheck the latest verdict immediately before merge: fixed by refreshing the pull request and trusted exact-head comments after the lease guard, then applying the complete readiness gate to that final snapshot before invoking the merge mutation.
  • Bind duplicated receipt fields to the plan: fixed by requiring the receipt's surface and entry to match the exact reviewed plan.

Production LOC: +867/-195 (net +672) | Tests/test support: +1447/-52 (net +1395).

The production growth establishes one authoritative verification state and exact-head final gate across existing report, label, router, and automerge consumers. It replaces contradictory downstream interpretations rather than adding a compatibility fallback.

Real Behavior Proof

Claim: ClawSweeper does not merge from stale or failed attached verification, and a current exact-head pass still completes the automerge workflow.

Surface: Deterministic comment-router and automerge-shepherd workflow.

Scenarios: resume-intent-persistence, approve-intent-persistence, final-review-failed-race, and final-review-malformed-race with the tiny fixture.

Command/environment:

env PATH="/tmp/clawsweeper-final-corepack-shim:$PATH" NODE_TEST_CONTEXT=child-v8 \
  node scripts/e2e/automerge.mjs \
  --scenario resume-intent-persistence \
  --fixture tiny \
  --output /tmp/clawsweeper-final-proof-gate-v4

env PATH="/tmp/clawsweeper-final-corepack-shim:$PATH" NODE_TEST_CONTEXT=child-v8 \
  node scripts/e2e/automerge.mjs \
  --scenario approve-intent-persistence \
  --fixture tiny \
  --output /tmp/clawsweeper-final-proof-gate-approve-v2

env PATH="/tmp/clawsweeper-final-corepack-shim:$PATH" NODE_TEST_CONTEXT=child-v8 \
  node scripts/e2e/automerge.mjs \
  --scenario final-review-failed-race \
  --fixture tiny \
  --output test-results/automerge-proof-gate

env PATH="/tmp/clawsweeper-final-corepack-shim:$PATH" NODE_TEST_CONTEXT=child-v8 \
  node scripts/e2e/automerge.mjs \
  --scenario final-review-malformed-race \
  --fixture tiny \
  --output test-results/automerge-proof-gate

Observed result: All four scenarios completed with status: passed. Current exact-head review, resumed intent, and validated maintainer approval reached the merge path; a newer same-head failed or malformed verdict introduced during the final guard blocked merge before the GitHub merge command. Separate operator probes confirmed partial-plan and stale-plan receipts also route to human handling and emit no trusted pass.

Artifact/trace: Local E2E output under /tmp/clawsweeper-final-proof-gate-v4/tiny/resume-intent-persistence, /tmp/clawsweeper-final-proof-gate-approve-v2/tiny/approve-intent-persistence, test-results/automerge-proof-gate/tiny/final-review-failed-race, and test-results/automerge-proof-gate/tiny/final-review-malformed-race.

Hosted final-effect trace: GitHub Actions run https://github.com/openclaw/clawsweeper/actions/runs/33132164764, artifact automerge-e2e-33132164764-1, records the production comment-router path at the merge boundary:

  • openclaw-shaped/happy-path/08-comment-router.stdout.log records action: merge, status: merged, merge_method: squash, and merge commit 2c7fe9a243371db877876911beffc34c40655813.
  • openclaw-shaped/final-review-failed-race/08-comment-router.stdout.log records action: merge, status: blocked, reason exact-head ClawSweeper review has failed live verification; its github-state.json records mergedAt: null and mergeCommitSha: null.
  • openclaw-shaped/final-review-malformed-race/08-comment-router.stdout.log records action: merge, status: blocked, reason exact-head ClawSweeper review has malformed live verification; its github-state.json records mergedAt: null and mergeCommitSha: null.

Real GitHub final-effect trace: The unchanged candidate head was also run through dist/repair/comment-router.js against a dedicated private organization test repository using the native GitHub CLI 2.98.0 and a maintainer credential. The harness used the router's explicit trusted-actor injection only for the isolated fixture; repository, token, item, local path, and commit identifiers are redacted here.

Allowed exact-head receipt:

GET issue comments (real GitHub API) x5
gh pr merge <item> --squash --match-head-commit <exact-head>
router action: merge
router status: executed
GitHub response: mergedAt non-null; mergeCommitSha non-null

Nearest forbidden receipt:

GET issue comments (real GitHub API) x4
GET issue comments #5 -> inject newer exact-head live_verification=failed receipt
router action: merge
router status: blocked
router reason: exact-head ClawSweeper review has failed live verification
transport calls after injection: no gh pr merge invocation
GitHub response: state OPEN; mergedAt null; mergeCommitSha null

The fault was injected between the initial passing review read and the final snapshot. The production router therefore observed the revoked authority at its final owner boundary and rejected it before real merge I/O, while the paired allowed run reached and completed real GitHub squash-merge I/O.

Rank-up move applied: a refreshed failed exact-head verification was rejected before real merge I/O, and the paired valid exact-head verification reached the allowed final effect.

Limits: The live trace uses the production router and real GitHub transport in an authorized private test repository. It uses a maintainer credential with the fixture-only trusted-actor override rather than a ClawSweeper App installation token; it proves final-effect authorization and revocation ordering, not App-token issuance.

Release Note Context

No changelog edit. ClawSweeper's changelog is release-owned; this is an internal automation correctness repair.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc vincentkoc self-assigned this Aug 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@vincentkoc
vincentkoc marked this pull request as ready for review August 28, 2026 01:13
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 10:10 PM ET / August 28, 2026, 02:10 UTC.

ClawSweeper review

What this changes

The branch makes an attached live-verification receipt an identity- and plan-bound input to review status, labels, comment routing, and the final automerge decision.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer landing review: it is not on current main, its receipt-validation and final exact-head gate are coherently implemented, and the supplied real GitHub final-effect trace addresses the prior authority-proof blocker.

Priority: P2
Reviewed head: a82d922c7a2efdb2f404c15384616362c1abeebe

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong final-effect proof and focused regression coverage support a mergeable automation repair, while the multi-consumer authority path merits normal maintainer review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Authority-chain proof required: the PR body supplies paired real-GitHub allowed and revoked-receipt runs through the production router, showing the forbidden case is rejected before gh pr merge I/O.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): Authority-chain proof required: the PR body supplies paired real-GitHub allowed and revoked-receipt runs through the production router, showing the forbidden case is rejected before gh pr merge I/O.
Evidence reviewed 5 items Receipt validation: The new receipt parser requires a single result bound to the repository, PR number, exact head, canonical proof plan, and ordered step outcomes; invalid or mismatched receipts become malformed rather than passing.
Final merge boundary: The router refreshes the PR and comments, checks the latest trusted exact-head review, and rejects failed, malformed, unknown, legacy, or non-passing review state before the merge command.
Focused regression coverage: The introduced tests cover malformed and stale receipt binding, exact plan-step cardinality, status presentation, and failed/malformed final-review races that must block merge before GitHub merge I/O.
Findings None None.
Security None None.

Live Verification

Command: pnpm run e2e:automerge -- --scenario final-review-failed-race --fixture tiny --output /tmp/clawsweeper-proof-gate

Result: PASS (completed)

$ pnpm run build:repair && node scripts/e2e/automerge.mjs -- --scenario final-review-failed-race --fixture tiny --output /tmp/clawsweeper-proof-gate
$ tsc -p tsconfig.repair.json
{
  "status": "passed",
  "fixture": "tiny",
  "scenario": "final-review-failed-race",
  "artifacts": "/tmp/clawsweeper-proof-gate/tiny/final-review-failed-race"
}










































Assertions:

  • PASS expect_output: "status": "passed"
  • PASS expect_output: "scenario": "final-review-failed-race"

How this fits together

ClawSweeper turns a reviewed PR report and its live-proof receipt into labels and trusted review markers, then its comment router decides whether to invoke GitHub merge. This change makes the receipt state authoritative across those stages and refreshes the exact-head review immediately before merge.

flowchart LR
A[Review report] --> B[Attached verification receipt]
B --> C[Identity and plan validation]
C --> D[Review marker and labels]
D --> E[Comment router]
E --> F[Final exact-head check]
F --> G[GitHub merge or pause]
Loading

Before merge

  • Resolve merge risk (P1) - This deliberately makes malformed or failed receipts pause otherwise eligible automerge, so operators need the existing maintainer-proof path for verifier-infrastructure failures.
  • Complete next step (P2) - No mechanical repair is identified; keep this member-authored PR on the normal maintainer landing path with its current proof.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change size production +867/-195; tests/test support +1447/-52 The broad but focused change adds one receipt authority model across all downstream merge consumers and substantial targeted coverage.
Files affected 29 files The PR touches parsing, presentation, routing, and automerge together, so the final end-to-end gate matters more than isolated unit behavior.

Merge-risk options

Maintainer options:

  1. Land with the fail-closed receipt gate (recommended)
    Accept the intentional behavior that a failed or malformed exact-head verification blocks automerge and routes execution-environment failures to maintainer handling.

Technical review

Best possible solution:

Land the single authoritative receipt-validation path with its exact-head final gate, retaining the documented maintainer-owned recovery path for execution-environment failures.

Do we have a high-confidence way to reproduce the issue?

Not applicable as an issue report. The PR body supplies an after-fix production-router trace showing both an allowed real GitHub merge and a newer failed receipt blocking merge before I/O.

Is this the best way to solve the issue?

Yes. Binding receipts to the reviewed plan and re-reading the latest exact-head review at the final merge boundary removes the competing stale-metadata authority path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 78540e0458bf.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Authority-chain proof required: the PR body supplies paired real-GitHub allowed and revoked-receipt runs through the production router, showing the forbidden case is rejected before gh pr merge I/O.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): Authority-chain proof required: the PR body supplies paired real-GitHub allowed and revoked-receipt runs through the production router, showing the forbidden case is rejected before gh pr merge I/O.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded merge-safety automation repair with meaningful operator impact but no demonstrated active user outage.
  • merge-risk: 🚨 automation: The diff changes review publication, labels, routing, and the final automerge gate.
  • merge-risk: 🚨 security-boundary: The diff changes which verified receipt state can authorize the final GitHub merge side effect.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): Authority-chain proof required: the PR body supplies paired real-GitHub allowed and revoked-receipt runs through the production router, showing the forbidden case is rejected before gh pr merge I/O.
  • proof: sufficient: Contributor real behavior proof is sufficient. Authority-chain proof required: the PR body supplies paired real-GitHub allowed and revoked-receipt runs through the production router, showing the forbidden case is rejected before gh pr merge I/O.

Evidence

What I checked:

  • Receipt validation: The new receipt parser requires a single result bound to the repository, PR number, exact head, canonical proof plan, and ordered step outcomes; invalid or mismatched receipts become malformed rather than passing. (src/live-proof/verification.ts:282, a82d922c7a2e)
  • Final merge boundary: The router refreshes the PR and comments, checks the latest trusted exact-head review, and rejects failed, malformed, unknown, legacy, or non-passing review state before the merge command. (src/repair/comment-router.ts:4269, a82d922c7a2e)
  • Focused regression coverage: The introduced tests cover malformed and stale receipt binding, exact plan-step cardinality, status presentation, and failed/malformed final-review races that must block merge before GitHub merge I/O. (test/live-proof.test.ts:2895, a82d922c7a2e)
  • Feature history: Live verification was introduced by Peter Steinberger in commit 03c1f45, and Vincent Koc's earlier current-main live-proof correction is d103c0c. (src/live-proof/verification.ts:103, 03c1f452ec49)
  • Still necessary: The reviewed head is not an ancestor of fetched current main, so this change is not implemented on main or in the stated latest release. (src/repair/comment-router.ts:4269, 78540e0458bf)

Likely related people:

  • Vincent Koc: Authored the reviewed change and the earlier current-main live-proof correction immediately preceding this branch. (role: recent live-proof contributor; confidence: high; commits: a82d922c7a2e, d103c0cf5c98; files: src/live-proof/verification.ts, src/repair/comment-router-core.ts)
  • Peter Steinberger: Introduced live verification and led the earlier repair-router and workflow foundations this PR extends. (role: original live-proof and repair-router contributor; confidence: high; commits: 03c1f452ec49, bf762f3f6f9e; files: src/live-proof/verification.ts, src/repair/comment-router.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-28T01:17:40.380Z sha a82d922 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-28T01:59:21.974Z sha a82d922 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 28, 2026
@vincentkoc
vincentkoc merged commit f3883a3 into main Aug 28, 2026
31 checks passed
@vincentkoc
vincentkoc deleted the fix/proof-gate-integrity branch August 28, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant