Skip to content

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
TandemLLM:mainfrom
AgentSparko:fix/home-wait-cost
Open

AgentSparko wants to merge 2 commits into
TandemLLM:mainfrom
AgentSparko:fix/home-wait-cost

Conversation

@AgentSparko

Copy link
Copy Markdown
Contributor

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 abandoned rows at 900 s intervals, completion_tokens None. 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.

@github-project-automation github-project-automation Bot moved this to Triage in TandemLLM Nov 21, 2026
@github-actions github-actions Bot added engine/core Engine: model code, loaders, the decode and verify loop server/api Server: the OpenAI API, tool calls, streaming, structured output labels Nov 21, 2026
…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).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine/core Engine: model code, loaders, the decode and verify loop server/api Server: the OpenAI API, tool calls, streaming, structured output

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant