Skip to content

atelet: verify microvm SandboxConfig assets before writing sandbox-runtimes.json - #3143

Merged
Dmitry Berkovich (dberkov) merged 3 commits into
agent-substrate:mainfrom
shrutiyam-glitch:atelet-bug
Oct 24, 2026
Merged

Dmitry Berkovich (dberkov) merged 3 commits into
agent-substrate:mainfrom
shrutiyam-glitch:atelet-bug

Conversation

@shrutiyam-glitch

@shrutiyam-glitch Shrutiya Mohan (shrutiyam-glitch) commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3139

On microVM, workerSandboxSyncer.versionAttrs only probed /proc/cpuinfo and wrote sandbox-runtimes.json without checking whether a version's assets could be fetched and verified. A SandboxConfig rollout with a broken asset URL or SHA256 on defaultVersion overwrote sandbox-runtimes.json right away, and workers advertised a defaultRuntime that failed at Run or Restore.

Stage each microVM version's assets through ensureSandboxAssets into a scratch directory in buildFile (with probeFetchTimeout raised to 10m) and record verified bundle hashes in workerSandboxSyncer.microvmAssets. Always stage the default version (a cache hit once prewarmed) so promoting an evicted version to defaultVersion verifies it before unpinning the previous default. Skip ensureMicroVMAssets for restorable versions already in microvmAssets; the memo is per atelet process, so a restart re-checks each version (re-downloading any restorable version evicted before the restart).

A failed defaultVersion fetch or SHA256 check fails buildFile before s.write runs, while a failed restorable version is left out with errIncomplete and retried. As with gVisor, a SHA256 mismatch is not cached or memoized, so retries re-download until the SandboxConfig is fixed. Update docs/sandbox-asset-cache.md and the prewarmer comments to match.

AI-assisted, I reviewed and tested it.

  • Tests pass
  • Docs updated

@shrutiyam-glitch
Shrutiya Mohan (shrutiyam-glitch) marked this pull request as ready for review October 23, 2026 00:44
@shrutiyam-glitch Shrutiya Mohan (shrutiyam-glitch) changed the title atelet: verify microvm SandboxConfig assets before writing sandbox-ru… atelet: verify microvm SandboxConfig assets before writing sandbox-runtimes.json Oct 23, 2026
Comment thread cmd/atelet/worker_sandbox_versions.go Resolved
Comment thread cmd/atelet/worker_sandbox_versions.go Resolved
…ntimes.json

On microvm, workerSandboxSyncer.versionAttrs only probed /proc/cpuinfo
and wrote sandbox-runtimes.json without checking whether a version's
assets could be fetched and verified. A broken defaultVersion URL or
SHA256 overwrote sandbox-runtimes.json right away, causing workers to
advertise a defaultRuntime that failed at Run or Restore.
Stage each microvm version's assets through ensureSandboxAssets into a
scratch directory during versionAttrs, matching gvisor. Cached assets
only link and unlink in scratch. A failed defaultVersion leaves the
existing file in place, and a failed restorable version is omitted with
errIncomplete while finish retries with backoff.
Remember verified microVM bundle hashes in workerSandboxSyncer.microvmAssets, matching cpuFeatures for gVisor. Without memoization, every sync re-stages each version into scratchDir, and once sandboxAssetCache evicts an unlinked restorable version a new worker pod has to download it again and a transient fetch failure on re-sync drops it from sandbox-runtimes.json.

Update docs/sandbox-asset-cache.md and the prewarm and scratch-dir comments to match buildFile fetching each version's assets on first check.
Comment thread cmd/atelet/worker_sandbox_versions.go Resolved
Comment thread cmd/atelet/worker_sandbox_syncer.go Resolved
Comment thread cmd/atelet/worker_sandbox_versions.go Resolved
Comment thread docs/sandbox-asset-cache.md Resolved
Comment thread docs/sandbox-asset-cache.md Resolved
Memoizing every verified microVM bundle hash skips ensureMicroVMAssets when an evicted restorable version is promoted to defaultVersion. If the asset bucket is failing, syncPod writes the new default anyway and removes the previous default's directory.
Only skip ensureMicroVMAssets on the in-memory memo for restorable versions, and stage the default version on every sync (a cache hit once prewarmed). Raise probeFetchTimeout to 10m to cover all assets of a cold microVM version under --sandbox-asset-fetch-timeout, and document the per-process memo behavior across restarts and eviction in docs/sandbox-asset-cache.md.
@dberkov
Dmitry Berkovich (dberkov) added this pull request to the merge queue Oct 24, 2026
Merged via the queue into agent-substrate:main with commit 93ec720 Oct 24, 2026
16 checks passed
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.

[Bug]atelet: microvm SandboxConfig promotes unverified defaultVersion to sandbox-runtimes.json

3 participants