Skip to content

atlas-coldsnap: add a strict client for the ColdSnap controller protocol - #29

Closed
AzeezIsh wants to merge 1 commit into
mainfrom
atlas-coldsnap
Closed

AzeezIsh wants to merge 1 commit into
mainfrom
atlas-coldsnap

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

Adds crates/atlas-coldsnap, a CUDA-free Rust client for the ColdSnap controller protocol, so Atlas can eventually be driven by a placement manager's sleep / wake / status lifecycle.

This is scaffolding for that integration, not the integration itself — see the caveat under Notes for reviewers. The crate is purely additive: one line added to the workspace members list, and time gains the parsing feature in Cargo.lock (already in the graph transitively).

What it owns, and what it deliberately does not

It owns the foreign contract and nothing else: request format 4, receipt format 2, the coldsnap capabilities document, argv construction, the single process-I/O seam, and the restore-shaped derivation of sleep/wake/status. Field names and validators are transcribed from the controller's Go source (internal/snapshot/schema.go, receipt.go, internal/cli/capabilities.go, internal/canonicaljson/canonical.go) rather than its prose.

It does not own Atlas lifecycle policy. What "sleep" means for an Atlas CUDA context — release weights and KV, retain the process — is a spark-server decision. A foreign-protocol adapter that also owned that would invert the dependency and make every lifecycle change a change here.

Test plan

  • cargo fmt -p atlas-coldsnap -- --check
  • ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy -p atlas-coldsnap --all-targets (clean under the workspace warnings = "deny" + clippy::all policy)
  • cargo test -p atlas-coldsnap — 119 passed (93 unit + 26 integration), on macOS, with no GPU and no coldsnap binary
  • typos crates/atlas-coldsnap
  • 500-LoC cap and SPDX header checked directly (every file ≤ 500 LoC; line 1 of every .rs)
  • bash scripts/check-license-headers.sh — not run: it requires Docker, which is unavailable on this host. The same rule was verified directly against .licenserc.yaml instead.
  • Runtime/hardware — N/A: no runtime behaviour changes; nothing here is wired into spark-server.

Scoping the checks to -p atlas-coldsnap is deliberate: the workspace as a whole needs a CUDA host to build.

The 119 tests are possible because the runner seam (CommandRunner) is the only place a process is spawned. Every failure mode below is therefore reachable on a laptop with a scripted fake.

Notes for reviewers

Two things are deliberately left undone, and both are load-bearing.

  1. No request is emitted for an engine other than vllm/sglang. ColdSnap's engineadapter.Lookup registers only those two, and OperationReceipt.Validate independently rejects any other engine — so "engine": "atlas" is structurally invalid, not merely unsupported. The tempting shortcut was to emit engine: "vllm" for an Atlas workload; that would produce a receipt asserting a vLLM engine for a workload that is not vLLM, making lifecycle decisions look evidenced when they are not. The engine type is consequently a closed enum on the request side and a tolerant one on the wire side, so a future engine cannot make an otherwise valid receipt unparseable.

  2. The receipt's request_sha256 is not compared against the digest of the bytes sent. snapshot.RequestSHA256 is sha256(CanonicalJSON(json.Marshal(request))) — over the decoded, default-resolved struct, with recursively sorted keys and Python-style ensure_ascii escaping. It is not a checksum of the submitted bytes, and a byte-level comparison would reject every valid receipt (whitespace, key order, omitted fields resolved to driver defaults, and Unicode escaping all change it while the semantic request is identical). Identity rests instead on the echoed operation_id and operation, which are exactly comparable; the controller digest is retained for audit. PreparedRequest additionally verifies that its serialized bytes actually encode the id and operation it is correlated against, so that check cannot be vacuous.

Outcomes are four-way, not two-way. Success / OperationFailed / Unknown / protocol violation. A timeout or a receiptless nonzero exit is Unknown, never failed: sleep/wake take a fresh id each time, so the controller does not deduplicate them and a retry is a second operation rather than a repeat. UnknownOperation::retry_is_safe() returns false and points the caller at status for reconciliation.

