Skip to content

fix(repair): route repair, automerge and intake lanes on typed fields, not prose - #1775

Merged
obviyus merged 7 commits into
mainfrom
judges-d-repair-lanes
Oct 9, 2026
Merged

obviyus merged 7 commits into
mainfrom
judges-d-repair-lanes

Conversation

@obviyus

@obviyus obviyus commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Repair, automerge, issue-implementation intake, and repair-worker validator/executor lanes now route on typed fields. They no longer match English prose written by the review model, the Codex repair worker, or ClawSweeper itself. (Pre-model selection for spam, gitcrawl and PR intake is in a separate PR.)

Producer change: a small typed attribute. Every PR needs-human verdict marker now carries hold=<cause> findings=<count>. The producer is src/clawsweeper-review-comment-automation.ts; the NeedsHumanHold type is in src/review-comment-markers.ts.

  • hold names the producer branch: normalization_failed, review_identity, maintainer_decision, review_failed, security, proof, not_opted_in (the review is ready but the PR has no repair-loop label), blocked, or undecided.
  • maintainer_decision and proof are set only when that hold is the single Before-merge item. Otherwise the hold is blocked, and a decision that also has security attention is security.
  • findings is the typed review-finding count. It is 0 for failed or unnormalized reviews.
  • Old comments without these attributes still parse, and they stay human pauses.

Removed judges and their typed replacements:

  • comment-router-core.ts isCanonicalLandingNeedsHumanText and missingProofNeedsHumanReason (prose: "no repair lane is needed", "land … canonical", "missing … proof") → needsHumanHoldAllowsAutomergeOptIn({hold, findings, liveVerification}). Callers:
    • the automerge opt-in (classifyNeedsHuman)
    • @clawsweeper approve (classifyMaintainerApprovedAutomerge)
    • the exact-head merge gate (maintainerApprovalAppliesToExactHeadReview)
    • the proof-override approval (approvedMissingProofNeedsHuman), whose description note is now keyed on hold=proof
    • the no-op repair continuation (execute-fix-artifact.ts maintainerApprovedNeedsHumanComment), which now parses the marker instead of running a regex over the body.
  • trustedCommentHasPriorityFinding ([P0-3] token in the Findings prose) → the findings>0 attribute. The verdict-less "comment has P findings → repair" fallback is deleted.
  • humanReviewJustification and humanReviewNextAction (keyword wording pickers) → humanReviewGuidance(hold).
  • issueImplementationBlockerClass and isHardIssueImplementationBlocker (regex over ClawSweeper blocker strings) → the code that writes each blocker sets its class: blockHard in the intake, and issue_implementation_blocker_class on router refusals.
  • comment-router.ts issueImplementationSecuritySignal (keyword grep of the issue title and body) → hasSecuritySignal, which checks explicit labels, ClawSweeper markers and CVE/GHSA IDs.
  • issue-implementation-intake.ts securitySensitiveText fallback and liveSecuritySensitiveText → the typed Security Review Status: line only. A missing or unknown status fails closed as a hard blocker.
  • finalize-open-prs.ts isSecurityRoutedAction reason regex → route_security or classification === "security_sensitive".
  • review-results.ts: the needs_human security reason regex, isFixFirstBlockedCloseAction, isUnavailableNeedsHumanAction, allowsSelfCanonicalCurrentMainCloseout, allowsHistoricalCanonicalForCloseout, the codex_review evidence /review regex and the closeout credit regex → typed action, status, classification and candidate refs, plus presence in the preflight item list. The applicator gates do not change: blocked closes are not executed, and fixed_by_candidate still requires candidate_fix.
  • apply-result.ts normalizeClassification (substring matching over classification, close_reason and reason) → the typed classification, or else a fixed action→classification table. An unknown value fails closed. The covering-PR label checks now use exact policy constants (PROOF_SUFFICIENT_LABEL, PROOF_OVERRIDE_LABEL, the needs_proof status label, the F rating label) instead of regex or substring matches.
  • execute-fix-validation.ts featureSignal keyword regex and the docs/config/tests/src path-role rules → count caps only: 8 likely_files and 4 affected_surfaces, configurable by env.
  • execute-fix-artifact.ts executableReplacementFixArtifact / shouldPromoteNeedsHumanReplacement (a regex over worker prose that promoted needs_human to replace_uneditable_branch) → the worker's typed repair_strategy is final.
  • execute-fix-github.ts supersededReplacementSources (regex over branch_update_blockers prose) → the first same-repo source PR, plus each source whose close_superseded action names no other fix or canonical PR.
  • Worker instructions: prompts/repair/autonomous.md and src/repair/run-worker.ts now say what the typed fields must carry instead of which words to write. Only the repair-worker prompt changed, so REVIEW_POLICY_VERSION is not bumped; a bump would invalidate every stored review.

Test fixture: scripts/e2e/implementation-backfill.mjs reports now carry the ## Security Review section that the renderer always writes. Docs: docs/pr-review-comments.md (marker attributes) and docs/repair/auto-update-prs.md (approval rule). Changelog: changelog.d/repair-lanes-typed-routing.md.

Why

Maintainer rule (LLM systems): code must not judge LLM work with regex or keyword classifiers. The model judges; code validates structure and enforces hard boundaries. This PR covers these code-judge inventory items from Batch D:

  • isCanonicalLandingNeedsHumanText / missingProofNeedsHumanReason (core ~826–844)
  • trustedCommentHasPriorityFinding (core ~2363)
  • humanReviewJustification / humanReviewNextAction (core ~3352)
  • issueImplementationSecuritySignal / securitySensitiveText (router ~3062, intake ~1439)
  • the finalize-open-prs ~712 security regex
  • the review-results fix-first, closeout and label regexes
  • the execute-fix feature, replacement and source-blocker regexes

Proof

  • Live comments with legacy markers. I built main (c48313d) and this branch. I sent the 8 real ClawSweeper review comments in /tmp/rules-slice/c*.md through parseTrustedAutomation and maintainerAutomergeOptInApprovesNeedsHuman on both builds. All 8 got the same intent (7 clawsweeper_needs_human, 1 clawsweeper_auto_repair), and opt-in approval was false on both. Legacy needs-human comments stay paused.

  • Saved real reports. I rendered prompt-rest, prompt-lean, prompt-dump and async-proof/{base,branch} with both builds. The intent did not change. The branch marker adds the typed cause: hold=review_identity findings=0 as saved, and hold=normalization_failed findings=0 when given a lease identity (these older reports do not normalize on current main).

  • Tests for consumer-visible behavior:

    • The typed hold drives approval. Security, integrity and blocked holds are never waived. Legacy markers fail closed.
    • The findings count drives needs-human → repair; finding prose does not.
    • The typed hold picks the guidance, even when the reason text says "security".
    • The producer emits not_opted_in, blocked, proof and maintainer_decision. A decision plus another blocker gives blocked. A decision with security attention gives security.
    • Intake reads only the Security Review status, and a missing status fails closed.
    • Superseded-source closes that name another fix are left to the applicator.
    • Worker-result validators accept typed actions without keyword prose.
  • pnpm run check (once, on the rebased head): static checks, format, build:all and lint all passed. The changed-coverage test run had 6,953 passes and 2 failures in files this PR does not touch. Both pass in isolation: test/review-git-acquisition.test.ts (the known unshallow lock flake) and test/apply-runtime-budget.test.ts (a 14.6 s hung-command timeout under load). An earlier run found one real break, scripts/e2e/implementation-backfill.mjs reports with no Security Review section, which now fail closed. I fixed it by giving the fixture the typed Status: not_applicable that real reports always render.

  • Production automerge e2e (node scripts/e2e/automerge-container.mjs --scenario all --fixture all, Docker): all 28 scenarios pass on both fixtures. node scripts/e2e/endor-automerge.mjs passes too. The first CI run failed approve-intent-persistence for two reasons. (1) The router command builder in comment-router.ts copied a fixed list of fields and dropped needs_human_hold/review_findings, so every opt-in approval failed closed. (2) The e2e fixture still emitted a legacy prose-only marker. Both are fixed.

Needs maintainer call

None open. The decisions taken in review are listed under Merge Danger.

Codex review dispositions

  • Round 1 (all fixed):
    • [P1] The proof hold could cover another blocker. Fix: hold=proof only when proof is the single blocker.
    • [P1] A normalization failure with stored findings would flip to auto-repair. Fix: findings=0 for those reviews.
    • [P2] The @clawsweeper approve caller still passed reason. Fix: it passes the typed hold and findings.
  • Round 2: no findings.
  • Round 3 (combined branch): [P1] The replacement path could close a secondary source whose blocked close_superseded named a different candidate_fix. Fix: only closes with no candidate or canonical ref are bound to the replacement. Test added and prompt clarified.
  • Round 4 (this split PR): no actionable findings. After that I rebased on ef343c0 (fix(review): stop code from rewriting model findings, ratings and proof status #1773). The only conflict was in test/pr-proof-automation.test.ts, where I kept main's new N/A-proof expectation and rewrote the proof-hold test to use real mock-only proof.

Merge Danger

  • Door: two-way. Marker attributes are additive, and old comments still parse as human pauses. A revert restores prose routing.
  • Blast radius: automerge and autofix repair loops, issue-implementation intake, and the repair-worker validators and executor, on all target repos.
  • Approved decisions (maintainer):
    1. An automerge opt-in or @clawsweeper approve waives hold=not_opted_in, hold=maintainer_decision and hold=proof when findings=0. maintainer_decision and proof are set only when that hold is the one Before-merge item; otherwise the hold is blocked, which cannot be waived. hold=security and the integrity holds (review_identity, normalization_failed, review_failed) are never waived.
    2. ClawSweeper-owned label names use exact equality with the policy constants in apply-result.ts.
    3. The fix-scope count caps stay as a deterministic boundary. This is stricter than before: every untrusted artifact over 8 files or 4 surfaces is blocked, not only feature-looking ones.
  • Other expected shifts:
    • A review whose prose said "no repair lane" but whose typed cause is blocked no longer auto-approves on opt-in.
    • Issue intake blocks reports that have no typed Security Review status.
    • Risk words in a live issue title no longer block intake; explicit labels, markers and advisory IDs still do.
    • Code no longer promotes needs_human repair strategies to replacement PRs.
    • Credit in closeout comments is now owned by the prompt. Replacement credit stays structural through credit_notes.

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The branch routes repair, automerge, issue intake and worker execution using structured fields instead of interpreting explanatory prose.

Example: An operator reads a response with hold=proof and reason “Security wording in a proof review.”

  • Before: The reason text selects security guidance.
  • After: The typed proof hold selects guidance explaining the missing proof.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful production code reduction with no actionable defect and documented end-to-end CLI proof, bounded by simulated GitHub and Codex.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The updated body reports passing Docker runs through the documented production CLI chain, including typed proof-hold approval persistence, stale-review rejection and Endor human pauses with no merge call. Git and final repository changes are real; GitHub and Codex are simulated, so this establishes controlled workflow behavior rather than live hosted integration. Legacy-comment replay and additive attributes establish compatibility without migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators can see repair loops pause or advance because of wording rather than the review's recorded decision.
Reason: The change follows the established model-owned review direction and removes competing semantic classifiers. The approval and scope-policy choices are recorded within the affected area.

Merge readiness

✅ Ready for maintainer review

This PR remains useful on current main, and no actionable patch defect was found. The recorded routing decisions preserve independent final-action gates.

Priority: P2
Reviewed head: f3b5a931a72de83e807f80e03db3eb75e76a8016

Before merge

None.

Findings

None.

Provenance

  • src/repair/apply-result.ts: prose classification and covering-label matching: original intent not found (unknown: File history and git log -S did not establish the original rationale before an unavailable historical blob stopped the search; a REST patch confirmed a later rewrite rather than introduction.)
Agent review details

How this fits together

ClawSweeper turns model reviews and authorized operator commands into repair jobs, human pauses and guarded GitHub actions. These changes affect the routing between those inputs and the final action checks.

flowchart TD
 A[Model review report] --> B[Typed verdict producer]
 B --> C[Comment router]
 D[Authorized operator command] --> C
 C --> E[Human pause]
 C --> F[Repair and intake workers]
 C --> G[Final action checks]
 F --> G
 G --> H[Guarded GitHub actions]
Loading

Technical review

Best possible solution:

Keep model judgments authoritative through typed producer fields while retaining authorization, freshness and final-action checks.

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

Yes, from source: base routing chooses approval and guidance from English phrases, allowing equivalent review decisions to route differently with different wording. This read-only review did not execute target code.

Is this the best way to solve the issue?

Yes: producer-owned fields remove competing semantic decisions while preserving structural validation and independent final-action gates.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e4c173aeed28.

Provenance checked

  • src/clawsweeper-review-comment-automation.ts: readiness-based verdict production keeps the original intent (fix(review): status label contradicts Before merge; regex classifiers add refuted blockers #1766: Make the shared Before-merge readiness calculation own status and automation decisions.)
  • src/repair/comment-router-core.ts and src/repair/comment-router.ts: human-verdict approval and guidance changes intended behavior with a stated reason (fix(repair): resume armed automerge verdicts #694: Resume armed automerge work and recognize canonical landing conclusions without accepting actual prioritized findings.)
  • src/repair/issue-implementation-intake.ts: security signals and blocker classes changes intended behavior with a stated reason (7acc349: The commit states that it refines the viable issue security gate.)
  • src/repair/execute-fix-artifact.ts: replacement strategy promotion and continuation changes intended behavior with a stated reason (62dd779: The commit states that it unifies the ClawSweeper repair lane.)
  • src/repair/execute-fix-validation.ts: autonomous scope classifiers changes intended behavior with a stated reason (75046f7: The commit states that it extracts fix-execution policy helpers.)
  • src/repair/execute-fix-github.ts: replacement-source selection changes intended behavior with a stated reason (d1db691: The commit states that it tightens ClawSweeper workflow helpers.)
  • src/repair/review-results.ts, src/repair/finalize-open-prs.ts and worker instructions: action validation keeps the original intent (62dd779: The commit states that it unifies repair planning and execution.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Unique work remains on main: The pinned introduced diff changes the marker producer, routing consumers, intake and executor. The merged fix(review): stop code from rewriting model findings, ratings and proof status #1773 changes decision normalization and proof applicability rather than implementing these routing changes. (src/clawsweeper-review-comment-automation.ts:129, f3b5a931a72d)
  • Exclusive waivable holds: Proof and maintainer-decision holds are emitted only for a single Before-merge item. Failed or unnormalized reviews carry zero actionable findings, and the approval predicate rejects security, integrity and blocked holds. (src/clawsweeper-review-comment-automation.ts:129, f3b5a931a72d)
  • Typed attributes reach routing consumers: The current command builder carries needs_human_hold and review_findings, addressing the production e2e failure described in the PR body. (src/repair/comment-router.ts:568, f3b5a931a72d)
  • Recorded routing decisions: The PR body records accepted zero-finding waiver rules, exact owned-label matching and deterministic scope caps. The implementation stays within those stated limits. Captured body identity: 510470b07b0f618f9aa70e6974caa24b03bf5358cce9d827ebd22a10c179ccbb. (f3b5a931a72d)
  • Final merge boundary: The final merge owner refreshes the exact-head review and applies protected-label, live-verification, check and mergeability gates before merge I/O. Human approval is evaluated against that refreshed review. (src/repair/comment-router.ts:4370, f3b5a931a72d)
  • Replacement and applicator boundaries: Secondary source closes naming another candidate or canonical PR are excluded from replacement closure selection. The applicator independently refuses blocked actions and fixed-by-candidate closes without candidate_fix. (src/repair/execute-fix-github.ts:141, f3b5a931a72d)

Review metrics

Metric Value Why it matters
Production and test LOC Production +283/-419; tests +398/-126 Production code shrinks as competing prose classifiers are removed; most added code supports regression coverage.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This improves automation-routing correctness without evidence of an urgent production outage.
  • merge-risk: 🚨 automation: The recorded, accepted routing choices change which human holds can proceed through automerge across target repositories.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-08T23:37:35.334Z sha 97f4d95 :: needs maintainer review before merge. :: none

Reviewed October 8, 2026, 8:04 PM ET / October 9, 2026, 00:04 UTC (Revision 2).

@obviyus
obviyus force-pushed the judges-d-repair-lanes branch from 97f4d95 to f3b5a93 Compare October 8, 2026 23:59
@obviyus

obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 9, 2026
@obviyus
obviyus merged commit ca02659 into main Oct 9, 2026
27 of 28 checks passed
@obviyus
obviyus deleted the judges-d-repair-lanes branch October 9, 2026 00:13
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. 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