Repository navigation
Add an opaque-archive store contract for remote session state - #444
Open
Kevin Kitts (kittskevin) wants to merge 2 commits into
Open
Kevin Kitts (kittskevin) wants to merge 2 commits into
Kevin Kitts (kittskevin) wants to merge 2 commits into
Conversation
This was referenced Dec 2, 2026
The stores keep a compute host's compressed archive as opaque bytes under its own object names (S.sandbox.bin, S.e<N>.sandbox.bin) so a worker without this contract never sees or unpacks it, and the local tar commit and hydrate refuse an object carrying the opaque marker. Same conditional store-wins CAS (version chain, idempotent turn key, expectedEtag pinning the exact head), 16 MiB cap, SHA-256 over the bytes. The turn record is written first, create-only and scoped by the turn key, and the head stamps its digest; superseded records are cleaned up and deleted with the chain. Large results are stored as a bounded compact record. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…and deletes, opaque purge
- Turn records are content-addressed (<prefix>.turn-commit.<turn32>.<sha256(record)>.json), create-only
and never replaced; readers read exactly the name the head stamps. Superseded records are removed by
exact name; a blob commit that loses (conflict, alreadyCommitted with another record, retries
exhausted) removes its own record unless the latest head stamps it.
- Filesystem: probe, trusted-record read and the opaque part of delete/deleteAllEpochs run under the CAS
lock; delete unlinks metas first. A damaged meta (bad JSON, foreign binFile, bad digest or codec) is
ARCHIVE_CORRUPT; the opaque marker is kept on a versionless tar head.
- Opaque session ids are [A-Za-z0-9_-]{1,128}, epochs undefined or non-negative safe integers, turn keys
printable ASCII, and base > 0 requires expectedEtag; all refused before any storage access. The name
parser accepts only canonical names and each store deletes only its own kinds.
- Blob: single-epoch delete removes the head, then sweeps records best-effort; the first-commit-across-
delete window is documented and left to the purge; readSnapshotArchive destroys the stream on every
throw; an unknown codec is ARCHIVE_CORRUPT.
- resourcemgr purge and stats recognise opaque heads and turn records via parseOpaqueObjectName.
- The validated turn result is a detached copy; fitTurnCommit never throws; the snapshot contract types
are exported; the opaque suite is baselineOnly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
waldemort-auto
Bot
force-pushed
the
waldemort/m1-pr1-compute-abstraction
branch
from
December 2, 2026 07:21
903ae7b to
5be6099
Compare
waldemort-auto
Bot
force-pushed
the
waldemort/m1-pr2-opaque-archive-store
branch
from
December 2, 2026 07:21
02bb72b to
7851de6
Compare
This branch has not been deployed
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
02bb72b98eff6fb260923dc808ab92115587c1edsnapshot-opaque-archive.test.jscovers bothFilesystemSessionStoreandSessionBlobStoreacross conditional store-wins CAS,expectedEtagpinning, SHA-256 verification, the 16 MiB cap, create-only turn records, and mixed-fleet representation guards.↓ Hosted PR checks on this branch run once the pull request is opened, and live Azure Blob Storage fault-injection is not run in PR CI.
Summary
Adds the opaque-archive store contract to
VersionedSnapshotStore(FilesystemSessionStoreandSessionBlobStore) so a worker can persist and read a remote sandbox's compressed state archive as opaque bytes without ever unpacking, listing, or interpreting remote files on the worker filesystem.The archive chain lives under its own object names (
<session>.sandbox.binand<session>.e<N>.sandbox.bin) and carries an explicit opaque marker (psopaque = "1"). A worker running an older release never reads those names, and the local.tar.gzcommit and hydrate paths refuse any object with the opaque marker (ARCHIVE_REPRESENTATION_CONFLICT).Nothing calls these store methods yet; #445 wires
statePolicy: "store-owned"to them.Design record:
docs/proposals/remote-compute-targets.md§8.2 in #443.Stack
main)waldemort/m1-pr1-compute-abstraction)waldemort/m1-pr2-opaque-archive-store)What changes
snapshot-protocol.ts): addsprobeSnapshotArchive,commitSnapshotArchive,readSnapshotArchive, andreadTrustedTurnCommittoVersionedSnapshotStore, plusOpaqueArchiveError, object-name parsers, input validation,REMOTE_SNAPSHOT_ARCHIVE_MAX_BYTES(16 MiB), andREMOTE_TURN_COMMIT_MAX_BYTES(64 KiB).session-store.ts,blob-store.ts): commits versionbaseVersion + 1only when the head is still atbaseVersionand matchesexpectedEtag(ETag in blob store, content hash in filesystem store). A repeat commit with the sameturnKeyatbaseVersion + 1resolves idempotently; anything else raisesSnapshotConflictError.ARCHIVE_TOO_LARGE), hashed with SHA-256 on write, and re-verified on read (ARCHIVE_CORRUPT). Codecs (gziporbrotli) are declared, never sniffed.{ turnKey, result }is written create-only before the head object, keyed by a hash ofturnKey. The head stamps the record's suffix and SHA-256 (psrec,psrecsha), andreadTrustedTurnCommittrusts a record only when stamped by the current head. Large results are bounded byfitTurnCommit(64 KiB cap, droppingeventsor markingtruncated). Superseded records are cleaned up after the head advances.assertLocalArchiveHeadrefuses local tar hydrate/commit whenopaqueis set;deleteanddeleteAllEpochsalso remove the opaque chain and its turn records using fail-closed name parsing.Compatibility
.tar.gzsnapshot commit, hydrate, and deletion behavior is unchanged.Tests
Adds
packages/sdk/test/local/snapshot-opaque-archive.test.jsandpackages/sdk/test/helpers/fake-container-client.js, testing bothFilesystemSessionStoreandSessionBlobStore:expectedEtagpinning, idempotentturnKeyretry, andSnapshotConflictErroron stale base or recreated head.fitTurnCommittruncation over 64 KiB.ARCHIVE_REPRESENTATION_CONFLICT) and epoch deletion cleanup.Not in this PR
Turn execution for
statePolicy: "store-owned"(#445).