Deferred to a follow-up PR: the spark-server lifecycle surface (a LifecycleEngine seam over ModelHost, plus an opt-in admin endpoint). It is not here because it modifies the live serving path and its "release weights + KV, keep process" behaviour is exactly what cannot be validated off-hardware — it deserves its own review rather than riding along with the adapter crate.

Upstream question, not yet filed: whether ColdSnap intends an Atlas engine adapter at all, or whether the boundary is manager-side coordination with ColdSnap never seeing an atlas engine. The answer determines whether item 1 above is a temporary gap or the permanent shape. Worth resolving before anyone builds toward an adapter that isn't coming.

Peer review: the process-boundary logic was independently reviewed by a second model, which caught a timeout race (a child exiting between the poll and the deadline check was killed and misreported as Unknown(TimedOut)), an unguarded kill(-pid) where a zero pid would have signalled the caller's process group, a missing EINTR retry, a cap-arithmetic overflow, a leaked child on wait error, and the fact that stderr truncation could SIGPIPE a healthy process. All fixed, each with a regression test.

Generated with Devin

A new CUDA-free crate that owns the ColdSnap manager-facing contract and
nothing else: request format 4, receipt format 2, the capabilities document,
argv construction, the single process-I/O seam, and the restore-shaped
derivation of sleep/wake/status. Everything is transcribed from the
controller's Go source (internal/snapshot/schema.go, receipt.go,
internal/cli/capabilities.go) rather than its prose, so field names and
validators match what it actually enforces.

It deliberately does NOT own Atlas lifecycle policy. What "sleep" means for an
Atlas CUDA context — release weights and KV, retain the process — is a
spark-server decision, and a foreign-protocol adapter that also owned it would
invert the dependency and make every lifecycle change a change here. This is
scaffolding for that work, not the work.

Two things are deliberately left undone, and both are load-bearing:

1. No request is emitted for an engine other than vllm/sglang. ColdSnap's
   engineadapter registry has no `atlas` entry and receipt validation rejects
   any other engine, so an atlas request is structurally invalid. Emitting
   engine:"vllm" for an Atlas workload was the tempting shortcut; it would
   produce a receipt that makes lifecycle decisions look evidenced when they
   are not. The engine type is therefore a closed enum on the request side and
   a tolerant one on the wire side.

2. The receipt's request_sha256 is NOT compared against the digest of the bytes
   sent. snapshot.RequestSHA256 is sha256(CanonicalJSON(json.Marshal(request)))
   over the decoded, default-resolved struct — recursively key-sorted,
   Python-escaped, with omitted fields resolved to driver defaults. It is not a
   checksum of the submitted bytes, and a byte-level comparison would reject
   every valid receipt. Identity rests on the echoed operation_id and operation,
   which are exactly comparable; the controller digest is retained for audit.

Outcomes are classified four ways — success, definitive failure, protocol
violation, unknown — because a process boundary disagrees with itself in more
ways than two. A timeout or a receiptless nonzero exit is UNKNOWN, never
failed: sleep/wake take a fresh id each time, so the controller does not
deduplicate them and a retry is a second operation rather than a repeat.

119 tests, none of which need a GPU or the coldsnap binary — the runner seam is
the only place a process is spawned, so every failure mode above is reachable
on a laptop.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Triage (2026-09-26). Recommend closing, or moving this to its own repo.

  • Size and use: +5,341 lines of scaffolding with no Atlas integration and no job behind it.
  • Staleness: no activity since 09-12.
  • CI: cargo test, llvm-cov and the mdBook/rustdoc build all fail.

It's CUDA-free and owns only the foreign protocol, so it works as a standalone crate that Atlas depends on once a placement-manager job exists. That keeps it out of the workspace in the meantime.

@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Closing to cut the open-PR count, per the 2026-09-26 triage (standalone scaffolding with no Atlas integration or job behind it yet). No work is lost: the branch atlas-coldsnap is kept, tag archive/pr-29 pins its head edd466da6, and refs/pull/29/head stays on GitHub. When a placement-manager job exists, reopen this or move the crate to its own repo.

@AzeezIsh AzeezIsh closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant