tenstorrent-serving: hold guard so deploys cannot start prod onto held cards #349

Merged
orchestra merged 1 commit from fix/tt-serving-hold-guard into master 2026-11-05 08:04:00 +01:00
Member

Incident (2026-11-05 03:09 CET):

  1. A nixos deploy (cfx-llm0 generation 430) started tenstorrent-serving while a ttx window held the cards for the #334 CLAIM "P/D bring-up".
  2. tt-probe-cards opened a 2-device mesh on the busy cards. UMD logged NOC address of a hugepage does not match and then Failed to allocate TLB window.
  3. The held export engine's next prefill (03:09:16) never returned.
  4. The probe retries used up the unit's start limit, so tt-window's restore (systemctl start at 03:18) failed too. Production was down until a manual reset-failed at 03:25.

The old reset guard only looked for other containers after opening a mesh, which is too late.

Change: ExecCondition = tt-hold-guard. It runs before stop, probe and reset, on every start and restart. Exit 1 is a skip in systemd: no failure, no Restart=, no start-limit cost. It skips when:

  • a ttx slot claim exists (/tmp/ttlock.d/card0|card1). That is how a #334 window holds the cards on the box, since the host cannot read Forgejo. tt-window releases its slot before it starts this unit, so its restore still works. A claim whose driver is a dead process on this same host counts as stale and is ignored;
  • a legacy /tmp/ttlock not owned by ttx exists;
  • any PID outside the vllmtt-prod container has a Tenstorrent device open (/proc/driver/tenstorrent/*/pids).

Tests:

  • bash -n and shellcheck pass.
  • 8 scenarios on a copy with relocated paths: free → 0; remote claim → 1; stale local claim → 0; live local claim → 1; legacy lock → 1; ttx-owned legacy lock → 0; foreign device holder → 1; empty pids → 0.
  • Read-only on cfx-llm0 with production running: rc 0. The holder PID 54014 is inside vllmtt-prod's cgroup.
  • nix eval of nixos-llm cfx-llm0 with --override-input tt-stack on this branch renders ExecCondition.

It reaches production through the nixos-llm tt-stack input bump. Draft: do not merge without the coordinator.

🤖 Generated with Claude Code

**Incident (2026-11-05 03:09 CET):** 1. A nixos deploy (cfx-llm0 generation 430) started `tenstorrent-serving` while a ttx window held the cards for the #334 CLAIM "P/D bring-up". 2. `tt-probe-cards` opened a 2-device mesh on the busy cards. UMD logged `NOC address of a hugepage does not match` and then `Failed to allocate TLB window`. 3. The held export engine's next prefill (03:09:16) never returned. 4. The probe retries used up the unit's start limit, so tt-window's restore (`systemctl start` at 03:18) failed too. Production was down until a manual `reset-failed` at 03:25. The old reset guard only looked for other containers *after* opening a mesh, which is too late. **Change:** `ExecCondition = tt-hold-guard`. It runs before stop, probe and reset, on every start and restart. Exit 1 is a skip in systemd: no failure, no Restart=, no start-limit cost. It skips when: - a ttx slot claim exists (`/tmp/ttlock.d/card0|card1`). That is how a #334 window holds the cards on the box, since the host cannot read Forgejo. tt-window releases its slot before it starts this unit, so its restore still works. A claim whose driver is a dead process on this same host counts as stale and is ignored; - a legacy `/tmp/ttlock` not owned by ttx exists; - any PID outside the vllmtt-prod container has a Tenstorrent device open (`/proc/driver/tenstorrent/*/pids`). **Tests:** - `bash -n` and shellcheck pass. - 8 scenarios on a copy with relocated paths: free → 0; remote claim → 1; stale local claim → 0; live local claim → 1; legacy lock → 1; ttx-owned legacy lock → 0; foreign device holder → 1; empty pids → 0. - Read-only on cfx-llm0 with production running: rc 0. The holder PID 54014 is inside vllmtt-prod's cgroup. - `nix eval` of nixos-llm cfx-llm0 with `--override-input tt-stack` on this branch renders `ExecCondition`. It reaches production through the nixos-llm tt-stack input bump. Draft: do not merge without the coordinator. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tenstorrent-serving: ExecCondition hold guard (ttx slot claim or a foreign device holder skips the start)
Some checks are pending
cards-fresh cards: draft, not run; add cards:go to force
tt-stack-ci / Report upstream drift (pull_request) Successful in 1m27s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 5m43s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 10m47s
tt-stack-ci / Serialized card gate (pull_request) Has been skipped
cards-fresh / Re-check cards-fresh on open PRs (push) Successful in 10m16s
e5bba496e7
2026-11-05 03:09: a nixos deploy started tenstorrent-serving while a ttx window held the cards (#334
CLAIM). Its probe opened a mesh on the busy cards, the held engine wedged, and the probe retries
burned the start limit so the window's own restore failed. The guard runs before stop/probe/reset:
skip (exit 1, not a failure) while /tmp/ttlock.d/card{0,1} or a legacy /tmp/ttlock is held (stale
same-host claims ignored) or a pid outside vllmtt-prod has /proc/driver/tenstorrent/*/pids open.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner

verdict: approve (comment-only — WIP draft, label held for coordinator)
tier: T1

rationale: additive-only, off-by-default guard wired as ExecCondition ahead of stop/probe/reset. Fixes a real incident (#334 hold collided with a nixos deploy, wedged the engine, burned the start limit). Safe failure mode: any uncertainty resolves to skip-start, so it can only protect, not crash the box. No source/tooling default changes; the guard ships inert until the cfx-llm0 deploy orders it.

concerns:

  • [nit] bash -n clean; no local shellcheck/nix available in the review container, so I verified by inspection: outer ${""...""} is a single-quoted Nix string, the ${'${...}'} forms inside it are literal shell substitutions, and ${'{pkgs.docker}'} is the only Nix-side interpolation. Quoting is correct as written.
  • [nit] claim staleness relies on field 6 (cut -d'|' -f6) being the driver and dhost matching the host. If a same-host claim's driver PID was reused by an unrelated live process, that claim is treated as stale and the guard starts anyway. PID-reuse race is inherent to PID-based staleness — acceptable, noting for awareness only.
  • [nit] a remote (cross-host) claim is never stale-skipped and a holder renamed away from vllmtt-prod trips the device-holder branch — both fail in the conservative (skip-start) direction, which is correct.

No blocking concerns. This is a WIP draft, so no human-approved label and no un-draft (both held for the coordinator; the PR body asks not to merge without you).

verdict: approve (comment-only — WIP draft, label held for coordinator) tier: T1 rationale: additive-only, off-by-default guard wired as ExecCondition ahead of stop/probe/reset. Fixes a real incident (#334 hold collided with a nixos deploy, wedged the engine, burned the start limit). Safe failure mode: any uncertainty resolves to skip-start, so it can only protect, not crash the box. No source/tooling default changes; the guard ships inert until the cfx-llm0 deploy orders it. concerns: - [nit] bash -n clean; no local shellcheck/nix available in the review container, so I verified by inspection: outer ${""...""} is a single-quoted Nix string, the ${'${...}'} forms inside it are literal shell substitutions, and ${'{pkgs.docker}'} is the only Nix-side interpolation. Quoting is correct as written. - [nit] claim staleness relies on field 6 (cut -d'|' -f6) being the driver and dhost matching the host. If a same-host claim's driver PID was reused by an unrelated live process, that claim is treated as stale and the guard starts anyway. PID-reuse race is inherent to PID-based staleness — acceptable, noting for awareness only. - [nit] a remote (cross-host) claim is never stale-skipped and a holder renamed away from vllmtt-prod trips the device-holder branch — both fail in the conservative (skip-start) direction, which is correct. No blocking concerns. This is a WIP draft, so no human-approved label and no un-draft (both held for the coordinator; the PR body asks not to merge without you).
orchestra changed title from WIP: tenstorrent-serving: hold guard so deploys cannot start prod onto held cards to tenstorrent-serving: hold guard so deploys cannot start prod onto held cards 2026-11-05 08:03:58 +01:00
orchestra merged commit e5bba496e7 into master 2026-11-05 08:04:00 +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
3 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!349
No description provided.