L3 release validation and rollback runbook
Use this runbook to validate a Mooncake Store L3 cache tier release candidate before enabling L3, and to roll back safely. L3 uses --kvstore-storage-backend mooncake; for configuration and architecture, see server configuration and the asynchronous L3 design. L3 adds no second scheduling or execution path. Validation and rollback change only whether the storage backend is attached, not the serving path.
Prerequisites
Identify the release candidate commit and the target hardware and interconnect before you start. Prepare the environment for each gate that you need to run:
- All gates: Use the candidate source revision and keep a release record for the evidence. Evidence must match the candidate revision and the target environment.
- Local G1: Install a Rust toolchain and the
tokenspeed-mooncakewheel pinned intokenspeed-kernel/python/requirements/cuda-thirdparty.txt. The wheel shipslibmooncake_store.so,libmooncake_store_core.so, andmooncake_master. The shared Store core lets the native L3 client coexist with Python Store clients, including an online weight-update SDK, without registering the Store flags twice. The default PyPI wheel links CUDA 13 and RDMA user-space libraries even for host-only TCP tests; the workflow'sInstall Mooncake master runtimestep lists the exact packages. Choose an absent or empty evidence output directory. - G2: Provision a separate CUDA host for the test processes, a running Mooncake master, and an independent storage owner (provider) with
global_segment_size > 0in a separate process or host. Use the interconnect that the target deployment uses. - Production rollout: Collect the G1–G4 evidence required for G5 sign-off. G3–G5 are pending, so production rollout is not approved.
Gates and their status
The following table summarizes what each gate proves, how it runs, and its current status:
| Gate | What it proves | How it runs | Status |
|---|---|---|---|
| G1 CPU/native protocol baseline | The executor's protocol against a live master: byte round trips, objects outliving their writer, KVP owner relocation, tenant isolation, recovery after master restart — repeated, fail-closed | Automated: the Mooncake L3 Master Test workflow runs test/ci_system/l3_native_release_validation.py | Required for every merge touching L3 |
| G2 GPU byte gate | Packed-byte D2H → PUT → GET → H2D round trips through the native store, byte-exact, writer process gone before the reader starts | Manual, on separately provisioned GPU hosts: test/runtime/test_l3_flat_kv_e2e.py with MOONCAKE_GPU_TEST_CONFIG | Required before L3 is enabled on any shared environment |
| G3 Native model serving gate | Model outputs with L3 match recomputation; prefix actually reused on every owning rank | Not yet established | Pending — no evidence exists |
| G4 Long mixed-workload soak | Hours of mixed read/write load with pressure, retraction, and cancellation against the native store | Not yet established | Pending — no evidence exists |
| G5 Production rollout approval | G1–G4 evidence reviewed and accepted | Manual sign-off | Pending until G1–G4 evidence exists |
Do not treat G1 repetition as a soak, and do not treat any CPU result as proof of GPU or RDMA correctness. Enabling L3 in production without G2–G4 evidence is not approved.
Validation sequence
Complete the applicable checks in the following order. Stop at the first failure; a later result cannot waive an earlier failure.
- Run G1 for every merge that touches L3.
- Before enabling L3 on a shared environment, run G2 on the target GPU and interconnect.
- For production rollout, obtain G3 and G4 evidence, and then request G5 sign-off. The procedures for G3 and G4 are not established, so production rollout remains pending.
- Assemble the minimum evidence manifest.
- Apply the Stop/Go criteria before merging, deploying, or expanding.
G1 — CPU/native protocol baseline
The runner repeats the ts-l3 live master suite (cargo test --locked -p tokenspeed-l3 --test mooncake -- --test-threads=1 --nocapture) in isolated subprocesses, one process group per iteration with a hard per-iteration timeout. It strictly sets MOONCAKE_REQUIRE_MASTER=1, checks the native store library and master binary before starting, and resolves both paths to absolute before launching in the engine workspace. The tenant and restart tests always start their own master, so the binary is required even when MOONCAKE_MASTER names an external one.
A suite run counts as a pass only with a zero exit and exactly the expected output:
- One
running N testsheader. - One
test resultsummary with no failed, ignored, measured, or filtered-out tests. - Every one of the suite's five tests present and
ok. A deleted, renamed, or unexpected test is a failure, never a smaller pass. - No skip marker.
--nocapturemakes the marker visible in the raw log.
A launch error, an unreadable log, or any unexpected runner error fails the run. The report never says passed before every requested iteration completes.
Cleanup is identical on every exit path: normal leader exit, timeout, interruption, or a repeated cancellation signal. The runner sweeps the iteration's own process group, using a SIGTERM grace on the timeout and interrupt paths and then SIGKILL. It kills remaining members such as a leaked master before reaping the leader, and defers SIGINT and SIGTERM until cleanup finishes. Only the group the runner started is signalled; no other process is touched.
Run locally
From the repository root, install the pinned wheel and Rust toolchain, and set the native store library path:
bashmooncake=$(grep -E '^tokenspeed-mooncake==' tokenspeed-kernel/python/requirements/cuda-thirdparty.txt) python -m pip install "$mooncake" rustup toolchain install stable --profile minimal export TS_MOONCAKE_STORE_LIBRARY="$(python -c 'import mooncake, os; print(os.path.join(os.path.dirname(mooncake.__file__), "libmooncake_store.so"))')"Run three isolated iterations and write durable evidence. Replace
/path/to/l3-validation-evidencewith an absent or empty directory; the runner never overwrites earlier evidence.bashpython test/ci_system/l3_native_release_validation.py \ --iterations 3 \ --iteration-timeout 900 \ --terminate-timeout 20 \ --wall-clock-budget 10800 \ --engine-dir tokenspeed-engine \ --output-dir /path/to/l3-validation-evidence--wall-clock-budgetis the total wall clock the run may need in seconds.iterations × (iteration-timeout + 3 × terminate-timeout)plus a 600-second setup margin must fit it, including the bounded cleanup waits, so a run cannot request repetitions its job cannot finish.A successful run exits
0, writesreport.json, and writes oneiteration-NNN.jsonreceipt and oneiteration-NNN.lograw-output file per iteration.report.jsonrecordsoverall_status: "passed"only after every requested iteration passes.Check the exit code and preserve the evidence directory. Use the following table to interpret the result and choose the next action:
Exit code Meaning Operator action 0Passed Continue with the evidence checks. 1Failed or timed out Stop and inspect the report, receipts, and raw logs. 130Interrupted Stop and retain the interruptedreport and available iteration evidence.2Usage error, including bounds violations or a non-empty output directory Correct the arguments or choose an absent or empty output directory, and then rerun. Do not bypass a prerequisite failure for the store library or master setup. These failures fail the run closed.
Run in CI
Pull requests run one iteration automatically. For a repetition run, use the GitHub Actions workflow:
In the repository's Actions tab, select Mooncake L3 Master Test, and then select Run workflow.
Set the workflow inputs:
iterations: suite repetitions, bounded to 1–20 (default 3).iteration-timeout-seconds: per-iteration timeout, bounded to 10–3600 (default 900).
iterations × timeoutplus the setup margin must fit the job's wall-clock budget: 1800 s for the 30-minute pull-request job, or 10800 s for the 180-minute dispatch job. The runner rejects combinations that do not fit.Wait for the run to finish, and then download the
l3-native-validation-<run_id>-<attempt>artifact. The workflow uploads receipts and logs on success or failure.
The workflow step uses exec to start the runner, so job cancellation and the job timeout signal the runner itself. The runner writes an interrupted report before exiting, and the always() upload still has evidence.
report.json records the source identity, the exact command and configuration, the resolved tokenspeed-mooncake, cargo, and rustc versions (or explicit unavailable), platform, and elapsed time. It never collects the process environment.
Verify G1 source identity
Check all three source identity fields in report.json:
source.commit: the commit that was actually checked out and tested, resolved from the checkout itself. Onpull_requestruns this is the merge commit the checkout produced, not the PR head; on push and dispatch runs it is the ref's commit.source.dirty: whether the working tree had modifications or untracked files. CI checkouts must showfalse; treattrue, ornullwhengitcould not determine the state, as evidence that cannot be tied to a commit.source.label: an operator label recorded for cross-checking, never trusted as the tested revision. Pull-request runs labelpull_request-<number>-head-<sha>; push and dispatch runs label<event>-<sha>.
If the commit is unavailable, the revision does not match the candidate, or source.dirty is not false, stop and do not use the evidence for a release decision.
G2 — GPU byte gate (separately provisioned)
The test clients mount nothing (global_segment_size=0), so writer and reader processes can exit completely before the next one allocates GPU or Host buffers. Use the separately provisioned master and independent provider from the prerequisites.
Choose
rdmawhen the target deployment uses RDMA, ortcpotherwise. Record the master and provider versions for the evidence manifest.On the CUDA host, set
MOONCAKE_GPU_TEST_CONFIGand run the native GPU byte tests. Replacestore.example:50051with the master address,10.0.0.2with the test host's hostname or IP address, andl3-release-validationwith your validation tenant ID. Keepglobal_segment_sizeset to0.bashexport MOONCAKE_GPU_TEST_CONFIG='{ "master_server_address": "store.example:50051", "local_hostname": "10.0.0.2", "metadata_server": "P2PHANDSHAKE", "protocol": "rdma", "global_segment_size": 0, "tenant_id": "l3-release-validation" }' python -m pytest test/runtime/test_l3_flat_kv_e2e.py -vA successful run exercises both
directandkernelI/O settings, restores objects into different block slots, and checks exact bytes. It then deletes the objects and verifies safely retired misses. Each native writer exits before its reader starts. Confirm thatpytestexits0and that no native case is skipped.Optional: If
MOONCAKE_GPU_TEST_CONFIGsets"protocol": "rdma"and the host has at least two CUDA GPUs, runtest/runtime/test_l3_kvp_gpu.pyto exercise KVP owner relocation. TCP deployments must skip this test. To collect the recommended additional RDMA evidence, use a separate two-GPU RDMA configuration; do not reuse a TCP configuration.
Without MOONCAKE_GPU_TEST_CONFIG, the native cases skip; a skip is not evidence. Stop on a byte mismatch, an unretired or unexpected object failure, or any skipped native case that would otherwise be counted as a pass. Do not enable L3 on the shared environment until G2 passes on the target hardware and interconnect.
Pending gates
- G3 native model serving gate — serve with
--kvstore-storage-backend mooncakeagainst the native store with fresh processes and empty local caches, verify successfulGEToperations on every owning rank and the prefix actually reused, and compare outputs with a recomputation run. Prompts must require information in the restored prefix. Not yet established; pending. - G4 long mixed-workload soak — run hours of mixed read/write load with memory pressure, retraction, and client cancellation against the native store, watching the L3 pressure, health, and quarantine gauges. Not yet established; pending. G1 repetition is repeated protocol validation and is not a substitute.
- G5 production rollout approval — sign-off requires the G1–G4 evidence in the minimum evidence manifest; pending until that evidence exists.
Minimum evidence manifest
Attach the following to the release record before any rollout:
- The CI run URL and its
l3-native-validationartifact:report.jsonshowsoverall_status: "passed",source.dirty: false, and asource.committhat matches the candidate: identical to the candidate SHA on push and dispatch runs, or the candidate's merge commit on pull-request runs, whosesource.labelcarries the PR head SHA. Every receipt passed, and the raw iteration logs are present. Dispatched repetition runs should show at least 3 passed iterations. - G2: the full
pytestoutput for both I/O backends on the target GPU and interconnect, the exactMOONCAKE_GPU_TEST_CONFIGused with any secrets redacted, and the master and provider versions. - The resolved versions: the
versionssection ofreport.jsoncovers G1; record the same wheel version for the G2 hosts. - For G3 and G4, once established: serving configurations, source revisions, reused-prefix and output-comparison results, and the soak's duration and gauge excerpts.
Stop/Go criteria
Stop: do not merge, deploy, or expand on any of the following conditions:
- A failed, timed-out, or interrupted iteration, a skip marker, or a zero-test, ignored, measured, filtered-out, incomplete, or misscoped suite in G1, including a missing, renamed, or unexpected test.
- A prerequisite failure for the store library or master setup. It fails the run closed; never bypass it.
- Any revision or version mismatch between the evidence and the candidate, a
source.dirtyvalue that is notfalse, or anunavailablesource commit. - A byte mismatch, an unretired or unexpected object failure in G2, or a skipped native case counted as a pass.
- Unexpected quarantine or unproven native retirement in a validation gate. Intentional fault-injection coverage must separately prove that old buffers stay protected and new-generation work uses only remaining capacity. It does not waive a clean native-byte gate or prove transport retirement.
Go requires the following evidence for each operation:
- Merge: G1 green on the candidate, using the PR's tested merge commit and a clean tree.
- Enable L3 on any shared environment: G1 evidence plus G2 byte-exact evidence on the target hardware.
- Production rollout: G5 sign-off over the complete manifest.
For quarantine or retirement failures, use the degraded fallback and unsafe-I/O quarantine guidance in this document to determine the operator action. Do not treat a successful clear or a zero current-blocking gauge as proof of retirement.
Phased rollout
Complete the phases in order. Every phase requires G1 green on the deployed SHA and, before first enablement on the target hardware, G2 byte-exact evidence.
- Phase 0 — L3 off (default). Omit
--kvstore-storage-backend. Confirm that no L3 executor, workers, or SDK client are created; serving runs the same single path on L1/L2. - Phase 1 — one replica, client-only. Enable L3 on a single replica with
global_segment_size: 0in--kvstore-storage-backend-extra-config, against an independently deployed master and providers. Watch the L3 pressure-gate, backend health, and quarantine gauges. - Phase 2 — more replicas. Expand only with identical weights, packed layout, parallel geometry, and runtime compatibility epoch, so all replicas share one namespace.
- Optional: Phase 3 — worker-mounted segments. After reviewing provider behavior in the earlier phases, set a positive
global_segment_sizeon inference workers and account for the combined Host allocations.
Degraded fallback vs unsafe-I/O quarantine
These are different states; do not conflate them.
Cache-tier degraded fallback
When queue count, queued bytes, or operation age reach a high watermark, the scheduler closes L3 read/write admission without a restart: new requests bypass L3 preparation and admit ordinarily, nonowning backup candidates are dropped, and already submitted I/O keeps its lifetime and deadlines. The gate reopens only when all observations reach their low watermarks. Independently, the executor's health monitor rejects work during a backend outage's cooldown and permits one recovery probe. Serving continues on L1/L2 throughout.
Investigate provider and master health and queue sizing. There is no data-safety concern and nothing to restart.
Unsafe current namespace
A result without native retirement proof retains every reference of that job and blocks new I/O in that namespace. Explicit full-clear first checks non-storage owners. Healthy current work can drain for async.clear_cache_drain_timeout_ms (default 500 ms, 0 skips that wait); an unsafe current scope goes directly to retaining recovery. All ranks agree the decision. Recovery invalidates local indexes and starts a fresh generation without remote purge, while keeping old native source and destination addresses and registration alive. L2, L3, and recomputation may continue with remaining Host and operation capacity. A healthy operation that merely exceeds the budget also selects this conservative private generation; the timeout is not evidence of a broken transport.
Old native PUT operations keep their write workers as well as their source references. When they occupy all configured write workers, new PUT attempts fail safely before native submission instead of accumulating a stale write queue. Independent QUERY and GET work is not disabled merely by that old write lane's age; writes resume when a worker is available. Retained Host blocks, total operation credits, and backend health still bound useful work, so this does not guarantee reads under exhausted shared capacity or unlimited recovery without restart.
Historical unsafe memory
tokenspeed:l3_io_quarantined=1 remains set after such recovery because a clear supplies no missing retirement proof. It guards shutdown: close() still refuses deregistration of that old allocation and registration. tokenspeed:l3_io_blocked instead reports whether the active namespace currently needs unsafe-I/O isolation. A safe new generation can have quarantined=1 and blocked=0. The latter is separate from backend cooldown and Host or operation credit pressure, either of which can independently prevent new work.
Track retained blocks and operations and exhausted-capacity warnings to plan a restart if unreclaimable history consumes the available budget. Do not treat the historical flag alone as a current L3 outage. Both I/O flags are rank-local; aggregate active blocking with MAX across the replica's cache owners when alerting on that replica's availability.
Healthy strict clear
Once the safe active prefix drains, ordinary clear still requires all-rank remote purge success before clearing local indexes. Historical references in other prefixes do not prevent that path. Its synchronous administrative RPC is outside both preparation and healthy-drain timeouts. Recovery generations are agreed only within the engine's replica and attention-DP group; independent Prefill services may temporarily stop sharing until a new immutable weight version selects their common prefix.
Weight namespace publication failure
After all ranks report a successful model load, shared-version metadata is prepared without publication. The ranks inspect the target prefix, agree any required fresh generation, and validate their local executor plans before committing namespace metadata on the gated path. An entropy or preparation failure keeps every rank's previous namespace metadata for that publication attempt; it does not revert an earlier successful clear.
Check the failed update reply and namespace observations before retrying. The model load may already have written parameter bytes, and a negative commit_weight_update marks them unusable rather than restoring old parameters. Use a complete supported reload or the existing restart procedure; do not resume serving merely because the namespace still reports its previous version. A retry must still satisfy the normal flush and version checks, including ABA isolation when old access to its target remains unproven.
Never treat an empty queue, a soft timeout, successful clear, or a zero current-blocking gauge as proof that old native I/O retired. A retaining clear may succeed while old tickets remain, but never frees them. Do not deregister the Host pool, its MR, or Store registration while native access is unknown.
Drain and deregistration
To remove an inference worker safely, follow these steps:
- Remove the worker from routing so it gets no new requests, and let in-flight requests finish. Soft-deadline expiry and client cancellation do not release native I/O references.
- Stop the process normally. At shutdown the L3 executor joins its workers with a deadline and closes the store only when native retirement is known.
- If retirement stays unknown, let the process exit in that state. The executor refuses store close and Host deregistration and keeps the store client for the process lifetime, as the data plane keeps the Host allocation. A dead client whose buffers were never freed is recoverable at the master and provider, while force-freeing buffers that native I/O may still write is not. Do not
kill -9ahead of the executor's own report, and never use a timeout or flush as a force-free. - Deregister a provider only after every client has drained. Master and providers have independent lifetimes: the master holds metadata, providers hold the cached bytes, and both can and should outlive inference workers. Reuse after inference restarts requires master and providers to retain the objects.
Namespace compatibility and rollback to L2
Every object is keyed under a tsl3- namespace that covers the loaded target and draft checkpoints, explicit weight versions, the packed Host layout, the parallel geometry including ordered group shard counts, and the cache-producing runtime choices, isolated by a runtime compatibility epoch. Identical configurations share a namespace; any difference starts a separate, cold namespace. Objects are never converted across epochs.
Roll back to L2
- Follow the drain and deregistration procedure in this document for the outgoing processes.
- Restart the workers without
--kvstore-storage-backend. Confirm that no L3 executor or store client is created and that the same single serving and scheduling path runs L1/L2 only.
A process restart is required, not a reload, because the Host allocation and native I/O references are held for the process lifetime.
Verify rollback and plan roll-forward
After rollback, the shared namespace is untouched: objects remain on the master and providers, whose lifetimes are independent of the inference workers, and L2-only serving never reads them. Rolling forward again with an identical configuration reuses them; a changed configuration starts cold. Purge the remote namespace only once no deployment will roll forward into it again. With L3 enabled, weight updates require an explicit weight_version and a successful flush; a metadata-only version update is rejected.
What G1 repetition does not prove
G1 runs the executor protocol against a local master over TCP on CPU. Any number of passed iterations still says nothing about RDMA behavior, GPU byte movement, model outputs, availability under sustained load, or production tail latency. Those belong to G2–G4 and remain pending until their evidence exists.