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): a finished subscription run is recorded failed by its notional dollar budget #20266
A heartbeat agent on a subscription login can have a run recorded as failed by its dollar budget, after the work has already run.
Evidence
Host log, 2026-10-31 16:45 Riga time, Gate 3 re-test: BudgetExhausted: spent=10.046427 limit=10.000000 raised from _ingest_adapter_usage. The owner raised the limit by hand, so it will recur.
From the code on main:
autobot-backend/llc/scheduler/heartbeat_scheduler.py:942 calls _ingest_adapter_usage after the adapter run has finished.
heartbeat_scheduler.py:947-965 converts tokens to a cost event with no check of the adapter's billing mode, and re-raises BudgetExhausted so the run is recorded FAILED.
So finished work is reported as failed, and the limit does not prevent the spend it is charged for.
Not known
Earlier re-test notes say these dollars are notional on a subscription login; this has not been verified. Whether the 16:45 run's own output was otherwise usable has not been read. That run reported $0.35 for a no-op resume (see #20247).
Decision needed
What a dollar budget means on a subscription login. Recommendation: record usage as tokens, do not fail a finished run on notional dollars, and let SubscriptionQuotaExhausted remain the real limit. An enforced budget should stop the next run, which is #19240.
Acceptance criteria
A finished run on a subscription login is not recorded FAILED because of notional dollar cost.
Usage from those runs is still recorded and visible.
A test covers both subscription and API-billed adapters.
Maintainer decision (2026-11-01): on a subscription login, record usage as tokens and never mark a finished run failed over dollars. SubscriptionQuotaExhausted stays the real limit, an enforced budget stops the next run (#19240), and API-billed runs do not change. Implementation follows in a PR linked here.
Maintainer decision (2026-11-01), option B: subscription runs record tokens and do not count against a dollar limit. Only a token limit or SubscriptionQuotaExhausted can stop them. This supersedes the earlier note that notional dollars still accrue. It goes in the same PR, #20222.
Closure evidence for #20266 (landed via #20222, merge d6899a3, ancestor of main). Gate 2: pipeline-scripts/check-issue-close-refs.sh 20266 -> clear.
AC (verbatim)
Evidence on main
Test
A finished run on a subscription login is not recorded FAILED because of notional dollar cost.
autobot-backend/llc/adapters/claude_result_failure.py:run_billing reads apiKeySource from the init event; autobot-backend/llc/scheduler/usage_billing.py:ingest_run_cost calls ingest_cost_event(..., bill_dollars=not subscription) and swallows BudgetExhausted for subscription runs; autobot-backend/llc/services/budget.py:ingest_cost_event records cost 0 when bill_dollars=False
Also covered: a token limit still stops the next run (test_token_limited_subscription_budget_still_stops_the_next_run). Not part of these ACs: native AutoBot-agent runs are not charged to a budget at all, tracked in #20883.
Note: the issue auto-closed at merge with its boxes unticked; they are ticked now against the evidence above.
Activity
mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-01): on a subscription login, record usage as tokens and never mark a finished run failed over dollars.
SubscriptionQuotaExhaustedstays the real limit, an enforced budget stops the next run (#19240), and API-billed runs do not change. Implementation follows in a PR linked here.mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-01), option B: subscription runs record tokens and do not count against a dollar limit. Only a token limit or
SubscriptionQuotaExhaustedcan stop them. This supersedes the earlier note that notional dollars still accrue. It goes in the same PR, #20222.fix(company-os): record subscription-login usage as tokens, never fai…
fix(company-os): subscription runs do not count against a dollar limit (
mrveiss commentedon Nov 6, 2026
Closure evidence for #20266 (landed via #20222, merge d6899a3, ancestor of main). Gate 2:
pipeline-scripts/check-issue-close-refs.sh 20266-> clear.autobot-backend/llc/adapters/claude_result_failure.py:run_billingreadsapiKeySourcefrom the init event;autobot-backend/llc/scheduler/usage_billing.py:ingest_run_costcallsingest_cost_event(..., bill_dollars=not subscription)and swallowsBudgetExhaustedfor subscription runs;autobot-backend/llc/services/budget.py:ingest_cost_eventrecords cost 0 whenbill_dollars=Falseautobot-backend/llc/tests/test_subscription_usage_20266.py::test_finished_subscription_run_over_token_limit_is_recorded_not_failed;autobot-backend/llc/tests/test_subscription_dollar_budget_20266.py::test_subscription_run_adds_no_dollars_keeps_tokens_and_does_not_block_nextingest_cost_eventpath keeps tokens (tokens_in/tokens_out) with dollars at 0test_subscription_dollar_budget_20266.py::test_subscription_run_adds_no_dollars_keeps_tokens_and_does_not_block_next;test_subscription_usage_20266.py::test_subscription_run_under_budget_records_normallytest_subscription_usage_20266.py::test_finished_api_run_over_budget_still_raises_budget_exhausted,test_subscription_dollar_budget_20266.py::test_api_run_over_dollar_limit_still_raises_and_blocks_next; subscription/API billing detection:autobot-backend/llc/adapters/tests/test_claude_billing_20266.py::test_login_without_api_key_reports_subscription,::test_api_key_reports_apiAlso covered: a token limit still stops the next run (
test_token_limited_subscription_budget_still_stops_the_next_run). Not part of these ACs: native AutoBot-agent runs are not charged to a budget at all, tracked in #20883.Note: the issue auto-closed at merge with its boxes unticked; they are ticked now against the evidence above.
github-actions commentedon Nov 6, 2026
Landed in #20222, merge
d6899a3cb3github-actions commentedon Nov 6, 2026
Landed via the merge train (#20896, merge
4a0f0e62df) via #20222