Router: "money left" is the pool's allowance when a pool takes the worker's route #175

Closed
opened 2026-10-19 01:10:52 +00:00 by teahubxyz · 0 comments
Owner

Follows #168 and #82 (#174). router_tick gives router.pick TIME_DAILY_USD minus today's spend as the day's money left. Since #174, Claude calls answer to the anthropic-credits pool in time/pools.json (about $8/day while the credit lasts), not to the daily cap. So in live mode the router would queue cards against money the worker can't spend.

Changes (astra.py):

  • Money left: the pool that takes the worker's route (TIME_WORKER's provider, as budget_check sees it) gives allowance(pool) - pool_spent(pool). Without a pool, it stays TIME_DAILY_USD - today. Either way it is capped by what's left of the monthly cap.
  • Header: the router's log line shows the pool, as Astra's old-path line already does since #174.
  • Tests: with an expiring pool allowing $3 and $1 already spent, pick gets $2. Without a pool, the old figure. With the month nearly spent, the monthly cap's remainder.

DONE: PR open with the code above, python3 .github/time/test_time.py green including the new checks, CI green

Follows #168 and #82 (#174). `router_tick` gives `router.pick` `TIME_DAILY_USD` minus today's spend as the day's money left. Since #174, Claude calls answer to the `anthropic-credits` pool in `time/pools.json` (about $8/day while the credit lasts), not to the daily cap. So in live mode the router would queue cards against money the worker can't spend. Changes (`astra.py`): - **Money left:** the pool that takes the worker's route (`TIME_WORKER`'s provider, as `budget_check` sees it) gives `allowance(pool) - pool_spent(pool)`. Without a pool, it stays `TIME_DAILY_USD - today`. Either way it is capped by what's left of the monthly cap. - **Header:** the router's log line shows the pool, as Astra's old-path line already does since #174. - **Tests:** with an expiring pool allowing $3 and $1 already spent, `pick` gets $2. Without a pool, the old figure. With the month nearly spent, the monthly cap's remainder. DONE: PR open with the code above, `python3 .github/time/test_time.py` green including the new checks, CI green
teahubxyz referenced this issue from a commit 2026-10-19 13:48:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: teahubxyz/time#175