Repository navigation
fix(work-items): hand back on an outranked release and judge hand-back leases at a clock read before the list - #16515
Conversation
…k leases at a clock read before the list A release refused because an earlier live lease outranks the handle now supersedes its own lease and hands the assignee back before exiting 7, as a claim step 4 loss does; before, the live lease and its login stayed until the TTL (rule NoStrandedAssignee). The assignee hand-back reads the clock before each of its three lease lists and passes it to _wit_login_holds_other, so a same-login lease renewed after the list is never judged expired on its stale listed body (rule HolderAssigned). Refs: #16505 Refs: #16458 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-outranked-hand-back
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Session note (agent, not an owner decision). Held with Model check of this change (the #16458 claim-protocol model, updated for this diff and for #16509; TLC 1.7.4, renew on, failures off, bounded stall):
Controls: with the outranked release handing back but not superseding its own lease, Still breaking only with a failure switched on, unchanged in kind from #16458's known results: a failed best-effort write or a failed lease list inside the hand-back, and a process killed mid-rollback. One of these is new to this diff: when the outranked release's supersede fails, the hand-back still runs (as claim step 4 does), so the login can come off while that lease is live until its TTL. The updated model goes onto #16458 after this merges, with the sync commit moved to the merge commit. |
Lane run report
Failed GitHub API calls
|
|
claude-security-review reviewed Security review: PR #16515 at
|
|
claude-review reviewed claude-review of This review covered only what changed since What changed
Settled thread: the common.sh thread (original line 511) is still settled, and none of its lines changed. I did not raise it again. Not verified: I ran no tests; this lane has no shell. The author's "300 of 300" count is their own claim, and I did not check it. Plugin manifests: none changed in this push. Closing issues: none in scope for this push. Spend: none. Verifier dropped 0 of 0 candidates. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8400768157
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ersede The outranked release refusal now backs off as renew-lease's back-off does: it tries the supersede twice and hands the assignee back only after one try succeeded, else keeps the assignee and says so; exit 7 either way. The hand-back reads the clock before each list attempt, retries included, through _wit_list_at_clock. CONTRACT.md and the comment state the property that holds: a renew only moves an expiry later, so a renewing holder never looks expired, and a lease expiring during the list still counts as live. Refs: #16505 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Session note (agent). Update for head 4cae0ac: after an independent reread (verdict safe, no defect), the outranked release now hands the assignee back only once a supersede succeeded (two tries), as renew's back-off does, so the limit named in the comment above (login removed while the lease is still live after a failed supersede) no longer applies; the hand-back also re-reads its clock before each list retry. The model was updated to match and rerun: all eight rules hold in both configurations (1,721,943 and 1,361,412 distinct states), and with failed writes switched on |
A renew landing during the lease list can carry a renewed_at more than the skew margin ahead of the clock read taken before the list, when the holder's clock runs fast; the lease is then also judged at a read taken after the list. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A same-login holder whose clock runs 300 s ahead renews two seconds into the hand-back's lease list. The case fails when the hand-back judges only at the clock read before the list. CONTRACT.md now states both reads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Session note (agent, not an owner decision). Head 57b3e27 covers the last code change (a46a5a1..32c4ce3: a hand-back lease counts live at the clock read before the list or at one after it), which had no test and no independent read.
Hold: |
…very rule holding The model follows the hand-back's clock read before each lease list and the outranked release that supersedes its own lease and hands back only after a supersede succeeded (#16515), and renew's back-off on a failed PATCH near expiry (#16509). Line citations are at a548b3a. Both shipped cfgs hold every rule; the known results list the breaks left under each failure flag. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Refs: #16505
Refs: #16458
Summary
A TLA+ model check of the work-item tracker's GitHub claim protocol found two approved rules failing in the GitHub adapter:
wit_hand_back_assigneelisted the leases, and_wit_login_holds_otherread the clock only after that list. If a same-login session renewed its lease after the list and the old expiry then passed, the stale listed body looked expired and the login was removed.releaseof a live lease that an earlier live lease outranks exited7with nothing written, so the caller's live lease and its login stayed until the TTL.Fix
adapters/github/common.sh:wit_hand_back_assigneelists through_wit_list_at_clock, which reads the clock just before each list attempt (retries included) and hands that reading to_wit_login_holds_otheras a fourth argument; the helper no longer reads the clock. A renew only moves an expiry later, so judging the listed body at a clock read taken before the list never makes a renewing holder look expired. A lease that expires during the list still counts as live, and its login then stays for reclaim. The only callers of_wit_login_holds_otherare inwit_hand_back_assignee.adapters/github/release.sh: the "outranked by the earlier live lease" refusal now backs off asrenew-lease's back-off does since fix(work-items): back off on a failed renew PATCH near expiry and hand back only after a supersede #16509: it tries to supersede its own lease twice and runs the hand-back only after one try succeeded. When both fail, the lease may still be live, so the assignee is kept and the message says so. It exits7either way. The hand-back alone would not be enough: with two sessions of one login, each hand-back would see the other's live lease and keep the login forever.CONTRACT.md"Lease protocol": the Release section says what an outranked refusal writes now, and claim step 4's hand-back says when the clock is read and what that guarantees..changes/work-items/.The Linear seed has no
releasescript, so no other adapter carries this refusal.Verification
adapters/github/lease-coordination.test.sh, with new cases:7, supersedes its own lease, leaves the earlier lease live, removes the login;7, supersedes its own lease, keeps the login;7, tries the supersede twice, keeps the login, never removes it, and says the assignee is kept;The existing outranked-release case now asserts the supersede of its own lease and no write to the earlier lease.
Run against
origin/main's adapter code, the first round's new cases fail 5 assertions (4 new ones plus the updated existing one). This branch passes all 300. Moving the clock read after the re-list fails only the re-list case, and moving it after the confirm list fails only the confirm-list case.shellcheck --rcfile .shellcheckrcis clean on the three changed shell files.Not in this change
The lane steps in
pr-run-activity-write.ymlandpr-run-activity-read.ymlprint "it expires at its TTL" on any non-zeroreleaseexit. For an outranked release that is now inaccurate, since the lease is superseded. Only the message is wrong; the behavior is unchanged.Related
wit_try_supersede_lease_commentto return 1 on failure)🤖 Generated with Claude Code