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
test(company-os-e2e): step 6 budget exhaustion races an unseen spend (spent jumps between read and ingest) #20830
autobot-backend/tests/company_os_e2e/test_e2e_04_budget_and_pause.py::test_step_6_exhausted_budget_is_not_dispatched failed once on a merge-train PR and passed on a re-run of the same job at the same head, with no budget code in the train.
POST /budget/<agent>/ingest -> 402 {"detail":"Agent <agent> budget exhausted: spent=2400.000000 limit=1400.000000"}
_exhaust reads tokens_spent (400 here), sets token_limit = spent + 1000, then ingests the reported remainder (1000). The refusal shows 2000 tokens spent beyond the read value, so something wrote spend between the read and the ingest. quiesce() runs before _exhaust, so either a run it did not see was still spending, or the ingest path counts one event twice. Which one is not known.
Acceptance criteria
The cause is named with evidence (the writer of the extra 1000 tokens).
Step 6 does not race: the limit is set and the remainder ingested against a spend nothing else writes meanwhile, or the extra writer is a defect and is fixed.
Sighting: merge-train pull request #21475, head 2bef393, run 43396041148 — test_step_6_exhausted_budget_is_not_dispatched failed in its precondition (_exhaust): POST /budget/<agent>/ingest -> 402 budget exhausted: spent=2400 limit=1400, i.e. the spend moved by about 1000 between the read and the ingest although the agent had been paused and quiesced first. The same workflow passed on main at 0f14a1b and 81c4e35 the same morning. The failed job was re-run once; the result of the re-run will be added here. Note for whoever fixes this: the train carries #21446, which changes how a cancelled or recovered run releases its work (items return to ready and are re-offered to the same agent) — if the re-run fails again, check whether that makes a paused agent's in-flight run spend later than quiesce expects.
Follow-up to the sighting above: the re-run of the same job on the same head (2bef393, attempt 2) passed. One more intermittent occurrence of this race; no change in the code between the two attempts.
The cause is named with evidence (writer of the extra 1000 tokens)
The read-then-ingest double charge is explained (an ingest answered before its commit was visible, so the next read and ingest charged twice) and removed by #21332's commit-before-answer in llc/api/budget.py:315. The separate sighting spent=1410 limit=1400 (about 10 tokens over) is NOT explained.
no
Step 6 does not race, or the extra writer is fixed
test_e2e_04_budget_and_pause.py:43_exhaust is one ingest of the remainder; cannot be shown from code that the race is gone, only watched across CI runs
no
Remaining
Explain the spent=1410 limit=1400 sighting (about 10 tokens over).
Watch test_step_6_exhausted_budget_is_not_dispatched on the next trains before ticking the second criterion.
Activity
github-actions commentedon Nov 4, 2026
needs-structure: this issue is missing:phase:M2.<k>label matching milestoneM2 - Company OS workflow-ready: found noneParent: #Nin the body), unless this is an umbrella with sub-issuesThe label clears on the next issue event once all three are present (#19522).
github-actions commentedon Nov 8, 2026
Landed in #21209, merge
6b6e405eb3mrveiss commentedon Nov 13, 2026
Sighting: merge-train pull request #21475, head 2bef393, run 43396041148 —
test_step_6_exhausted_budget_is_not_dispatchedfailed in its precondition (_exhaust):POST /budget/<agent>/ingest -> 402 budget exhausted: spent=2400 limit=1400, i.e. the spend moved by about 1000 between the read and the ingest although the agent had been paused and quiesced first. The same workflow passed on main at 0f14a1b and 81c4e35 the same morning. The failed job was re-run once; the result of the re-run will be added here. Note for whoever fixes this: the train carries #21446, which changes how a cancelled or recovered run releases its work (items return to ready and are re-offered to the same agent) — if the re-run fails again, check whether that makes a paused agent's in-flight run spend later thanquiesceexpects.mrveiss commentedon Nov 13, 2026
Follow-up to the sighting above: the re-run of the same job on the same head (2bef393, attempt 2) passed. One more intermittent occurrence of this race; no change in the code between the two attempts.
github-actions commentedon Nov 13, 2026
Landed via the merge train (#21479, merge
45f3000b9d) via #21477mrveiss commentedon Nov 13, 2026
Landed in #21477 (merge 45f3000)
llc/api/budget.py:315. The separate sightingspent=1410 limit=1400(about 10 tokens over) is NOT explained.test_e2e_04_budget_and_pause.py:43_exhaustis one ingest of the remainder; cannot be shown from code that the race is gone, only watched across CI runsRemaining
spent=1410 limit=1400sighting (about 10 tokens over).test_step_6_exhausted_budget_is_not_dispatchedon the next trains before ticking the second criterion.Refs).