Skip to content

fix(repair): hash reports without the review_record line for implementation intake - #1842

Merged
obviyus merged 1 commit into
mainfrom
review-record-intake-key
Oct 9, 2026
Merged

obviyus merged 1 commit into
mainfrom
review-record-intake-key

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Issue-implementation intake now hashes a report without its review_record line: reportRevisionSha256(markdown) = sha256(reportWithoutReviewRecord(markdown)).

The line repeats the review. Adding it, either through a new review (#1838) or through the S2 backfill, must not look like a new review revision.

  • REVIEW_RECORD_KEY and reportWithoutReviewRecord move into report-front-matter.ts, the light front-matter owner. Intake imports from there, so it stays free of the decision parser (the repair-intake dist copy test needs that). review-record.ts uses the same helper to drop an invalid record.

Why

This is required before S2b may write (maintainer decision on row 2). Intake keys implementation jobs on a hash of the whole report. If a bulk backfill added the line, the next intake run would treat every item with an audit as changed:

  • issueImplementationJobNeedsRefresh returns true;
  • intakeAuditRetryDeferred stops deferring;
  • dispatchedIssueImplementationWorkerRetryDue returns true even after the attempt limit;
  • items with a matching not-eligible audit become fresh candidates, and repair-issue-implementation-backfill dispatches an intake workflow (and maybe a Codex worker) for each.

The state branch currently has 1517 audits with a job_report_revision_sha256 and 1394 with a queued decision.

Proof

Failing-first test (test/repair/issue-implementation-intake.test.ts, "adding the review record does not change the implementation-intake revision"). Before the fix:

✖ adding the review record does not change the implementation-intake revision
  actual:   '6d953c0af33e8ce1b9278f81968fe9618b70ca41dfe6e84b9c1f0b6f997fdd96'
  expected: '72f93ba485d8b075ece94adf62f676b3ca9061ec3d481fa7119601b75dc3a230'

After the fix it passes. The same test also checks two things: a queued audit made for the report without the line does not need a refresh, and a real front-matter change still changes the revision.

Shipped CLI, main vs branch. node dist/repair/issue-implementation-intake.js candidates, run from each build on a strict-bug report whose intake audit (decision: not_eligible) matches it, before and after a review_record line is added. The driver is in ~/Developer/.agents/handoffs/clawsweeper-review-record/.

main   410f120f8: candidates with the audited report: (none); after adding review_record: 123
branch b77e9e23e: candidates with the audited report: (none); after adding review_record: (none)

Churn that S1 may already have caused. S1 merged at 2026-10-09T20:14:45Z. Measured on the clawsweeper-state branch at head 55f7b21 (2026-10-09T20:17:56Z), at 20:20:38Z: 0 of 2164 intake audits were prepared at or after S1, or hashed a report reviewed at or after S1. The last repair-issue-implementation-intake run started at 20:07:25Z, before S1. So no stored audit holds a full-report hash of a report that has the line, and none will refresh because of this change. The count grows only for audits that intake writes between now and this merge. Re-measure with:

git clone -q --depth 1 --filter=blob:none --sparse --branch state https://github.com/openclaw/clawsweeper-state.git s \
  && git -C s sparse-checkout set results/issue-implementation-intake \
  && grep -rlE '^prepared_at: 2026-10-(09T2[0-9]|1)' s/results/issue-implementation-intake | wc -l

build:all, lint, format:check, and the intake, worker-recovery, review-record and front-matter tests (82) pass.

Codex dispositions

codex review --base origin/main:

  • [P2] Preserve revision identity for existing intake audits. Not taken, with data. The finding covers audits that hashed a report already containing review_record. The measurement above found 0 such audits: intake has not run since S1. The clean-cutover rule keeps compatibility only for live stored data that is proven to exist, so the code has no old-hash fallback. Merging soon keeps the count at 0. If it grows before the merge, the worst case is one refresh for each of those items.

Merge Danger

  • Door: two-way. Revert restores the full-report hash.
  • Blast radius: implementation intake revision identity only. For reports without a review_record line the hash does not change. Reports with the line hash as if the line were absent. One-time refresh is bounded by the audits written between S1 and this merge (0 when measured).

@clawsweeper

clawsweeper Bot commented Oct 9, 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. 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. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

ClawSweeper excludes the structured review-record line from report revision hashes so adding that metadata does not restart issue implementation work.

Example: An operator adds review_record to the audited report for issue 123.

  • Before: The intake candidates CLI lists 123 again.
  • After: The intake candidates CLI continues to return no candidates.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, narrow repair with shipped CLI evidence, compatible observed state, and no actionable finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Copied terminal output exercises the built intake candidates CLI on the pinned main and head: adding review_record incorrectly selects audited issue 123 on main and leaves it excluded on head. The fixture covers candidate discovery rather than worker dispatch; saved-state measurement and live continuity checks support compatibility without migrating existing audits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Adding redundant review metadata can make previously audited issues appear fresh and restart implementation work.
Reason: The repair preserves the documented distinction between a materially changed review and existing implementation work. Its small scope and established record-owner direction justify the change.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main still treats added record metadata as a changed review. No actionable introduced defect was found.

Priority: P2
Reviewed head: b77e9e23e5c1036fa2f63a01955be14371300ec7

Before merge

None.

Findings

None.

Agent review details

How this fits together

Issue-implementation intake reads review reports and compares their revision hashes with saved audits to decide whether to queue or refresh repair work. This change keeps redundant structured metadata from changing that revision identity.

flowchart TD
  A[Stored review report] --> B[Remove structured record line]
  B --> C[Hash remaining report]
  D[Saved intake audit] --> E[Compare review revisions]
  C --> E
  E --> F[Reuse existing implementation work]
  E --> G[Consider changed review for repair]
Loading

Technical review

Best possible solution:

Keep revision comparison in the shared intake hash owner while preserving every substantive report change.

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

Yes: the contributor's main-versus-head intake CLI comparison shows an audited report becoming candidate 123 solely after adding review_record on main.

Is this the best way to solve the issue?

Yes: normalizing the shared revision input fixes candidate matching, refresh checks, and retry comparisons without introducing a parallel hash policy.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced repair: The pinned introduced diff changes the shared intake hash function and moves the existing record-removal implementation without changing its behavior. (src/repair/issue-implementation-intake.ts:1040, b77e9e23e5c1)
  • Current-main necessity: GitHub main remains at the pinned base, whose hash includes the entire report. Canonical search found this repair and the distinct read-only backfill proposal feat(records): read-only dry run for the review_record backfill #1841, with no merged replacement. (src/repair/issue-implementation-intake.ts:1039, 410f120f8b9a)
  • Shipped CLI proof: The fully supplied PR body, captured as sourceRevision 816426634666ced8b7154af88f5d073d4acb1e86a99500c55ff9cc77b51c63bd, records the built intake candidates CLI on main and head with a matching not-eligible audit. Adding review_record makes main emit 123; head still emits no candidates. This exercises candidate discovery, not worker dispatch. (src/repair/issue-implementation-intake.ts:537, b77e9e23e5c1)
  • Existing audit compatibility: The body reports zero audits containing hashes of record-bearing reports at its measured state revision. Live intake workflow history still shows the latest runs preceding the format merge, supporting that no intervening intake wrote incompatible hashes.
  • Stored-state continuity: Comparison from the contributor's measured state revision to the observed current state changes only results/comment-router.json; intake audits have not changed. Reports without the record retain their exact previous digest, so the observed existing audits need no migration. (ce71064653a2)
  • Feature history: Scoped history traces report revision hashing to the implementation backfill commit and record removal to feat(records): store the typed decision as a review_record front-matter line #1838. The latter's body establishes the additive record format and unchanged legacy consumers. An unrestricted historical stat encountered an unavailable unrelated blob; the relevant scoped patch was readable. (src/review-record.ts:24, 410f120f8b9a)

Likely related people:

  • Ayaan Zaidi: Raw commit 410f120 adds src/review-record.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 410f120f8b9a; files: src/review-record.ts)

Review metrics

Metric Value Why it matters
Production and test changes Production +23/-15 lines; tests +18/-0 lines The small production increase reuses one existing removal helper and repairs the shared revision boundary.

Labels

Label changes:

  • add P2: This bounded automation repair prevents redundant implementation refreshes when structured metadata is added.
  • 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.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This bounded automation repair prevents redundant implementation refreshes when structured metadata is added.
  • 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.

Reviewed October 9, 2026, 4:23 PM ET / 20:23 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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