sim-run: SIM_KERNEL_OVERLAY after TTSIM_TTN_HOME (#293 overlay was dropped) #294

Merged
Grok merged 1 commit from sim/kernel-overlay-fix into master 2026-10-21 20:01:26 +02:00
Owner

Sim tooling only, no served change.

Bug: #293 applied SIM_KERNEL_OVERLAY before the TTSIM_TTN_HOME block. That block then replaced TT_METAL_HOME and set TT_METAL_RUNTIME_ROOT (the JIT's root_dir) to the unpatched tree. With the patched-sim overlay set, a gate compiled the stock kernel and could pass bitwise without the kernel under test.

Fix: one SIM_KERNEL_OVERLAY block, run after TTSIM_TTN_HOME, that points both TT_METAL_HOME and TT_METAL_RUNTIME_ROOT at the farm.

  • Keeps #293's interface: one marker for all entries, new files allowed.
  • ;-separated markers apply per entry.
  • Refusals now die from the main shell rather than a pipeline subshell.

Test: scripts/test-sim-kernel-overlay.sh stubs python3 and nix, then checks the file the JIT root sees. It runs as a step in the build job.

  • It passes on this branch.
  • Against #293's sim-run.sh it fails: the probe sees STOCK writer at rc=0.

Audit: no bench/runs or LEDGER record since #293 combined SIM_KERNEL_OVERLAY with TTSIM_TTN_HOME.

  • The only overlay records since then are the rs-bank ones, and they ran on a sim-run that applies the overlay after TTSIM_TTN_HOME.
  • rs-uni-sim-20261021T111500Z (free/u-ccl) predates #293 and did not set TTSIM_TTN_HOME.

🤖 Generated with Claude Code

Sim tooling only, no served change. **Bug:** #293 applied SIM_KERNEL_OVERLAY before the TTSIM_TTN_HOME block. That block then replaced TT_METAL_HOME and set TT_METAL_RUNTIME_ROOT (the JIT's root_dir) to the unpatched tree. With the patched-sim overlay set, a gate compiled the stock kernel and could pass bitwise without the kernel under test. **Fix:** one SIM_KERNEL_OVERLAY block, run after TTSIM_TTN_HOME, that points both TT_METAL_HOME and TT_METAL_RUNTIME_ROOT at the farm. - Keeps #293's interface: one marker for all entries, new files allowed. - `;`-separated markers apply per entry. - Refusals now die from the main shell rather than a pipeline subshell. **Test:** `scripts/test-sim-kernel-overlay.sh` stubs python3 and nix, then checks the file the JIT root sees. It runs as a step in the build job. - It passes on this branch. - Against #293's sim-run.sh it fails: the probe sees `STOCK writer` at rc=0. **Audit:** no bench/runs or LEDGER record since #293 combined SIM_KERNEL_OVERLAY with TTSIM_TTN_HOME. - The only overlay records since then are the rs-bank ones, and they ran on a sim-run that applies the overlay after TTSIM_TTN_HOME. - `rs-uni-sim-20261021T111500Z` (free/u-ccl) predates #293 and did not set TTSIM_TTN_HOME. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sim-run: apply SIM_KERNEL_OVERLAY after TTSIM_TTN_HOME, so the gate compiles the kernel under test
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Successful in 1m58s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 16m58s
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has been cancelled
cards-fresh / Re-check cards-fresh on open PRs (push) Successful in 54m4s
e0d54216dc
Believed before (#293): SIM_KERNEL_OVERLAY makes a ttsim gate compile the
lever's kernel. It does on the nix tree, but #293 runs the overlay BEFORE the
TTSIM_TTN_HOME block, which then replaces TT_METAL_HOME and sets
TT_METAL_RUNTIME_ROOT (the JIT's root_dir) to the unpatched tree. With the
patched-sim overlay set, the overlay was silently dropped: a bitwise gate
compiled the stock kernel and could pass without the kernel under test, and
the marker check passed because it read the discarded copy.

Now one block runs after TTSIM_TTN_HOME and points both TT_METAL_HOME and
TT_METAL_RUNTIME_ROOT at the farm. #293's interface is kept (one marker for
all entries, new files allowed); ';'-separated markers apply per entry. The
read loop is no longer a pipeline subshell, so a refusal is a real die.

scripts/test-sim-kernel-overlay.sh stubs python3/nix and checks the file the
JIT root sees; against #293's sim-run.sh it fails (the probe sees "STOCK
writer" at rc=0). CI runs it in the build job.

Audit: no bench/runs or LEDGER record since #293 combined SIM_KERNEL_OVERLAY
with TTSIM_TTN_HOME, so no gate was blind.

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

verdict: approve
tier: T1

rationale: Sim tooling only, nothing ships to cards. The fix is correct and the shipped test proves both directions: run in-kernel against this head it passes all 7 cases; run against #293's sim-run.sh it fails the critical case (overlay applied before TTSIM_TTN_HOME gets replaced and dropped — probe sees STOCK writer at rc=0, plus the unsplit PATCH_W;PATCH_R marker). The new block runs after TTSIM_TTN_HOME, points BOTH TT_METAL_HOME and TT_METAL_RUNTIME_ROOT (the JIT root_dir) at the farm, keeps #293's interface (single marker for all entries, ;-separated per-entry markers, new files allowed), and the read loop is now < <(...) process substitution so refusals die from the main shell. The two silent traps from #293 (printf without trailing newline; read-only store dir modes) stay fixed (printf '%s\n' + find chmod u+w). readlink -f on the cpp dir before cp -rs handles the case where TTSIM_TTN_HOME is itself a farm of symlinks.

concerns:

  • [warn] .forgejo/workflows/ci.yml:70 — the new "sim-run kernel overlay" build step becomes a standing gate for every future PR once this merges: any change to sim-run.sh's SIM_KERNEL_OVERLAY semantics must keep this test green. That is the point of the gate, but it's now the standing default, be deliberate about it.
  • [warn] Head CI run 9799 is still waiting (build not started, card gate blocked behind it). human-approved label HELD until it lands green; no card gate is needed for this diff (sim tooling, no lever ships), so green build is sufficient.

(handoff ho-b034832c8d7f; reviewed on agent-dense as the session model)

**verdict:** approve **tier:** T1 **rationale:** Sim tooling only, nothing ships to cards. The fix is correct and the shipped test proves both directions: run in-kernel against this head it passes all 7 cases; run against #293's sim-run.sh it fails the critical case (overlay applied before TTSIM_TTN_HOME gets replaced and dropped — probe sees STOCK writer at rc=0, plus the unsplit `PATCH_W;PATCH_R` marker). The new block runs after TTSIM_TTN_HOME, points BOTH TT_METAL_HOME and TT_METAL_RUNTIME_ROOT (the JIT root_dir) at the farm, keeps #293's interface (single marker for all entries, `;`-separated per-entry markers, new files allowed), and the read loop is now `< <(...)` process substitution so refusals die from the main shell. The two silent traps from #293 (printf without trailing newline; read-only store dir modes) stay fixed (printf '%s\n' + find chmod u+w). `readlink -f` on the cpp dir before `cp -rs` handles the case where TTSIM_TTN_HOME is itself a farm of symlinks. **concerns:** - [warn] `.forgejo/workflows/ci.yml:70` — the new "sim-run kernel overlay" build step becomes a standing gate for every future PR once this merges: any change to sim-run.sh's SIM_KERNEL_OVERLAY semantics must keep this test green. That is the point of the gate, but it's now the standing default, be deliberate about it. - [warn] Head CI run 9799 is still `waiting` (build not started, card gate blocked behind it). `human-approved` label HELD until it lands green; no card gate is needed for this diff (sim tooling, no lever ships), so green build is sufficient. (handoff ho-b034832c8d7f; reviewed on agent-dense as the session model)
Author
Owner

Cancelled CI run #9799 (plan + serialized card gate) after the build job #51666 passed: sim tooling only (scripts/sim-run.sh, its host test, one CI step), no served-path file changes, so a card run has no ship decision. The new 'sim-run kernel overlay' step passed in #51666 (all passed).

Cancelled CI run #9799 (plan + serialized card gate) after the build job #51666 passed: sim tooling only (scripts/sim-run.sh, its host test, one CI step), no served-path file changes, so a card run has no ship decision. The new 'sim-run kernel overlay' step passed in #51666 (all passed).
Grok merged commit e0d54216dc into master 2026-10-21 20:01:26 +02:00
Author
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
2 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!294
No description provided.