tt: fix offloading-connector store-job assert that killed TT prod (#393) #394

Merged
orchestra merged 1 commit from codex/inc393-offload-assert into master 2026-11-12 11:07:04 +01:00
Member

A request aborted during chunked prefill can kill TT EngineCore while the host-tier connector builds store jobs. The fix caps finished-request offloads at computed tokens and skips/logs/counts any remaining malformed request store attempt before reserving host slots.

Root cause and evidence

The image recipe pins TT plugin bef89e429e202caa38d3e3c8a24da4e8cc02405a, whose installer selects vLLM 0.26.0. Fetched the exact offloading scheduler from tag commit 568afb3a13806beb53bb2e6bd518269357b237c0; its line 975 matches the reported assertion.

vLLM collects hashes for the entire prompt but allocates device blocks only for admitted chunks. On finish (including abort), _build_store_jobs uses req.num_tokens as if the entire prompt had been computed. For a 6,144-token prompt aborted after one 2,048-token chunk, the remaining key slice contains two entries and the block slice contains zero. offload_prompt_only caps at the full prompt, so it does not prevent the mismatch.

This mechanism is reproduced with the actual pinned upstream scheduler/connector definitions. The specific production trigger remains a hypothesis: the brief contains no offending request-state dump, and the supplied crash.log is empty. The report distinguishes the reproduced defect from an unconfirmed abort/disconnect attribution and provides file:line evidence for the full chain.

Change

  • TT connector instance-local finished-request bound; active requests retain scheduled-step write-through.
  • Default-on guard checks all groups before allocating any host slots. A mismatch skips only that request's store attempt, preserves healthy requests and pending load/store/flush jobs, and logs request ID/status/counts/range without prompt data.
  • Counter vllm:kv_offload_store_skipped_mismatch_total, with its metric definition registered by the TT spec.
  • QWEN36_KV_HOST_TIER_STORE_GUARD=0 retains upstream assertions for tests; the cause fix stays enabled.
  • Incident timeline and recommended nixos-llm recovery follow-up: unit exited zero, Restart=on-failure did not trigger, watchdog skipped the inactive unit, RTX-only for roughly four hours. No infra changes implemented.

CPU validation

Before, with the plugin from base 08cacdbe95b6b47427c192f0026659ae809048cb:

INC393_KV_SOURCE=../inc393/kv_host_tier.before.py python3 -m unittest \
  tests.test_inc393_offload.TestOffloadStore.test_partial_abort_no_uncomputed_store -v
assert len(offload_keys) == len(offload_block_ids)
AssertionError
Ran 1 test
FAILED (failures=1)

After:

OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 MKL_NUM_THREADS=4 \
  python3 -m unittest tests.test_inc393_offload tests.test_kv_host_tier -v
Ran 31 tests in 0.013s
OK (skipped=3)

All 12 new tests pass; 28 total pass and three existing staging-ring tests skip because torch is absent. Includes the unpatched negative control, admission/preemption aborts, prefix hits, 2048/256-token hash sizes, resumed block replacement, prompt-only decode, default guard/strict mode, stats export/reset, pending transfers and block-reuse flushing.

vLLM and torch are not installed on this host. The minimal fixture executes unchanged upstream scheduler, connector, offload state and stats definitions; request/config/backend/device dependencies are stubbed. All 49 retained functions/methods were AST-compared with the downloaded pinned source. No installs or devices are needed.

check-cited-records.py: OK. check-gate-parity.py --all: OK with 16 stale-record warnings, not card certification. No commit-hook failure occurred. CPU evidence is committed in bench/runs/inc393-offload-cpu-20261110.jsonl; no new PP or TG speed number.

Unverified and shipping

No card, full installed-vLLM/TTScheduler integration, model correctness, sustained P/D soak or performance validation was run. No image was built or shipped and no production/cluster host was accessed. The change is in an already-mounted Python file; owner-controlled shipping must carry the new overlay (or bake it into a future image), restart, verify banners/metric registration, and re-gate the 52-GiB configuration on cards with cancellation/resume, healthy concurrent requests, prefix reuse and a soak. Existing card gates were not restamped.

Incident report: docs/incidents/2026-11-09-tt-offload-assert.md.

Impl-Model: openai/gpt-6-astra

A request aborted during chunked prefill can kill TT EngineCore while the host-tier connector builds store jobs. The fix caps finished-request offloads at computed tokens and skips/logs/counts any remaining malformed request store attempt before reserving host slots. ## Root cause and evidence The image recipe pins TT plugin `bef89e429e202caa38d3e3c8a24da4e8cc02405a`, whose installer selects vLLM 0.26.0. Fetched the exact offloading scheduler from tag commit `568afb3a13806beb53bb2e6bd518269357b237c0`; its line 975 matches the reported assertion. vLLM collects hashes for the entire prompt but allocates device blocks only for admitted chunks. On finish (including abort), `_build_store_jobs` uses `req.num_tokens` as if the entire prompt had been computed. For a 6,144-token prompt aborted after one 2,048-token chunk, the remaining key slice contains two entries and the block slice contains zero. `offload_prompt_only` caps at the full prompt, so it does not prevent the mismatch. This mechanism is reproduced with the actual pinned upstream scheduler/connector definitions. **The specific production trigger remains a hypothesis:** the brief contains no offending request-state dump, and the supplied crash.log is empty. The report distinguishes the reproduced defect from an unconfirmed abort/disconnect attribution and provides file:line evidence for the full chain. ## Change - TT connector instance-local finished-request bound; active requests retain scheduled-step write-through. - Default-on guard checks all groups before allocating any host slots. A mismatch skips only that request's store attempt, preserves healthy requests and pending load/store/flush jobs, and logs request ID/status/counts/range without prompt data. - Counter `vllm:kv_offload_store_skipped_mismatch_total`, with its metric definition registered by the TT spec. - `QWEN36_KV_HOST_TIER_STORE_GUARD=0` retains upstream assertions for tests; the cause fix stays enabled. - Incident timeline and recommended nixos-llm recovery follow-up: unit exited zero, Restart=on-failure did not trigger, watchdog skipped the inactive unit, RTX-only for roughly four hours. No infra changes implemented. ## CPU validation Before, with the plugin from base `08cacdbe95b6b47427c192f0026659ae809048cb`: ```text INC393_KV_SOURCE=../inc393/kv_host_tier.before.py python3 -m unittest \ tests.test_inc393_offload.TestOffloadStore.test_partial_abort_no_uncomputed_store -v assert len(offload_keys) == len(offload_block_ids) AssertionError Ran 1 test FAILED (failures=1) ``` After: ```text OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 MKL_NUM_THREADS=4 \ python3 -m unittest tests.test_inc393_offload tests.test_kv_host_tier -v Ran 31 tests in 0.013s OK (skipped=3) ``` All 12 new tests pass; 28 total pass and three existing staging-ring tests skip because torch is absent. Includes the unpatched negative control, admission/preemption aborts, prefix hits, 2048/256-token hash sizes, resumed block replacement, prompt-only decode, default guard/strict mode, stats export/reset, pending transfers and block-reuse flushing. vLLM and torch are not installed on this host. The minimal fixture executes unchanged upstream scheduler, connector, offload state and stats definitions; request/config/backend/device dependencies are stubbed. All 49 retained functions/methods were AST-compared with the downloaded pinned source. No installs or devices are needed. `check-cited-records.py`: OK. `check-gate-parity.py --all`: OK with 16 stale-record warnings, not card certification. No commit-hook failure occurred. CPU evidence is committed in `bench/runs/inc393-offload-cpu-20261110.jsonl`; no new PP or TG speed number. ## Unverified and shipping No card, full installed-vLLM/TTScheduler integration, model correctness, sustained P/D soak or performance validation was run. No image was built or shipped and no production/cluster host was accessed. The change is in an already-mounted Python file; owner-controlled shipping must carry the new overlay (or bake it into a future image), restart, verify banners/metric registration, and re-gate the 52-GiB configuration on cards with cancellation/resume, healthy concurrent requests, prefix reuse and a soak. Existing card gates were not restamped. Incident report: `docs/incidents/2026-11-09-tt-offload-assert.md`. Impl-Model: openai/gpt-6-astra
tt: bound finished offloads to computed tokens after partial prefill aborts
Some checks are pending
tt-stack-ci / Report upstream drift (pull_request) Successful in 6m9s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 14m57s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 8m29s
tt-stack-ci / Serialized card gate (pull_request) Successful in 6m28s
cards-fresh cards: no verdict yet fp=61896aba648c70ac
f671839e2e
Finished requests were treated as fully computed by vLLM's offload store
builder. A partial-prefill abort leaves prompt hashes beyond the allocated
block table and reproduces the production AssertionError on CPU.

Cap finished stores at computed tokens and validate each request before
host allocation, preserving pending jobs while logging and counting skips.
Keep upstream assertions selectable and document the incident uncertainty,
CPU negative control, and required owner-controlled card validation.

Co-Authored-By: Codex gpt-6-astra <noreply@openai.com>
Owner

verdict: approve
tier: T1 (module change to a live, already-mounted serving file)

Model: ollama/agent-dense (session already on agent-dense — swap precondition satisfied, not a failed swap).

rationale: Correct production fix. A finished/aborted request mid-chunked-prefill was sized to its full prompt (req.num_tokens) in _build_store_jobs, so the offload-key slice could out-length the block-id slice and trip the len(offload_keys) == len(offload_block_ids) assert that killed TT EngineCore on 2026-11-09. The fix bounds finished-request offloads to num_computed_tokens (cause) plus a default-on per-request range guard that skips/logs/counts any malformed store before reserving host slots. Scoped instance-locally to the TT connector (guard is idempotent, other connectors untouched). CPU evidence is strong: 12 new tests + 28 retained pass (3 torch staging-ring tests skip), with a true negative control (unpatched HEAD reproduces the exact AssertionError), 2048/256-token hash sizes, resumed-block replacement, preemption, and prefix hits. Additive-only surface (new fixture + test + docs); no secrets, no bypass patterns in the diff.

concerns:

  • [warn] QWEN36_KV_HOST_TIER_STORE_GUARD defaults ON — on merge this is a standing behavior change to the live TT connector (default-on mismatch guard). Intentional (it is the fix), but flagging for deliberate close-out rather than silent promotion.
  • [warn] No card certification. PR is explicit: no card run, no image built, no full installed-vLLM/TTScheduler integration, and existing card gates were NOT restamped. The CI card gate must fire and land a green A/B before this is certed on cards — do not treat CPU green as card proof.
  • [nit] CPU record is tree_dirty: true and the specific prod trigger is a stated hypothesis (crash.log empty, no request-state dump). The failure mechanism is reproduced and bounded; only the exact triggering request is unconfirmed. Acceptable for a correctness fix.
**verdict:** approve **tier:** T1 (module change to a live, already-mounted serving file) Model: ollama/agent-dense (session already on agent-dense — swap precondition satisfied, not a failed swap). **rationale:** Correct production fix. A finished/aborted request mid-chunked-prefill was sized to its full prompt (`req.num_tokens`) in `_build_store_jobs`, so the offload-key slice could out-length the block-id slice and trip the `len(offload_keys) == len(offload_block_ids)` assert that killed TT EngineCore on 2026-11-09. The fix bounds finished-request offloads to `num_computed_tokens` (cause) plus a default-on per-request range guard that skips/logs/counts any malformed store *before* reserving host slots. Scoped instance-locally to the TT connector (guard is idempotent, other connectors untouched). CPU evidence is strong: 12 new tests + 28 retained pass (3 torch staging-ring tests skip), with a true negative control (unpatched HEAD reproduces the exact AssertionError), 2048/256-token hash sizes, resumed-block replacement, preemption, and prefix hits. Additive-only surface (new fixture + test + docs); no secrets, no bypass patterns in the diff. **concerns:** - [warn] `QWEN36_KV_HOST_TIER_STORE_GUARD` defaults ON — on merge this is a **standing behavior change** to the live TT connector (default-on mismatch guard). Intentional (it is the fix), but flagging for deliberate close-out rather than silent promotion. - [warn] **No card certification.** PR is explicit: no card run, no image built, no full installed-vLLM/TTScheduler integration, and existing card gates were NOT restamped. The CI card gate must fire and land a green A/B before this is certed on cards — do not treat CPU green as card proof. - [nit] CPU record is `tree_dirty: true` and the specific prod trigger is a stated hypothesis (crash.log empty, no request-state dump). The failure *mechanism* is reproduced and bounded; only the exact triggering request is unconfirmed. Acceptable for a correctness fix.
Member

Cards skipped

Cards unavailable on cfx-llm0 for PR #394 f671839e2e7240db3f1e982a525f0deaeadd1aa3.

  • systemctl is-active tenstorrent-serving.service = active (need inactive)
  • MemAvailable = 53999408 kB (need >= 4000000)

No slot taken, no boot. This skip is green.

## Cards skipped Cards unavailable on `cfx-llm0` for PR #394 `f671839e2e7240db3f1e982a525f0deaeadd1aa3`. - `systemctl is-active tenstorrent-serving.service` = `active` (need `inactive`) - MemAvailable = `53999408` kB (need >= 4000000) No slot taken, no boot. This skip is green.
Author
Member

Review (orchestra, Claude Opus 5.5; Codex-authored so model-diverse) @f671839e: LAND.

  • Verified the test fixture's 27 scheduler functions are AST-identical to the live image's vllm/.../offloading/scheduler.py (copied read-only from vllmtt-prod), so the repro exercises the shipped code.
  • Root cause consistent with the image: _build_store_jobs uses req.num_tokens for a finished request, so a request finished mid-prefill (abort/preempt) yields more offload_keys than allocated block_ids -> assert at :975. Bound to num_computed_tokens is correct (prompt-only stores lose nothing on normal completion).
  • Guard mirrors the upstream end/slice math exactly, skips + counts + logs per request, preserves in-flight jobs; default on, QWEN36_KV_HOST_TIER_STORE_GUARD=0 keeps the assert for tests.
  • Not verified: card boot with the patched plugin and a soak. Deploy = overlay/image rollout + TT restart, owner-controlled, separate from this merge.
Review (orchestra, Claude Opus 5.5; Codex-authored so model-diverse) @f671839e: LAND. - Verified the test fixture's 27 scheduler functions are AST-identical to the live image's vllm/.../offloading/scheduler.py (copied read-only from vllmtt-prod), so the repro exercises the shipped code. - Root cause consistent with the image: _build_store_jobs uses req.num_tokens for a finished request, so a request finished mid-prefill (abort/preempt) yields more offload_keys than allocated block_ids -> assert at :975. Bound to num_computed_tokens is correct (prompt-only stores lose nothing on normal completion). - Guard mirrors the upstream end/slice math exactly, skips + counts + logs per request, preserves in-flight jobs; default on, QWEN36_KV_HOST_TIER_STORE_GUARD=0 keeps the assert for tests. - Not verified: card boot with the patched plugin and a soak. Deploy = overlay/image rollout + TT restart, owner-controlled, separate from this merge.
donach force-pushed codex/inc393-offload-assert from f671839e2e
Some checks are pending
tt-stack-ci / Report upstream drift (pull_request) Successful in 6m9s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 14m57s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 8m29s
tt-stack-ci / Serialized card gate (pull_request) Successful in 6m28s
cards-fresh cards: no verdict yet fp=61896aba648c70ac
to 4529efeb17
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 2m44s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 7m33s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 6m29s
cards-fresh cards: not measured (serving active or MemAvailable low); add cards:go to retry
tt-stack-ci / Serialized card gate (pull_request) Successful in 11m34s
cards-fresh / Re-check cards-fresh on open PRs (push) Successful in 14m17s
2026-11-12 10:41:24 +01:00
Compare
Member

Cards skipped

Cards unavailable on cfx-llm0 for PR #394 4529efeb17bd551a5911cb0330e4d3051cf15a6b.

  • systemctl is-active tenstorrent-serving.service = active (need inactive)
  • MemAvailable = 28760972 kB (need >= 4000000)

No slot taken, no boot. This skip is green.

## Cards skipped Cards unavailable on `cfx-llm0` for PR #394 `4529efeb17bd551a5911cb0330e4d3051cf15a6b`. - `systemctl is-active tenstorrent-serving.service` = `active` (need `inactive`) - MemAvailable = `28760972` kB (need >= 4000000) No slot taken, no boot. This skip is green.
Author
Member

Owner decision 2026-11-12: merge without the card gate. cards-fresh on 4529efeb was NOT measured ("serving active or MemAvailable low": TT prod serving, RTX reserved for MTP training, so a card run = full outage). All other checks green (run 12407). Card validation happens at TT deploy, which needs a TT restart anyway.

Owner decision 2026-11-12: merge without the card gate. cards-fresh on 4529efeb was NOT measured ("serving active or MemAvailable low": TT prod serving, RTX reserved for MTP training, so a card run = full outage). All other checks green (run 12407). Card validation happens at TT deploy, which needs a TT restart anyway.
orchestra merged commit 4529efeb17 into master 2026-11-12 11:07:04 +01:00
Owner

agent-gateway closeout (merged): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (merged): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack!394
No description provided.