Skip to content

fix(review): stop code from rewriting model findings, ratings and proof status - #1773

Merged
obviyus merged 1 commit into
mainfrom
judges-decision-normalization
Oct 8, 2026
Merged

obviyus merged 1 commit into
mainfrom
judges-decision-normalization

Conversation

@obviyus

@obviyus obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

This PR removes the code that rewrote or replaced the reviewer model's decision (inventory batch B, "decision normalization overrides"). The model findings, next step, correctness, risks, PR rating, and proof status now go through as the model wrote them. Code still validates structure only.

Removed judges:

  • src/clawsweeper-decision-parser.ts normalizeDecisionForItem: the contributor changelog stripper. Three regexes deleted findings and next steps about changelog entries for OpenClaw contributor PRs. The code then changed overallCorrectness from incorrect to correct, cleared the work lane, and replaced the model prRating with derivedPrRating. Also removed: isOpenClawContributorPullRequest, isContributorChangelogEntryFinding, STANDALONE_CHANGELOG_ENTRY_REQUEST, NEXT_STEP_CLAUSE_SEPARATOR, CLEAN_OPENCLAW_PR_REVIEW_NEXT_STEP, and the DecisionNormalizationItem type and isMaintainerAuthorAssociation dependency that only this code used.
  • src/clawsweeper-decision-parser.ts isEnvironmentAccessCaveat: a prose regex (GH_TOKEN, shallow clone, unauthenticated gh) that removed model risks.
  • src/clawsweeper-rating.ts normalizePrRating proof cap: proofTierFromRealBehaviorProof lowered the model proofTier and overallTier when a verification receipt was attached. Only the structural rule stays (0 to 3 nextSteps, none for S/A/NA).
  • src/clawsweeper-rating.ts derivedPrRating, patchTierFromReview, defaultRatingNextSteps: a heuristic scorer that made a rating from proof status, finding priorities, and confidence thresholds. It ran when the stored rating was missing or malformed, when a maintainer PR had a D/F proof tier with N/A proof, and from the changelog stripper.
  • src/clawsweeper-runtime.ts isDocsOnlyPullRequestReport and every use of it: the proof gate exemption in src/clawsweeper-proof-policy.ts, the forced fixed proof in src/clawsweeper-report-parser.ts defaultRealBehaviorProof/reportGeneralBehaviorProof, linkedPullCannotSupersedeDocsOnlySource in src/clawsweeper-promotion-facts.ts, and the docs-only veto in src/clawsweeper-coverage-proof.ts. isDocsPath, linkedPullRequestFiles, pullRequestFilePathsFromReport, and the files/filesKnown fields of LinkedPullRequestSupersession had no other users, so this PR removes them too.

Replacement:

  • Missing or malformed rating: the report shows NA tiers and says "This report has no valid PR rating. A fresh review must rate this PR." Rating-gated automation (stale-F close, D/F budget close, S/A/B guards) gets no tier from code.
  • Proof gate: the model realBehaviorProof.status decides. For external PRs, sufficient, override, and not_applicable clear the gate. needsContributorAction: true or missing/mock_only/insufficient block it. An external PR with no proof section, or one that does not parse, still counts as missing (fail closed). not_applicable cannot clear proof when the model starts the summary with the authority-chain proof marker.

No prompt or rules change was needed, so REVIEW_POLICY_VERSION is unchanged. The rules already cover this:

  • prompts/review-item.md (realBehaviorProof): "not_applicable for non-PR items, maintainer/bot PRs outside the gate, and docs-only PRs."
  • prompts/review-item.md: "missing gh auth, GH_TOKEN, a shallow clone, or unavailable authenticated GitHub does not lower confidence and is not a risk."
  • src/repository-profiles.ts OpenClaw promptNote: "Do not make missing CHANGELOG.md a review finding, merge blocker, work item, or next-step blocker."
  • instructions/pr-review-rules.md ### Rating rubric owns all tiers.

Why

Maintainer rule (AGENTS.md, "LLM systems"): never use a regex or code judge on LLM work. Code validates structure and enforces hard boundaries only. Inventory items, batch B (local code-judges inventory): changelog finding stripper and correctness flip, isEnvironmentAccessCaveat, normalizePrRating proof cap, derivedPrRating, and the docs-only path rule in runtime, report-parser, promotion-facts, and coverage-proof.

Proof

Before = origin/main 9f3d54f dist, after = this branch dist.

  1. 59 saved real reports (~/Developer/.agents/handoffs/clawsweeper-review-quality/** and /tmp/rules-slice/**), re-rendered with the shipped renderReviewCommentFromReport (dev/render-comments.mjs): 59 of 59 comments are byte-identical. No saved real report used a removed judge.

  2. Three real Codex decisions (167298, 167362, 144991) through the shipped parseDecision with a contributor OpenClaw item. I parsed each one as recorded, and again with a contributor changelog finding, a required changelog next step, and a GH_TOKEN risk added:

before 167298 real:     findings=[] correctness=correct risks=0 nextStep=none rating=B/B/B
before 167298 injected: findings=[] correctness=correct risks=0 nextStep=none rating=A/A/A
after  167298 real:     findings=[] correctness=correct risks=0 nextStep=none rating=B/B/B
after  167298 injected: findings=["Add the required changelog entry"] correctness=incorrect risks=1 nextStep=required "Add the required changelog entry." rating=B/B/B

(167362 and 144991 give the same result.) Before, code deleted the model's finding, next step and risk, changed correctness, and replaced the model's B rating with a computed A.

  1. Proof gate variants of real report 166599 (external CONTRIBUTOR, model rating C):
Variant before after
unchanged needs maintainer review, 3/6 needs maintainer review, 3/6
only docs/ files, model proof missing needs maintainer review needs real behavior proof
only docs/ files, model proof not_applicable needs maintainer review needs maintainer review
source files, model proof not_applicable needs real behavior proof needs maintainer review
no PR rating recorded, model proof missing computed 🧂 1/6 🌊 NA, "no valid PR rating"

Checks: pnpm run build:all, pnpm run lint, the full node scripts/run-node-tests.mjs all (6983 tests, 0 fail), and one pnpm run check (exit 0: build, lint, static checks, coverage gates, 6983 tests, 0 fail).

Codex review dispositions

codex review --base origin/main (and an earlier run against --base main): "No actionable defects were found." No P0–P2 items to fix.

Merge Danger

Door: two-way. Revert restores the old judges. No stored data or schema changes.

Blast radius:

  • Proof gate policy change (maintainer-approved). This replaces commit 76636fa (2026-08-30, "N/A cannot exempt applicable PRs"). External PRs that the model marks realBehaviorProof.status: not_applicable now skip the proof gate and can get a pass verdict. Before, only PRs whose files were all under docs/ could skip it. A docs/-only external PR that the model marks missing now needs proof (before, code exempted it). The authority-chain proof marker and failed or malformed verification receipts still block.
  • Reports with a missing or malformed rating get the rating: 🌊 off-meta tidepool label and NA tiers instead of a computed tier. Close promotions that need a D/F tier do not fire for them, and S/A/B close guards do not protect them. A fresh review restores the model's rating.
  • Verification receipts no longer lower model tiers. A maintainer PR with a model proof tier of D/F now shows the model's rating.
  • Supersession auto-close no longer refuses a docs/-only PR because the canonical PR changes code. The model coverage-proof step and unsafeCanonicalPullRequestReason still apply.
  • OpenClaw contributor PRs: if the model reports a changelog finding against the promptNote, it now shows as a finding. Before, code removed it. The fix for that belongs in the prompt, not in code.

@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 preserves model-authored findings, risks and ratings, and makes the model’s proof assessment determine proof applicability.

Example: A maintainer reads a review containing “Add the required changelog entry.”

  • Before: The contributor-specific normalizer removes the finding and required next step, changes correctness to correct, and replaces the recorded B rating with A.
  • After: The finding and required next step remain visible, correctness stays incorrect, and the recorded B rating is preserved.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, coherent code removal with no actionable defect found, but the supplied proof stops at in-process production-function replay.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes
User problem: Maintainers can see findings disappear and ratings change after the reviewer has made its assessment.
Reason: The change restores the model-owned review contract established by prior merged work from the same area contributor. The proof-policy transition is explicitly described rather than hidden in the cleanup.

Merge readiness

✅ Ready for maintainer review

This PR advances the established model-owned review direction and contains useful work that current main has not implemented; no concrete patch defect was found.

Priority: P2
Reviewed head: fec15604204f662bd763622ec8d99e4fd29c3343

Before merge

None.

Findings

None.

Provenance

  • src/clawsweeper-decision-parser.ts: contributor finding and environment-risk filters: original intent not found (unknown: These filters already existed before modularization. Historical string searches on src/clawsweeper.ts encountered missing blobs; the modularization commit's GitHub PR lookup returned no associated PR, leaving the original rationale unestablished.)
  • src/clawsweeper-rating.ts and src/clawsweeper-report-parser.ts: computed fallback ratings: original intent not found (unknown: The scorer exists in pre-modularization source, but missing historical blobs prevented establishing its original introduction and stated reason.)
  • src/clawsweeper-promotion-facts.ts and src/clawsweeper-coverage-proof.ts: docs-only supersession veto: original intent not found (unknown: The veto exists in pre-modularization source. Searches across the old monolithic and moved paths could not establish its original introduction because historical blobs were unavailable.)

Tests

  • Missing end-to-end proof: A controlled before/after run through the shipped review/apply CLI should show preserved decisions and matching comment, label and automation outputs for the changed proof applicability.
Agent review details

How this fits together

ClawSweeper turns model decisions into stored reviews, public comments, labels and automation verdicts. These changes affect the parsing and proof checks between the model’s assessment and those outputs.

flowchart TD
  A[Model review decision] --> B[Structure validation]
  B --> C[Stored review report]
  C --> D[Proof and readiness checks]
  D --> E[Public review comment]
  D --> F[GitHub labels]
  D --> G[Opted-in automation verdict]
Loading

Technical review

Best possible solution:

Keep semantic review judgments with the model while preserving structural validation, report-integrity checks and independent automation boundaries.

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

Yes, from source: the base parser deletes qualifying contributor findings and risks, changes correctness, and synthesizes a replacement rating; the supplied before/after transcript exercises that trigger. This review did not execute target code.

Is this the best way to solve the issue?

Yes: removing the competing judgment paths directly addresses the cause and follows the established model-owned contract; structural and independent safety checks remain.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced changes and current-main comparison: The pinned base-to-head diff removes the decision filters, computed ratings and file-path proof exemptions; these paths remain present on the fetched main revision. All introduced production and test hunks were inspected. (src/clawsweeper-decision-parser.ts:1167, fec15604204f)
  • Existing product direction: The same area's recent contributor authored the merged feat(review): judge PRs on product value, provenance and end-to-end proof #1755, which explicitly assigns product, proof and rating judgments to the reviewer model rather than code caps or regexes. (src/clawsweeper-decision-parser.ts:551, 197df625648b)
  • Intentional proof-policy transition: The PR body explicitly describes the approved transition from the host policy established in fix(review): align required proof comments and status labels #1310: model not_applicable now clears ordinary external proof requirements, while missing assessments, failed receipts and required authority-chain proof remain blocked. (src/clawsweeper-proof-policy.ts:40, fec15604204f)
  • Retained fail-closed boundaries: Missing or unusable external proof assessments become missing proof; ambiguous metadata remains blocked. Failed or malformed verification receipts and the authority-chain marker retain independent checks. (src/clawsweeper-report-parser.ts:695, fec15604204f)
  • Supplied runtime evidence: The fully read PR body reports 59 byte-identical saved-report renders, before/after parsing of three real decisions with injected findings and risks, and proof-policy variants. The transcript demonstrates preserved findings, incorrect correctness and B/B/B ratings after the change. It describes direct built-function replay rather than a shipped review/apply CLI run. Captured context source identity: 9a50b613db24f894665b26dc1d49fcdf3d51f2bba00a4d3ad1d9d64fc559db42. (fec15604204f)
  • Automation consumers: Readiness still combines findings, security, risks, product decisions and compatibility assessments; pass markers retain durable review identity and automation opt-in checks. Removing the docs-only supersession veto leaves the separate model coverage-proof gate intact. (src/clawsweeper-review-comment-automation.ts:163, fec15604204f)

Likely related people:

  • Ayaan Zaidi: Raw commit 197df62 adds src/clawsweeper-decision-parser.ts:660 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 197df625648b; files: src/clawsweeper-decision-parser.ts)
  • Peter Steinberger: Raw commit 76636fa adds src/clawsweeper-proof-policy.ts:38 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 76636fabadbb; files: src/clawsweeper-proof-policy.ts)

Review metrics

Metric Value Why it matters
Production and test LOC Production +57/-405; tests +159/-695 The reduction removes competing judgment paths and updates coverage to the model-owned contract.

Labels

Label changes:

  • add P2: This is a bounded review-correctness improvement without evidence of an urgent production outage.
  • add merge-risk: 🚨 automation: The explicitly accepted policy transition lets model not_applicable clear external proof gating and changes automation verdicts, while independent failure checks remain.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This is a bounded review-correctness improvement without evidence of an urgent production outage.
  • merge-risk: 🚨 automation: The explicitly accepted policy transition lets model not_applicable clear external proof gating and changes automation verdicts, while independent failure checks remain.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

Reviewed October 8, 2026, 6:51 PM ET / 22:51 UTC.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant