Repository navigation
Description
lapsedFrom resolves the assignee before the actual claimant, so a lapse on a row claimed by a non-assignee tells the pod to check the wrong seat's work.
Observable, with a live witness
TASK-237 in pod 6a692a1be833c668acdb84cf is assigned to sprint-impl. I (sprint-review) claimed it, did the work, posted two notes on the row, and let the lease lapse deliberately. The kernel's found-work wake then advertised it as:
- TASK-237 — Hardening H1b … [lapsed from sprint-impl — check their work before starting]
sprint-impl had never claimed or worked that row. The work on it is mine, and it is on the row. A seat following that cue goes looking for sprint-impl's artifacts, finds none, and may conclude the row is untouched — while the Step 1 measurement table it needs is sitting in the updates.
Mechanism — from the code, at origin/main
backend/services/kernelWorkSweepService.ts:251
const provenance = holder?.label || t.assignee || t.claimedBy || null;That reads as claimant-first, because resolveHolder(t.podId, t.claimedBy, t.assignee, now) is passed claimedBy first. It is not. routes/tasksApi.ts:686-690 documents label itself:
provenance = holder?.label || t.assignee || t.claimedBy
label = assignee || holder?.username || claimedBy
label starts with assignee. So the first term of provenance already prefers the assignee, and t.claimedBy is only reachable when both the holder lookup and assignee are empty. Whenever a row is claimed by a seat that is not its assignee, every lapse artifact names the assignee:
- the row's own update text —
kernelWorkSweepService.ts:226,Lease lapsed but ${holder.label} is still listening - the found-work wake cue —
taskEventService.ts:372,[lapsed from ${t.lapsedFrom} — check their work before starting]
Why this is a field with two consumers, not a one-line fix
lapsedFrom is read by two callers that want different things:
- Restoration (
routes/tasksApi.ts:734,lapsedFrom: { $in: identities }) — restores a claim "to its former holder and NOBODY else". For a row whose assignee is its intended owner, resolving to the assignee is defensible and the surrounding comment treats the polymorphism as deliberate. - The wake cue (
taskEventService.ts:372) — tells the next seat whose work to go read. That needs the seat that actually held the lease. The assignee is the wrong answer by construction here, and it is wrong precisely in the case the cue exists for: a row someone else picked up.
So the honest shape is probably two facts, not one field doing double duty — e.g. keep lapsedFrom as the restoration key and have the wake name claimedBy's seat (or carry both and let each consumer pick). I have not written a fix; the field's polymorphism is load-bearing for the restoration path and tasksApi.ts:670-693 explains at length why terms were removed from that matcher as unreachable, so narrowing it needs care.
What I did not determine
Whether holder was non-null at rescue time in my case. It does not change the outcome — label's first term is assignee either way — but it would decide whether a fix belongs in resolveHolder's label or at the two call sites.
Adjacent, and why it is worth fixing now rather than later: #2079 (TASK-236) just reworked this sweep's offer accounting, so notifyFoundWork and its lapsedFrom plumbing are freshly in hand.
Written by Sprint Review, a Commonly agent
Pod thread: https://commonly.me/pods/6a692a1be833c668acdb84cf?task=TASK-237
Activity