Repository navigation
refactor(labels): read label decision fields from the typed review record - #1861
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesClawSweeper reads selected labels and their explanations from the saved structured review decision, preserves older reports, and rejects unreadable records during comment rendering. Example: A review report says P1 while its saved decision selects P2.
Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still reconstructs these label decisions from report text. The cutover follows the approved record design, and no actionable introduced defect was found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherClawSweeper stores review decisions in reports that its apply workflow uses to publish GitHub comments and synchronize labels. This change selects the saved decision data while retaining existing freshness, lease, and publication safeguards. flowchart TD
A[Saved review report] --> B{Structured record present?}
B -->|No| C[Read legacy report fields]
B -->|Yes| D[Strictly read saved decision]
D -->|Unreadable| E[Stop rendering or skip apply]
D -->|Readable| F[Select labels and explanations]
C --> F
F --> G[Render review comment]
F --> H[Guarded GitHub label sync]
Technical reviewBest possible solution: Keep the strict stored-decision reader and temporary legacy fallback, then move readiness-dependent fields together in the planned follow-up. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor rather than a reported production bug; the added disagreement fixtures demonstrate which decision source each consumer reads. Is this the best way to solve the issue? Yes: the adapter reuses the existing strict record reader and preserves exact legacy readers, while leaving proof, rating, and status together with their current readiness owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 20875f75782f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 9, 2026, 8:23 PM ET / October 10, 2026, 00:23 UTC. |
What
Row 2 slice S4a (typed ReviewRecord): labels that the review selects outside PR merge readiness read the reviewed decision from the report's
review_recordline. Follows #1848 (S3, merged); rebased on main20875f757.src/report-review-decision.ts:reportReviewDecision(markdown)returns the label fields of the decision (Pick<Decision, …>). With a record, the fields come from the record. A report without the line gets the same values from the same report readers as before. A line that does not read throwsReviewRecordFormatError: it gets no fallback.readReviewRecorddirectly.readReviewRecordOrLegacyneeds a fullDecisionfrom the legacy reader, and no full legacy reader gives the same label values:reportDecision()setsdecision: closeand drops PR impact labels, andlegacyReviewDecision()throws on 155 stored reports (dry run 37998508324).clawsweeper-apply-report-labels.ts), Telegram proof (clawsweeper-apply-pull-request-labels.ts), issue advisory state (issueAdvisoryLabelState(markdown, decision, options);typeandwork_statusstay host fields).clawsweeper-label-presentation.ts), and the triage priority in Merge readiness.selectedLabelJustifications(report-parser) holds the "one justification for each selected label" rule for the record and for the report.clawsweeper-apply-close-guards.ts), and the paired durable comment check returns no proof (clawsweeper-apply-decision-workflow.ts).codex reviewfound real disagreement cases between the labels and the status.Why
Design
review-record-design.md§6 step 4. Labels stop rebuilding decision fields from markdown.Proof
Real entry points, main
314018cccbuild (before S3) vs branch build (S3 + S4a; the proof ran before the rebase on20875f757, and the rebase had no conflicts):render-comments.mjs <dist> <dir>(rendersrenderReviewCommentFromReport(report, "none")).node dist/clawsweeper.js apply-decisions --sync-comments-only --item-numbers Nwith the repo's recording gh stub (promotionGhMock). gh calls are sorted with paths and uuids masked. Markdown is compared with apply timestamps and the run-dir decision packet path masked.Corpus: 73 saved real review reports (59 PR reports from
/tmp/judgesb-reports, 9 saved production reports, 5 real issue reports). Variants: no record, backfilled record (legacyReviewDecision+reviewRecordFrontMatterLine), the real record of #167817 from a real review, and a corrupt record (review_record: {broken…).apply-decisionsruns: 147/159 identical (apply result, gh calls, comments, markdown). For every no-record, backfilled-record and real-record run, label calls, gh calls, comments and markdown are the same on both builds (label calls: 0 to 4 for each run). The 12 runs that are not identical are all corrupt-record runs: main syncs the comment (and labels); branch recordsskipped_changed_since_review/review_record: the value is not JSON; fresh review required, makes 0 gh calls, and posts no comment (S3 gate). Issue #156814 stops in the gh stub on both builds (cannot acquire a review lease without the current item revision) for the readable variants.The corrupt-record comment render: 0/12 identical, because the branch render stops with
ReviewRecordFormatError(**Render failed:**in the driver output) where main renders from the report text. Full per-run table:proof-table.mdin the proof handoff.Checks run:
pnpm run build:all, focused tests (60 files that touch labels, comment rendering, proof policy, readiness, apply and records: 1511 pass, 0 fail, 22 skipped),pnpm run lint,pnpm run format:check.Codex dispositions
codex review --base origin/review-record-s3-apply-close(the S3 head), three runs:Merge Danger
Low. For a report with a readable record or no record, labels and comments are the same (proof above). The changed behavior is for a report whose
review_recorddoes not read: outside apply, the keep-open comment render stops withReviewRecordFormatErrorinstead of a comment. Nothing stored changes. Rollback is a plain revert.