fix(review): supersede stale exact-review runs#749
Conversation
|
@clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7f49b84 to
1aecfb4
Compare
|
@clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
bde5b1f to
c612047
Compare
|
@clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
vincentkoc
left a comment
There was a problem hiding this comment.
Two P1 blockers:
-
src/repair/comment-router-core.ts:1956-1998treats every trusted lease whose SHA differs from the caller SHA as superseded. SHA inequality has no ordering. An older worker that survives best-effort cancellation can reach this cleanup after the newer head has posted its lease, delete the newer lease, break its final in-place update, and allow another stale placeholder. Before deleting a different-head lease, prove the caller still owns the authoritative current queue revision/live PR head. Add the stale-A/newer-B race test. -
dashboard/exact-review-queue.ts:842-956,7282-7303accepts any numericrun_idfor the lease capability, persists it, then later obtains anactions:writetoken and cancels that run without proving it is the matching exact-reviewsweep.ymlrun for this item. A misbound or leaked lease can therefore cancel an unrelated workflow run inopenclaw/clawsweeper. Fetch and bind the run identity before cancellation (workflow/path, repository-dispatch event, item/head/revision), and test that an unrelated run id is never canceled.
The direction is useful, but cancellation and lease cleanup need authority/ordering proofs before this is safe to merge.
6a7a0f0 to
0b45037
Compare
002dc1c to
e2e199e
Compare
|
@clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(review): supersede stale exact-review runs This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
e2e199e to
9811ed8
Compare
|
Maintainer repair complete on head Additional authority races found during exhaustive review are also covered: delayed/opened ordering, same-timestamp sequencing, legacy missing-head takeover, transient verification retry, delivery redelivery idempotency, explicit commands during pending/parked/dispatching/leased states, and issue webhooks staying outside PR completion. Proof: 443/443 post-rebase focused tests; 182/182 final authority tests; three TypeScript builds; targeted format/lint/diff checks; fresh autoreview clean. Current CI is running on the exact contributor head. The remaining token-only alarm concern was rejected because production dashboard deployment requires the GitHub App private key; adding a second unsupported production credential path would widen the contract. |
Resolved on 9811ed8: queue/source authority is durable and run-id cancellation is removed; focused proof and fresh autoreview are clean.
|
@clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(review): supersede stale exact-review runs This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(review): supersede stale exact-review runs This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Final-head closeout for
Rank-up handling:
|
Fixes #747.
What Problem This Solves
Resolves a race where a newer pull-request revision or explicit review command could arrive while an older exact review still owned a lease. The stale worker could continue consuming capacity, interfere with the newer review comment, or cause command-specific prompt/status context to be lost.
Why This Change Was Made
The exact-review Durable Object is now the single source-authority owner. Pull-request webhooks reserve a durable monotonic authority sequence before verification; every PR action verifies the live head and retries transient verification failures through an alarm. Newer authoritative revisions revoke stale queue ownership cooperatively, while explicit commands inherit the verified source tuple and queue as follow-up revisions without replacing an active lease. Review-start cleanup is fenced by the full queue tuple and live source revision. Lease loss terminates and drains the complete review process group.
The original contributor direction and authorship are preserved. Maintainer fixes removed unsafe run-id-based cancellation and closed the ordering, redelivery, timestamp, legacy-head, and active-command races found during review.
User Impact
Only the current PR head can publish the authoritative exact review. Rapid synchronize/reopen events and explicit commands are not dropped, stale workers stop promptly, and newer review comments are no longer deleted by older workers. Queue protocol versions and public configuration remain compatible.
Evidence
9811ed80e370441a06c7f0a323cf9fe54cd02713, rebased oncb5f53f0272eb63c52f15981ffb9139d15afbb46.git diff --checkpassed.CLAWSWEEPER_APP_PRIVATE_KEY; token-only alarm fallback was intentionally not added.Related incident and state-store follow-up: #738.