You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(company-os): LLCHeartbeatRun.work_item_id is never written, so run cancel and the liveness monitor never release a checkout #19601
LLCHeartbeatRun.work_item_id (autobot-backend/llc/models/heartbeat_run.py:54) is never written by non-test code. The evidence:
None of the three constructors sets it: heartbeat_scheduler.py:534, comment_wake_service.py:130 and replay_service.py:215.
None of the four update(LLCHeartbeatRun) calls in heartbeat_scheduler.py (:328, :618, :666, :702) sets it.
A grep for .work_item_id = across llc/ finds no run assignment.
Two release paths depend on that column, so neither one ever fires:
Run cancel, autobot-backend/llc/api/runs.py:169-176: if run.work_item_id: drops llc:checkout:{work_item_id}.
Liveness monitor, autobot-backend/llc/scheduler/liveness_monitor.py:139-146: releases the Redis checkout lock and blocks the work item, both only if run.work_item_id.
Both paths also drop only the Redis fence. They never clear the DB checkout (checkout_run_id / checkout_locked_at), and the DB checkout is what work_item_queue.eligible_for (:118) actually reads. Wired up as they are, they would still leave the item unclaimable.
The stalled-run sweep (#16817) avoids the column. It releases by LLCWorkItem.checkout_run_id == run.id, which is the run's own key. That key is the model the other two paths could reuse.
Acceptance criteria
Choose one of these, recording the reason: either write work_item_id when a run checks out an item, or have cancel and the liveness monitor release by checkout_run_id the way the stalled-run sweep does. One release rule for a run's checkouts, not three.
Cancelling a run, and the liveness monitor recovering one, clears the DB checkout as well as the Redis fence, with an activity-log entry carrying a reason distinct from stalled.
Tests drive both paths. After a run cancel the item is claimable; after a liveness release the checkout and fence are cleared and the item is BLOCKED with a reason (reworded per owner decision 2026-11-21).
changed the title [-]bug(llc): LLCHeartbeatRun.work_item_id is never written, so run cancel and the liveness monitor never release a checkout[/-][+]bug(company-os): LLCHeartbeatRun.work_item_id is never written, so run cancel and the liveness monitor never release a checkout[/+]on Oct 30, 2026
PR keyword: Refs, so this issue stays open. Evidence from origin/main.
Criterion
Evidence
Ticked
One release rule, reason recorded
autobot-backend/llc/services/run_checkouts.py:6-12 (release keyed on checkout_run_id only; work_item_id deliberately not read), :117release_checkouts_for_run; callers api/runs.py:186, scheduler/liveness_monitor.py:163, scheduler/stalled_run_sweep.py:186
yes
Cancel and liveness recovery clear the DB checkout and the Redis fence, with a reason distinct from stalled
DB: run_checkouts.py:106-107 (checkout_run_id = None, checkout_locked_at = None); fence: api/runs.py:189 and liveness_monitor.py:105drop_released_fences; reasons cancelled (runs.py:131) and liveness_timeout (liveness_monitor.py:55)
yes
Tests drive both paths and assert the item is claimable afterwards
cancel: autobot-backend/llc/tests/test_run_checkout_release_19601.py:182 asserts READY and offered again (:227). Liveness: test_liveness_monitor.py:315-327 asserts the checkout is cleared and the reason, but the monitor parks the item as BLOCKED (liveness_monitor.py:59), so it is not claimable afterwards
no: the liveness path is not asserted claimable, and by design it is not
Remaining
Owner questions in the PR body: cancel then re-offer vs park; the "claimable" wording for the liveness/stall paths; who may act as a named agent.
AC status verified against main at f98f24e (deployed to the local install), 2026-11-19. Only ACs with code evidence were ticked.
MET: release_checkouts_for_run (llc/services/run_checkouts.py:117-126; callers llc/api/runs.py:187, scheduler/liveness_monitor.py:163). Both paths clear the checkout and fence (test_liveness_monitor.py:315, :322, :327).
Open, needs an OWNER decision: "claimable afterwards" holds on the cancel path (test_run_checkout_release_19601.py:234, :239), but the liveness path parks items as BLOCKED by design (liveness_monitor.py:59; test_liveness_monitor.py:320). Reword the AC, or change the behaviour.
Owner decision, 2026-11-21: keep BLOCKED and reword the AC. A stalled run is suspicious, so a human unblocks its item. The liveness path clears the checkout and the fence and parks the item as BLOCKED with a reason, as built (llc/scheduler/liveness_monitor.py:59). Only the run-cancel path makes the item claimable afterwards. The AC is reworded to match.
AC3 verified against origin/main and ticked; all three ACs are now met.
Cancel path is claimable:llc/tests/test_run_checkout_release_19601.py:227test_a_cancelled_runs_unfinished_item_goes_back_to_ready_with_its_assignee_and_is_offered_again. The item goes back to READY with its assignee, and checkout_next offers it again.
Liveness path:llc/tests/test_liveness_monitor.py:283test_recovery_releases_every_checkout_the_run_made_and_their_fences. It asserts that the checkout is cleared (:314), that in-progress items are parked BLOCKED (:316), that the fences are dropped (:322), and that the activity reason is liveness_timeout (:327).
Activity
[-]bug(llc): LLCHeartbeatRun.work_item_id is never written, so run cancel and the liveness monitor never release a checkout[/-][+]bug(company-os): LLCHeartbeatRun.work_item_id is never written, so run cancel and the liveness monitor never release a checkout[/+]github-actions commentedon Nov 4, 2026
needs-structure: this issue is missing:Parent: #Nin the body), unless this is an umbrella with sub-issuesThe label clears on the next issue event once all three are present (#19522).
fix(company-os): startup run recovery runs under a leader lease (#19601)
fix(company-os): a released unfinished item returns to ready, the liv…
test(company-os): the live-run lookup test uses the shared fake sessi…
fix(company-os): startup recovery takes only runs older than the live…
fix(company-os): the undo of a checkout clears its intent; the detect…
test(company-os): the shared routed session applies a run query's age…
fix(company-os): startup recovery takes every running run again, unde…
4 remaining items
fix(company-os): the recovery-lease retry variables are registered an…
test(company-os): a foreign organisational unit's checkout is untouch…
chore(ci): run the suite on the head synced with main (#19601)
fix(company-os): tests of the changed actor contract authenticate as …
fix(company-os): an attachment upload resolves its actor before the b…
fix(company-os): recovery re-queues agents after the commit; the dete…
fix(company-os): the label route tests present a company member, not …
github-actions commentedon Nov 13, 2026
Landed via the merge train (#21475, merge
1ccdc9655d) via #21446mrveiss commentedon Nov 13, 2026
Landed in #21446 (merge 1ccdc96)
PR keyword:
Refs, so this issue stays open. Evidence fromorigin/main.autobot-backend/llc/services/run_checkouts.py:6-12(release keyed oncheckout_run_idonly;work_item_iddeliberately not read),:117release_checkouts_for_run; callersapi/runs.py:186,scheduler/liveness_monitor.py:163,scheduler/stalled_run_sweep.py:186stalledrun_checkouts.py:106-107(checkout_run_id = None,checkout_locked_at = None); fence:api/runs.py:189andliveness_monitor.py:105drop_released_fences; reasonscancelled(runs.py:131) andliveness_timeout(liveness_monitor.py:55)autobot-backend/llc/tests/test_run_checkout_release_19601.py:182assertsREADYand offered again (:227). Liveness:test_liveness_monitor.py:315-327asserts the checkout is cleared and the reason, but the monitor parks the item asBLOCKED(liveness_monitor.py:59), so it is not claimable afterwardsRemaining
fix(company-os): release a run's checkouts by the run on cancel, live…
fix(company-os): the run-cancel fence test follows the checkouts a ru…
mrveiss commentedon Nov 19, 2026
AC status verified against
mainat f98f24e (deployed to the local install), 2026-11-19. Only ACs with code evidence were ticked.release_checkouts_for_run(llc/services/run_checkouts.py:117-126; callersllc/api/runs.py:187,scheduler/liveness_monitor.py:163). Both paths clear the checkout and fence (test_liveness_monitor.py:315,:322,:327).test_run_checkout_release_19601.py:234,:239), but the liveness path parks items as BLOCKED by design (liveness_monitor.py:59;test_liveness_monitor.py:320). Reword the AC, or change the behaviour.mrveiss commentedon Nov 21, 2026
Owner decision, 2026-11-21: keep BLOCKED and reword the AC. A stalled run is suspicious, so a human unblocks its item. The liveness path clears the checkout and the fence and parks the item as BLOCKED with a reason, as built (
llc/scheduler/liveness_monitor.py:59). Only the run-cancel path makes the item claimable afterwards. The AC is reworded to match.mrveiss commentedon Nov 21, 2026
AC3 verified against
origin/mainand ticked; all three ACs are now met.llc/tests/test_run_checkout_release_19601.py:227test_a_cancelled_runs_unfinished_item_goes_back_to_ready_with_its_assignee_and_is_offered_again. The item goes back to READY with its assignee, andcheckout_nextoffers it again.llc/tests/test_liveness_monitor.py:283test_recovery_releases_every_checkout_the_run_made_and_their_fences. It asserts that the checkout is cleared (:314), that in-progress items are parked BLOCKED (:316), that the fences are dropped (:322), and that the activity reason isliveness_timeout(:327).