Mirrors upstream #4716. ManageLeaseOnUpdate armed a 5-minute lease
whenever a generic update left an issue in_progress+assigned, so a plain
interactive claim (bd update -s in_progress -a <who>) silently entered
the heartbeat/reclaim protocol nobody was running for it. The lease
lapsed, bd reclaim reverted the bead out from under its owner, a
supervisor restore re-armed the lease, and the churn self-sustained —
until a headless fleet worker legitimately claimed a bead whose owner
was mid-implementation (observed live on the wyvern constellation).
Leases now arm ONLY via the lease-aware verbs (claim/heartbeat).
ManageLeaseOnUpdate is clear-only:
- leaving the claimed state (not in_progress, or unassigned) clears the
lease, as before;
- changing who holds the claim (assignee transfer, or a fresh
transition into in_progress) clears the previous owner's lease so it
cannot count down against the new holder — the new holder gets a
lease only by claiming or heartbeating through the lease-aware verbs;
- a same-claim edit (already in_progress, same assignee) leaves the
lease columns untouched, so a worker's live lease survives unrelated
edits to its issue.
A real worker restored by a supervisor self-heals: its next heartbeat
re-arms the lease. Interactive hand-dole claims stay durable until the
actor releases them or a human reclaims.
Flips TestUpdateIssueMaintainsLeaseOwnership (which pinned the old
transfer-stamps-fresh-lease behavior), adds the bd-9hpgf regression
guard TestBareUpdateClaimDoesNotArmLease plus
TestUpdatePreservesLeaseOnSameClaim, and a pure unit table-test for the
clear-only contract.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5mtSXJuNGs4tmeKDbwNif