Repository navigation
fix(work-items): release by the claim arbitration rule and hand back the assignee - #16475
Conversation
…the assignee release and renew-lease in the GitHub adapter accept the holder's live lease when it is the earliest live lease (claim step 4, the completed-run rule included), through one shared wit_lease_winner in lib/lease.sh, so a newer lease that has not backed off no longer blocks a finished session's hand-back. release now removes the holder's assignee unless another live lease of that login remains, and re-reads the leases after the removal to restore it; a winning claim restores its own assignee too. A same-login losing claim keeps @me only when the login was assigned before it started, and a default claim that fails after its post supersedes its lease. The attend-queue, triage and work skills rely on release for the assignee. Closes #16472 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20e3a76846
ℹ️ 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".
Lane run report
Failed GitHub API calls
|
|
claude-security-review reviewed Security review (incremental, blocking only): no security findingscritical-findings: 0 I reviewed only what changed since None of the changed files matches a trusted-path glob, and no plugin manifest changed, so the summary has no What I checked in this push:
None of these changes touches the trusted-trigger check, the token scope, the kill switch or a merge hold. Embedded text: the PR context has no instructions aimed at the review. |
|
claude-review reviewed Code review (incremental, blocking only):
|
…roker stub The already-released-lease case now reaches the lease-comment list and the issue read that release's assignee hand-back makes; without stub cases for them the case exited 1 on an unhandled gh call. Refs: #16472 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nding Within WIT_LEASE_SKEW_SECONDS (300 s, now one named constant that wit_lease_is_live also uses) of a lease's expiry, a newer claimant may already have found it expired and started. renew-lease there also requires the newest non-superseded lease, so it never revives a lease that would then outrank a claimant already working. Refs: #16472 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ter each supersede A same-login claim that loses arbitration now re-reads the leases after superseding its own and keeps @me only while another live lease of the login remains, replacing the assigned-before-the-claim check, which left the winner unassigned when two same-login claims both read no assignee. release decides its unassign on a list read after its own PATCH, so a loser that superseded its lease since release's first read no longer keeps the assignee alive with every lease superseded. Each side writes, then reads, so one of the two sees the other and removes an assignee no lease holds. Claim step 2 assigns once more before failing with exit 4 when its own login is missing, since a same-login release can remove it between the assign and the check. The hand-back uses best-effort assignee helpers. The contract records the renew margin, both re-reads, the step 2 retry, and that release also removes a same-login assignment made by hand. Refs: #16472 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sed-release hand-back A renew that lands near expiry under a newer lease, a claim failure path that must keep a same-login holder's assignee, an assign that lands but reports failure, a refused expired release, release's single clock read, and the linear renew of an outranked lease. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a same-login holder's assignee renew-lease re-reads the leases after its PATCH when the clock is within the skew margin of the old expiry; a newer live lease there makes it supersede its own lease and exit 7, and a list it cannot read twice keeps the lease. Every claim back-off and failure path removes the login once, only when no other live lease of that login remains, with the rollback armed before the assign. A release refused under a newer lease hands the assignee back, and release reads the clock once. The Linear renew-lease refuses an outranked lease. The work, triage and attend-queue skills say what a session does on a renew exit 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…new back-off A claim rollback that removes the login re-adds it when a same-login lease has appeared since, a renew that backs off near expiry hands back the holder's assignee unless another live lease of the login remains, and a failed assignee read still removes the login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Session note (agent, not an owner decision): this pull request is owned by the local session |
…ase on a stale list Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wit_hand_back_assignee replaces both earlier helpers. It lists the leases itself after the caller's own lease is dead, keeps the login while another live lease of it holds, removes it otherwise (a failed assignee read removes too), and re-adds it when a same-login lease appears after the removal. The claim rollback, every release path and the renew back-off call it. A renew whose PATCH returns after the old expiry always supersedes its lease and exits 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Session note (agent, not an owner decision), 04:10Z, for the hub: the owning session |
…e-add Each lease list in wit_hand_back_assignee retries once, so a throttled list no longer removes a same-login holder's assignee. After a re-add the hand-back lists once more and removes the login again when the lease that earned the re-add has ended. CONTRACT.md states the three post-PATCH renew cases, which refusal edits the assignee, and when the rollback keeps an assignee for an ambiguous lease post. The triage skill's renew sentence is shortened to stay under the 500-line cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Session note (agent): the hold is lifted at head 191d631. Basis for lifting it:
|
|
Session note (agent), correcting the scope stated in the comment above: with renew modeled, the model check covered two sessions at a time (a local session with the lane; a local session with a same-login session). All three sessions together were checked only without renew; that run with renew was stopped past 100 million states. The last two fix rounds (ac1ebc0, 191d631) were read by the session that specified them and by the two review lanes (0 findings), not by a separate reviewer before the merge; a separate read of 7f524f7..e5af891 is running now, and anything it finds is fixed in a follow-up pull request. |
Closes #16472
Summary
Fixes three defects in the work-item tracker's GitHub adapter lease protocol that the formal-verification claim-protocol model on #16458 found:
releaseandrenew-leaserefused the holder's own live lease while a newer lease that had not yet backed off was on the item, so a finished session's lease kept blocking every later claim until its TTL.@mefor a winner that had finished, which could leave the item assigned with every lease superseded.The second round of commits addresses an independent review of
20e3a76. That review found one path where two claimants both proceed: renew near expiry. It also found two assignee orderings that strand or drop the assignee, plus a broker test stub that went red.The third round closes flaws a TLA+ model of the fixed scripts found: a renew that lands near expiry could still revive a lease over a newer claimant, a failing same-login claim removed the holder's assignee, and a refused release kept the assignee.
Fix
lib/lease.sh:wit_lease_winner, the claim step 4 rule: the earliest live lease holds, and an optional callback treats a completed run's lease as released.claim.sh,release.shandrenew-lease.shall use it. The completed-run check and the best-effort supersede move fromclaim.shintocommon.sh(wit_lease_released_by_run,wit_try_supersede_lease_comment).WIT_LEASE_SKEW_SECONDS(300) names the skewwit_lease_is_livealready accepted.wit_newer_live_lease: a live lease with a higher comment id than the given one.release.sh: a live handle is accepted when it is the winner, and refused (exit 7) when an earlier live lease outranks it. An expired handle keeps its old handling: a no-op, or exit 7 under a newer non-superseded lease. That exit 7 now hands the assignee back first (same message and exit code). The clock is read once, after the lease read, for both the liveness and the winner check.renew-lease.sh:WIT_LEASE_SKEW_SECONDSof expiry, the handle must also be the newest non-superseded lease, as on main.wit_hand_back_assigneeincommon.sh, for the claim rollback, every release path and the renew back-off:claim.sh:wit_hand_back_assigneeonce, through the EXIT trap, after superseding our own lease. The step 2 back-off no longer removes twice.renew-lease.sh: refuses a live lease that an earlier live lease outranks, in claim's order (handle, then comment id).attend-queue,triage,workskills) rely onreleasefor the assignee, and say what a session does on a renew exit 7: stop writing to the item and claim again to continue.CONTRACT.md"Lease protocol", the adapter README and two attend-queue evals are updated to match; the contract also records the renew caveat and the ambiguous lease-POST caveat.scripts/read-lane-broker-check.test.sh: the gh stub answers the lease-comment list and the issue read that release now makes.Why two claimants still cannot both hold
Which claimant holds is decided only by claim step 4: the earliest live lease. A change is safe if it neither makes a lease live nor lets a lease outrank one that already won.
[renew near expiry, newer lease pending],[renew lands near expiry],[renew outranked].GitHub's comment and assignee endpoints have no compare-and-swap. The pairs above assume each read sees writes that completed before it. Whether GitHub's list endpoints are read-after-write consistent is not established. A renew that stalls between its post-PATCH read and its return, and a failed post-PATCH read, stay open.
Verification
adapters/github/lease-coordination.test.sh: 253 pass on head191d631. On the tests-only commit007db62(scripts ofac1ebc0) 3 fail: the re-add that outlived its lease (2) and the rollback whose first list failed once (1).bda5b4d(scripts of7f524f7) 11 fail: the renew back-off hand-back (1), the rollback re-add (2), the hand-back after a failed assignee read (2), the renew landing after expiry (5), and the refused release on a stale list (1).59d1569, before the third round's scripts, 14 assertions failed: the renew landing near expiry (3), the twice-failed re-list (2), the retried re-list showing a newer lease (2), the same-login failure and step 2 conflict keeping alice (2), the double removal (1), the assign that landed (1), the refused release hand-back (1), and the single clock read (2).lib/lease.test.sh: 33 pass; 1 fails on59d1569(wit_newer_live_leasefinds a newer live lease).seeds/linear/renew-lease.test.sh: 32 pass; 3 fail on59d1569(the outranked renew).scripts/read-lane-broker-check.test.sh: 37 pass.20e3a76and main comparisons recorded on this PR's earlier commits still hold.scripts/check-changed-skills.sh origin/mainpasses (the triage skill was at its 500-line cap onac1ebc0).Not in this change
Related
🤖 Generated with Claude Code