Repository navigation
feat: spawn upgrade-spored — in-place, state-preserving spored upgrade (#234) - #240
Merged
Merged
Conversation
#234) Replace spored on a running instance without terminate/relaunch and without losing its lifecycle state. spawn upgrade-spored <instance> [--version X] [--force] - Over SSM (keyless — works on private-subnet / no-public-IP GPU & Capacity-Block hosts). Downloads the VERSIONED, checksum-verified spored artifact, swaps it atomically (rename over the busy binary, no ETXTBSY), restarts the daemon, and health-checks that it came back up on the target version — rolling back to the prior binary if not. - Default target is the latest release (spored is versioned in lockstep with spawn); --version pins; a downgrade is refused without --force. - State preservation: the TTL deadline, compute-seconds, and completion/pre-stop/ idle/FSx config live in EC2 tags the new spored re-reads on boot, so the death clock and compute clock continue across the swap (TTL deadline is absolute & tag-stored — mid-life instances keep their original termination time). - Linux only for now (Windows is a follow-up). Also: - spawn status flags when a newer spored is available (offline-tolerant). - spored writes its version to the spawn:spored-version tag on boot, so status / upgrade can read it without an exec (#232/#234). - FIX: a graceful spored shutdown now flushes compute-seconds before exiting. The tag was only written every 1–5 min, so stopping the daemon (incl. an upgrade) could discard up to ~5 min of compute time; agent.Cleanup now persists the current total so the next start resumes the compute clock. - release.yaml uploads the .sha256 to the versioned spored S3 path so a pinned --version download can be checksum-verified. Tests: script generation, semver compare/downgrade refusal, status version parse, compute-seconds base carry-over. Tier 0 coverage gate updated. Closes #234.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #234. Builds on #232 (status shows the running spored version). Two gaps remained: you couldn't tell an upgrade was available, and the only way to get newer spored onto a box was terminate + relaunch — disruptive for long-lived/expensive GPU & Capacity-Block instances, and it loses any un-checkpointed state.
What it does
ETXTBSY, mirroringpkg/launcher/bootstrap.go), restarts the daemon, and health-checks that it came back up on the target version — rolling back to the prior binary if not.--versionpins; a downgrade is refused without--force.Also in this PR
spawn statusflags "spored upgrade available: vX → vY — run 'spawn upgrade-spored …'", best-effort and offline-tolerant (no network → just shows the running version).spawn:spored-versiontag on boot, so status / upgrade read it without execing in, and an upgrade can confirm the new binary took effect (spawn status should show the spored version running on the instance #232/Upgrade spored on a live instance in place (show latest available +spawn upgrade-spored), preserving state #234).agent.Cleanupnow persists the current total so the next start resumes the compute clock without losing the tail.release.yamluploads the.sha256to the versioned spored S3 path (spawn/versions/<v>/…) so a pinned--versiondownload can be checksum-verified (only the floating "latest" path had one before).Tests
buildSporedUpgradeScript(versioned path, regional+fallback, atomic mv, stop/start, health-check+rollback, checksum, fail-fast),compareVersions(incl. downgrade/pre-release/short-version),parseSporedVersion, and the compute-seconds base carry-over invariant. Tier 0 coverage gate updated to classifyupgrade-spored.make checkgreen.Refs
#232 (running version), #76 (authenticity key — a future gate on the upgrade), #77 (Windows upgrade follow-up), lifecycle invariant (an upgrade must not extend or reset the TTL).