Repository navigation
The home wait is cost-aware: a conversation too big to re-read waits at home instead of hopping - #180
Open
AgentSparko wants to merge 2 commits into
Open
AgentSparko wants to merge 2 commits into
AgentSparko wants to merge 2 commits into
Conversation
…at home instead of hopping SIDE_HOME_WAIT_S (10 s) was sized for SRV-528's 45k conversation (re-read measured 80.9 s). On 2026-11-21 a 133,075-token conversation hopped on that same budget: the re-read of 133k rows on a slot holding nothing of it never finished inside the client's 900 s (seven abandoned rows at 900 s intervals), each retry hopped again, and every hop charged another conversation's rows to be re-read too. The wait at home costs only the first token; a hop costs the whole prompt, and only a request that stayed on its slot can resume the rows prefilled before a client left (_prefill_watch). _home_wait_budget_s scales the home budget with the estimated re-read cost (rows / HOP_READ_TOK_S, clamped to [SIDE_HOME_WAIT_S, HOME_WAIT_MAX_S]); knobs registered, the queued line and the [parallel] numbers carry the budget. tests/test_home_wait_cost.py 5/5; test_slot_affinity.py 12/12 unchanged (its hop replays a 2k prompt, which keeps the 10 s floor).
AgentSparko
force-pushed
the
fix/home-wait-cost
branch
from
November 21, 2026 10:27
4847939 to
7a8fb41
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The home-slot wait is cost-aware.
SIDE_HOME_WAIT_S(10 s) was sized for SRV-528's 45k conversation, whose re-read measured 80.9 s — hopping after 10 s then cost about what a longer wait would. For a 133k conversation the same 10 s budget is ruinous.The incident (2026-11-21 02:58-04:28, flashnext 3.05 on a 121 GiB box): an agent conversation of 133,075 tokens lived on side slot 5. Its next turn found the home slot busy for more than 10 s, hopped, and re-read 133k rows on a slot holding nothing of it. Under the load of the other resident streams the re-read never finished inside the client's 900 s — the ledger holds seven
abandonedrows at 900 s intervals,completion_tokensNone. Each retry hopped again (its predecessor's rows still held the old home), and every hop charged another conversation's rows to be re-read too. The spiral only ended when the session gave up.Waiting at home costs only the first token; a hop costs the whole prompt. And rows prefilled before a client left stay good for its retry (
_prefill_watch) — but only a request that stayed on its own slot can resume them.The change
_home_wait_budget_s(need)scales the home budget with the estimated re-read cost:need / HOP_READ_TOK_S(a conservative loaded rate), clamped to[SIDE_HOME_WAIT_S, HOME_WAIT_MAX_S]. A small chat keeps the old 10 s floor; SRV-528's 45k conversation now waits 92 s — long enough to cover its own measured 80.9 s re-read; a 133k conversation waits 266 s at home before a hop is even considered. Knobs registered (HOP_READ_TOK_S,HOME_WAIT_MAX_S); the queued line and the[parallel]numbers carry the budget (home_budget_s).Tests
tests/test_home_wait_cost.py— 5/5: floor unchanged for small prompts, 45k covers its measured re-read, 133k waits minutes, cap holds, budget grows with the prompt.tests/test_slot_affinity.py— 12/12 unchanged: its hop replays a 2k prompt, which keeps the 10 s floor.