Repository navigation
Description
Why
x64 CI is structurally incapable of catching memory-ordering bugs, and we have just shipped a fix for one it never saw.
#579 found that PagedMMF's page seqlock had no memory barriers at all — grep -c "Volatile\." PagedMMF.cs returned 0. The entire protocol, both writer increments and all three reader accesses, took its cross-thread ordering from the hardware rather than from the code. x64 TSO supplies that ordering; arm64 does not.
Three properties make this class undetectable by the current gate:
- The reader's barriers compile to plain
movon x64. Conforming and violating code emit identical machine code. There is nothing for a test to observe. - On the writer side the code differs but TSO supplies the missing ordering anyway, so the violating version still passes.
- The failure mode is silent even when it fires.
CopyPageWithSeqlockfeedsWritePagesForCheckpoint, which CRCs the copied bytes and writes them — so a torn page is stamped with a checksum computed over the torn bytes. ADR-015 page-checksum validation then passes on reload and every downstream integrity check is defeated.
Point 3 is why a functional suite on arm64 is not sufficient either. Nothing in the suite asserts on post-checkpoint page content under concurrent mutation, so even the right hardware running the right code produces a green run. The gate change is necessary but not by itself conclusive — see Verification strategy below.
This is not hypothetical process failure. PR #489 (2026-07-17) was an explicit arm64-correctness pass, verified on Apple Silicon, and it still missed PagedMMF — its scope was eleven files. It could not have caught this one anyway: everything it fixed had an observable failure mode. Its own summary says so:
"A green arm64 run confirms no regression, no deadlock, and correct execution on the target hardware. It does not prove the barriers were strictly necessary or that every latent reordering race is eliminated — missing-barrier bugs are probabilistic and rarely tripped by a functional suite."
Only 12 files in the whole engine use Volatile at all, and 6 of them got it from #489. Everything else participating in a cross-thread publication protocol is in the position PagedMMF was in two weeks ago.
Why a Mac run is not a substitute
The branch was run manually on Apple Silicon (M-series, 10 logical cores). Full suite green. A throwaway litmus harness reduced the seqlock protocol to a bare writer/reader pair and produced 290M validated copies, 1.28M of which entered the retry window, and zero tears on the unfenced protocol.
That is a meaningful negative — the window was demonstrably entered over a million times — but it says Apple Silicon does not exercise this reordering, not that the barriers are unnecessary. Apple's cores are far more conservative than the ARM spec permits.
Graviton is a different target. Neoverse N1/V1/V2 are the reference weak-memory implementations and do reorder in practice. A clean Apple Silicon run says little about them.
Measured barrier cost, for sizing: ~0% on x64 (single runs ranged to 16% and went negative — noise), ~4% writer / ~4% reader on M-series in the isolated harness, consistently positive across five runs. Expect well under 1% in the engine, where each page copy also carries a 4 KB memcpy, a CRC32C pass and a write syscall. Recorded in claude/rules/durability.md → SL-07.
What
A [use-arm] token in the PR head commit message routes the heavy unit-test gate to an arm64 runner instead of the x64 one — same shape as the existing [no-ut] / [no-doc] tokens.
Mechanism (mirrors the existing token exactly)
.github/workflows/merge-gate.yml already has the pattern. The changes job reads pull_request.head.sha (deliberately not the working-tree HEAD — on a PR that is the synthetic merge commit whose auto-message never carries the token) and emits a boolean consumed by the heavy jobs' if::
- name: Detect [no-ut] skip token
id: ut
run: |
SHA='${{ github.event.pull_request.head.sha || github.sha }}'
MSG=$(gh api "repos/${{ github.repository }}/commits/$SHA" --jq '.commit.message')
if grep -qiE '\[no-ut\]' <<<"$MSG"; then ...[use-arm] adds a use_arm output alongside skip_ut, and gates a new aws-gate-arm job against it — with the existing x64 jobs gaining && needs.changes.outputs.use_arm != 'true' so exactly one gate runs.
Instance
c8gd.8xlarge — Graviton4 / Neoverse-V2 / ARMv9.0-a, 2.8 GHz. It is an exact shape match for the current c6id.8xlarge, which matters because the gate's timings and NVMe-backed test-DB layout are tuned to that shape:
| vCPU | RAM | local NVMe | CPU | |
|---|---|---|---|---|
c6id.8xlarge (today) |
32 | 64 GiB | 1900 GB | Intel 3.5 GHz, x86_64 |
c8gd.8xlarge (proposed) |
32 | 64 GiB | 1900 GB | Graviton4 2.8 GHz, arm64 |
Verified against describe-instance-types in eu-west-1 (the region is not free to change — it must match the typhon-traces S3 bucket).
Fallback: c7gd.8xlarge (Graviton3 / Neoverse-V1 / ARMv8.4-a, 2.6 GHz), same 32/64/1900 shape, cheaper, still a genuine weak-memory target.
All 304 arm64 instance types in
eu-west-1reportManufacturer: AWS— Graviton is the only arm64 silicon available. The EC2 API never names the generation or core; the mapping (*6g→Graviton2/Neoverse-N1,*7g→Graviton3/Neoverse-V1,*8g→Graviton4/Neoverse-V2) comes from the AWS Graviton technical guide, cross-checked against the clock speeds the API returns. Graviton5 (m9g, Neoverse-V3) is not offered ineu-west-1.
Verification strategy — the gate alone is not enough
Running the existing suite on Graviton catches observable arm64 failures. It does not catch the silent class this issue exists for, because a torn page carries a valid CRC.
Closing that needs a reduced litmus harness: the protocol isolated from the engine so the reorder window is most of the loop rather than a few instructions buried under I/O. One was built during #579 and then removed from the branch once it had served its purpose — recover it from commits 9165288 and d09070e on fix/bug-bash-2026-07-30 rather than rewriting it. It covers the seqlock specifically, exercises the shipping primitives including the deliberate open/close asymmetry, and reports writer and reader cost separately.
Two properties of that harness are load-bearing and must survive any rewrite (both are documented in SL-07):
- It must self-test by stripping the protocol entirely and confirming tearing is detected. Without that gate, a clean run cannot be told apart from a harness that never overlapped its threads — which is exactly what the first version did (16.6 billion skips against 8,883 validated copies, and it looked like a pass).
- A clean run is not evidence. Only a tear is positive; this is a one-way test.
Whether the harness becomes a CI job or stays an on-demand tool is an open question below.
Acceptance criteria
[use-arm]in the PR head commit message runs the engine unit-test suite onc8gd.8xlargeand not on x64 — exactly one gate executes, never both.- Absent the token, behaviour is byte-for-byte unchanged. Both the SkyPilot-ephemeral and
GATE_RUNNER=selfhostedpaths keep working. - Detection reads
pull_request.head.sha, not the merge commit — matching[no-ut], for the reason documented there. bench/aws/ci.sky.yamlgains an arm64 variant (or is parameterised oninstance_type);region: eu-west-1is preserved.- The arm64 gate produces the same artifacts as the x64 one — S3 report sync,
$GITHUB_STEP_SUMMARYrender,.trx/coverage upload. - A green arm64 gate run is recorded on a PR carrying the token, with its pass/fail/skip counts noted against the x64 baseline (4103 passed / 0 failed / 53 skipped). Platform-gated differences are expected and should be enumerated rather than assumed.
claude/rules/durability.mdSL-07 is updated — it currently states that x64 CI cannot verify this class and that verification requires conformance review plus a manual arm64 run, and points here for the CI leg.- Documented in the CI skip-token reference alongside
[no-ut]/[no-doc].
Open questions
- Opt-in token, nightly sweep, or both? The token gives on-demand verification when touching concurrency code, but relies on someone remembering. A nightly arm64 run of the full suite would catch drift without discipline — at the cost of a recurring instance. My inclination is both, mirroring how doc-accuracy already splits a fast per-PR gate from a nightly LLM sweep (CI: doc-accuracy PR reviewer (Layer 2) + docs-affected map #490).
- Should
[use-arm]replace the x64 run or add to it? Replacing is cheaper and matches "run the gate on arm instead of x64" as scoped here. Adding is safer but doubles gate cost on those PRs. - Runner style. The x64 path has both an ephemeral SkyPilot job and a persistent self-hosted one (CI:
aws-gatecorrectness gate ~10 min — cut infra tax via persistent self-hosted runner + build SPA once + profile Workbench.Tests #466). The arm64 leg should probably start ephemeral-only — a second persistent box is real recurring cost for an opt-in path. - Does the litmus harness come back into the tree, and if so as a CI job or an on-demand tool? It is currently only in git history, deliberately.
Not in scope
- Publishing arm64 build artifacts or an arm64 NuGet target. This is test execution only.
- Pinning threads across P/E clusters or any other reorder-provocation tooling beyond the harness described above.
- Auditing the remaining unfenced publication protocols. That is the finding this infrastructure would enable, and belongs in its own issue.
References
- Page seqlock has no memory barriers — checkpoint can write torn pages with valid CRCs on arm64 #579 — the seqlock fix that motivated this (branch
fix/bug-bash-2026-07-30; harness in9165288/d09070e, removed ine8df1a6) - fix: make concurrency/storage primitives arm64-correct (explicit acquire/release barriers) #489 — the prior arm64 pass, eleven files, explicitly disclaimed completeness
- CI:
aws-gatecorrectness gate ~10 min — cut infra tax via persistent self-hosted runner + build SPA once + profile Workbench.Tests #466 — the persistent self-hosted c6id gate claude/rules/durability.md→ SL-07 (barrier placement as an invariant, plus the x64/arm64 cost measurements)
Activity
#579 Drop the seqlock litmus harness from the branch
#624 Fix seven tests that assumed a fast, many-core machine, surfaced…
#624 Nightly arm64 unit-test run on a GitHub-hosted macos-15 runner (#…
#624 Trim hdiutil's padded device path before handing it to diskutil
#624 Nightly macOS: run the gate's own shard plan sequentially, on a …
#624 Fix an ABA in the WAL commit buffer's back-pressure wait that we…