Repository navigation
The publication gate can trust a sandbox's session: attestations arrive, verify, and survive resumed rounds - #298
Merged
Merged
Conversation
CB-12B's publication gate fails every managed change from a remote sandbox with MissingAttestation: the sandbox's agent signs a session-end attestation into its own cache, and the session state file carrying the MAC key never leaves the VM — so the owner's gate has no attestation to find and no key to verify one under. SubmitAttestation is the missing transport. A sandbox submits the attestation's own serialized bytes (ATST + postcard, schema "atomic.attestation.v1" — what it saved is exactly what the owner loads, same hash both sides) plus the session state file its MAC signature verifies under. The owner saves the attestation in its graph and files the session state under .atomic/sessions/<id>.json — the gate's own lookup path, sanitized with the same safe_session_id, and only when the state carries a non-empty mac_key. Guards mirror PublishProvenance: attestation.write capability, own-session ownership, revalidation, the exclusive gate, and a malformed attestation is a domain refusal that writes nothing. The agent submits at session end (and on a fully-idle Stop) whenever it runs in a remote sandbox, failing the session end closed on transport failure — an unattested session is exactly what this prevents. A DID-signed attestation rides without a MAC key: the host may resolve DID keys later; signature policy is not the transport's to decide. The default sandbox grant grows attestation.write; SubmitChange/ PublishProvenance are unchanged.
Agent VMs sign attestations with Ed25519 DID signatures when ATOMIC_AGENT_IDENTITY is set, but the publication gate only verified session-MAC signatures, so every DID-signed attestation was refused with AttestationNotVerifying on the serving host. - Add a DidKeyProvider callback (signer DID -> Ed25519 public key) alongside MacKeyProvider, threaded through evaluate_publication_gate and enforce_publication_gate; all callers updated. - Select verification by signature class in the gate: MAC-signed attestations use the session MAC key as before, DID-signed attestations resolve the signer's public key through the new provider (cached per signer) and verify with verify_with_did; a missing key is AttestationUnverifiable (fail closed), a wrong key is AttestationNotVerifying. Unsigned historical V1/V2 unchanged. - Add local_did_key_provider resolving a signer through the host's default identity store (by name, then by DID over all identities, accepting did:atomic and did:key renderings), mirroring resolve_author_for. Read-only; no repo write lock. Wired into the host-side callers (shared-view insertion, triage promotion, revise, triage report, pre-push hook, Git ref export, Atomic push); the receiving boundary (verify_receive) passes None for both providers. - Trust semantics unchanged and policy-only: a DID signer satisfies the gate only when listed in [git.trust] signers or equal to the repository identity. No default trust invented. - Tests: DID-signed attestation passes with provider key and trusted signer; no key -> unverifiable (with and without a provider); wrong key -> not verifying; verifying but unlisted signer -> untrusted. MAC path tests stay green unchanged.
… store first The publication gate's local_did_key_provider resolved signer DIDs only through the serving host's global store (~/.atomic/identities), so an attestation signed by a delegated agent identity — which lives in the project clone it worked in, not the serving account's global store — never resolved: AttestationUnverifiable, fail closed, every promote. The provider is repo-aware now: IdentityStore::open_existing on <dot_dir>/identities first (existing-only, so resolution never creates files), falling back to open_default. Resolution rules unchanged: name lookup, then a scan matching did_matches_public_key in both did:atomic and did:key renderings. A host that writes the agent identity into the clone (beside its [git.trust] signers entry) makes the gate self-sufficient on the receiving side too.
A managed expedition runs every dispatch and resume of the same
expedition id as ONE Atomic session, but each round starts a fresh
sandbox VM: the session JSON inside the previous VM dies with it, and a
session-start in the new VM created a session at zero turns with no
recorded changes. The durable history survived — in the repository
owner's session ledger and provenance journal — but nothing read it back:
- the resumed round numbered its turn like the previous round's, so its
checkpoint reservation hit the previous round's completed journal turn
and the owner refused it ("Provenance turn 1 is not running"), the
turn-end hook failed BEFORE its session save, and the round's recorded
change hashes were lost — its session-end then had nothing left to
attest, and the publication gate refused the promote with
MissingProvenanceRoot + MissingAttestation;
- the round's checkpoint could not chain its graph to the session's
previous provenance (a remote sandbox's ledger read sees only its
cache, which holds no turns), so the owner refused the append
("turn N is not an append").
A freshly created session now hydrates from the durable history before
anything else runs (session-start and the turn hooks' fallback
creation):
- the journal sink — whose provenance RPCs reach the owner's store even
from a remote sandbox — is probed upward from the local count while
the session's turns exist; each answered turn advances turn_count and
contributes its checkpoint's change hashes;
- the repository's own session ledger supplies the same where it is
local (the authoritative record for a same-machine resume).
The checkpoint path derives its previous-provenance chain link the same
way when the ledger read yields none: from the durable journal's latest
published turn. GetTurn's wire form already carries both the
checkpoint source's change hashes and the turn's final graph hash;
JournalTurnStatus now surfaces them (both sink implementations).
Tests: the orchestrator test seeds a round-1 ledger turn, attestation
and change, then drives a fresh-local-state session through a resumed
round — pinned: turn_count adoption, recorded-hash adoption, and a
round-2 attestation that covers only the new change and chains to
round 1's. The remote-sandbox e2e runs two full dispatches in two
sandboxes on one session id — pinned: both rounds publish ledger turns,
the round-2 change carries its provenance root, and a same-session
attestation covering the round-2 change verifies where the owner's gate
reads (a resumed sandbox cannot see the owner's earlier attestations,
so its incremental attestation degrades to covering the session's whole
hydrated history — harmless to the gate).
geekgonecrazy
force-pushed
the
feat/submit-attestation
branch
from
October 28, 2026 18:07
43c5738 to
c0fe1d6
Compare
graywolf336
approved these changes
Oct 28, 2026
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.
The 0.20.0 publication gate (CB-12B) demands, per managed-session change: a session envelope, a registered provenance root, a complete session ledger, and a same-session attestation that verifies under a trusted signer. For remote sandboxes — agent VMs — none of that could reach the serving host, so every expedition-recorded change blocked the gate. Four fixes, each verified by a full run of outpost's checkout demo against this branch:
SubmitAttestation(SandboxService) — the missing transportSession-end attestations were written into the sandbox's cache and died with the VM. They now ride to the owner: the ATST-format attestation bytes (the change store's own serialization, so the hash the guest computes is the hash the host loads) plus the session JSON carrying
mac_key— written to the owner's.atomic/sessions/with the same sanitization the gate's key provider reads. The guest'screate_session_attestationsubmits when in a remote sandbox and fails closed on transport loss. Guards mirrorpublish_provenance:owns_session,revalidate,attestation.writecapability; malformed input is a domain refusal writing nothing.Gate: DID-signed attestations verify
Agent VMs sign attestations with their delegated identity (
ATOMIC_AGENT_IDENTITY), but the gate only ever ranverify_mac. NewDidKeyProvider: per-signer Ed25519 key resolution,verify_with_didfor DID-signed attestations (MAC path unchanged), keys resolved through the repository-local identity store first (the host's clone carries the agents outpost installs) with the global store as fallback. Trust stays policy-only — no new trust default; the host configures[git.trust] signers.Resumed sessions adopt their durable ledger
A managed expedition reuses one session id across rounds, but each round is a fresh VM — the session JSON (turn count, recorded hashes) died with the first round, so round 2 numbered its turn into round 1's
Completedjournal slot and the reservation failed before the session save: the round-2 change lost both its provenance graph and its attestation. Session-start now hydrates turn count and recorded change hashes from the durable journal/ledger; the checkpoint's chain link derives from the journal when the local cache holds no turns.What a resumed attestation covers
The resumed round's sandbox re-attests the session's hydrated history (it cannot see the owner's earlier attestations) — same session, so semantically true; chained to round 1's via
previous_attestation. The unit test pins the host-local ideal (only new changes, chained); the e2e pins what remote sandboxes can honestly do.Verified
cargo test: atomic-agent 1411, atomic-repository 1681, libmatic tests 69,remote_sandbox_client_test7 (incl. a two-sandbox resume e2e reproducing the pre-fix journal collision, and attestation-reaches-owner).-D warnings; fmt clean on touched files.ready, promote lands.