Skip to content

feat: download nightly images with progress and update them in the background - #36

Merged
insertt merged 4 commits into
feat/tern-panesfrom
feat/nightly-image-download
Dec 2, 2026
Merged

insertt merged 4 commits into
feat/tern-panesfrom
feat/nightly-image-download

Conversation

@insertt

@insertt insertt commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Stacked on #35; the base will move to main once that merges.

feat: download nightly images with progress, update them in the background

sand now downloads a nightly image itself instead of leaving the pull to
sbx create, which showed only the elapsed time: it asks the registry for
the host's build, streams the layers into an OCI archive while checking
each digest, and shows a bar with bytes, percent, speed and time left (in
Tern's native setup too). The archive is loaded with sbx template load
and the sandbox created with --pull never; a build already loaded is not
downloaded again. If sand cannot download or load it, sbx pulls it as
before (--pull always).

Launching no longer asks the registry about newer builds. A session looks
in the background (20s in, then every 3h). nightly_updates decides what
happens when there is one: "ask" (default) offers the download in a card,
"auto" downloads it right away, "off" does not look. Once loaded, a card
asks whether to restart sand on it: the agent is stopped and sand runs
again with the same arguments, recreating the sandbox from the new image
with its mounts, MCP servers and history. The cards are the native
session's own, or sand's card in its Tern pane (system dialog outside Tern)
for the agent's terminal UI; both take custom button labels now.

fix: log what the nightly updater does, and say why loading an image failed

The updater runs unseen and only retried on failure. It now notes each step
(the build found, download, load, the restart question and its answer, any
failure) in update.log in the sandbox's directory, and a failed
sbx template load reports all it printed rather than its last line.


Checked locally on stable Rust: cargo fmt --check, cargo clippy --all-targets --locked (with -D warnings) and cargo test --locked pass.

…round

sand now downloads a nightly image itself instead of leaving the pull to
`sbx create`, which showed only the elapsed time: it asks the registry for
the host's build, streams the layers into an OCI archive while checking
each digest, and shows a bar with bytes, percent, speed and time left (in
Tern's native setup too). The archive is loaded with `sbx template load`
and the sandbox created with `--pull never`; a build already loaded is not
downloaded again. If sand cannot download or load it, sbx pulls it as
before (`--pull always`).

Launching no longer asks the registry about newer builds. A session looks
in the background (20s in, then every 3h). `nightly_updates` decides what
happens when there is one: "ask" (default) offers the download in a card,
"auto" downloads it right away, "off" does not look. Once loaded, a card
asks whether to restart sand on it: the agent is stopped and sand runs
again with the same arguments, recreating the sandbox from the new image
with its mounts, MCP servers and history. The cards are the native
session's own, or sand's card in its Tern pane (system dialog outside Tern)
for the agent's terminal UI; both take custom button labels now.
…failed

The updater runs unseen and only retried on failure. It now notes each step
(the build found, download, load, the restart question and its answer, any
failure) in update.log in the sandbox's directory, and a failed
`sbx template load` reports all it printed rather than its last line.
Path is used only under cfg(unix), so on Windows the import was unused and failed the build under -D warnings.
Switching to a new image forgets the sandbox's record before writing it again; the e2e test read it every 50ms and panicked when it landed in that gap (seen on macOS).
@insertt
insertt force-pushed the feat/nightly-image-download branch from c6135d2 to 5a18488 Compare December 2, 2026 20:30
@insertt
insertt merged commit 81adbe2 into main Dec 2, 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