Repository navigation
fix(reviews): publish fresh reviews from reused command leases - #2045
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 changesThis PR allows a fresh review to replace an older review when both reuse the same command-comment ID and the original report lease remains elected. Example: Issue 103599 has an older durable review and a later report using lease comment 6178075898 under owner github-run-current-1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current publication failure, preserves lease ownership checks, and introduces no actionable defect found in this review. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe apply publisher receives completed review reports, compares them with live GitHub review and lease comments, and writes the durable review only after freshness and ownership checks. flowchart TD
A[Completed review report] --> C[Publication guards]
B[Live GitHub comments] --> D[Lease election]
D --> C
C --> E[Final ownership check]
E --> F[Durable review update]
Technical reviewBest possible solution: Use the existing publication guards with freshly elected original-lease evidence while retaining strict supersession and source-freshness checks. Do we have a high-confidence way to reproduce the issue? Pinned main deterministically rejects the same-revision equal-ID tuple; the supplied baseline CLI replay reports that failure for both issues and PRs, but no target code was executed during this review. Is this the best way to solve the issue? The correction belongs in the shared publication ordering owner and uses existing lease election rather than weakening stale-result handling or adding another coordination mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 892e2aabc360. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
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 16, 2026, 6:56 AM ET / 10:56 UTC. |
What Problem This Solves
Fresh reviews can remain unpublished when a queued command reuses its status-comment ID under a later review owner. The publisher treats the equal ID as an older report even when the report's original lease is still active.
Observed in publisher run 38878996581: three members failed with
skipped_stale_review_comment_sync; diagnostics showed equal comment/report lease IDs. The workflow's overall success did not mean those reviews were delivered.User Impact
Fresh issue and PR reviews can replace an older durable review for the same revision while their original status lease remains elected. Missing, expired, replaced, ambiguous, and genuinely newer reviews remain protected. No operator migration is required.
Why This Change Was Made
Command acknowledgements intentionally reuse comment IDs. Comment-ID ordering alone cannot distinguish the owners. Carry the freshly elected lease through the existing publication guards and allow the equal-ID case only with distinct known owners, a strictly later report timestamp, the same reviewed revision, and a live lease matching the report's original owner and ID. A newly acquired mutation lease cannot supply that authority.
The independently verified newer-tuple rule remains strict; this change does not turn an unproven skip into successful supersession. No queue policy, retries, close policy, or schema changes.
Production LOC: +41/-4 (net +37); tests: +119/-2. The positive production delta carries authoritative lease evidence through existing guards. The 447-line isolated CLI replay is separate proof tooling.
Documentation Impact
Updated active contract
docs/pr-review-comments.mdand added one changelog fragment. Review-publication maintainers own the contract;src/clawsweeper-review-comment-state.ts, the apply lease guards, and the command-acknowledgement flow are its source of truth. Verified against baseline892e2aabc360d2403f49bcbf42902c3daee7dbf0and this head. Update when lease election, acknowledgement reuse, or publication ordering changes.Evidence
f4e1f232e85c8791051ebbb792a77c582ef70f9a.node --test test/review-comment-ordering.test.ts test/apply-label-sync.test.ts.pnpm run check, exercised remotely and by the exact-head CI checks.Real Behavior Proof
Claim and surface: actual built
apply-decisionsCLI, durable review PATCH, issue and PR paths, repeated live lease election, and the normal isolated action ledger.Scenario: synthetic same-revision report/live-comment tuples reproduce the equal reused-ID relationship observed in the failed publisher. This is not a capture of every failure-time lease field: the original incident's expiry was not retained, and the public status comment has since advanced to another owner.
Environment: native Crabbox Daytona, image
crabbox-daytona-2x4x10-20260803-3907a63, leasecbx_63cbb038cdb8; Linux x64, Node 24.22.0, pinned pnpm 12.4.1, stock GitHub CLI 2.102.0. Baseline and candidate package manifests/lockfiles match; both compiled trees use the qualified remote dependency install.Command:
Observed result, all 12 cases passed:
Both successful PATCH bodies contained the expected report owner and review time. Every case recorded zero forbidden requests. Labels were preseeded from canonical selection helpers so the replay isolates review publication. The PR fixture includes the current v2 activity cursor and exact empty activity connections.
Artifact / trace: checked-in
scripts/e2e/reused-review-lease-publication.mjswrites per-case HTTP transcripts, apply results, fixture/report/body hashes, andreceipt.json. The executed Node 24 receipt has these source/build identities (SHA-256):The remote capsule retains the baseline Git HEAD; the full-source manifest was independently recomputed from the local committed tree and matches the candidate receipt.
Limits: stock
ghtalks to a strict isolated HTTP peer; no live GitHub mutations, labels, or closes occur. This proves the changed CLI publication path, not canonical queue completion, R2 publication, or live backlog recovery. Separate GitHub comments do not provide an atomic transaction: replacement observed by the final election blocks mutation; a change after that snapshot remains a pre-existing race window.Follow-up: preserve typed apply-proof rejection reasons at the publisher before adding an Operations failure-reason chart. The current generic
unknown_failuretelemetry is insufficient for that chart; it does not justify inferring successful supersession or agent quality.