Skip to content

fix: trust the host's default identity at the publication gate (#330) - #331

Draft
Zaba505 wants to merge 2 commits into
atomicdotdev:devfrom
z5labs:fix/330-hook-publication-trust
Draft

Zaba505 wants to merge 2 commits into
atomicdotdev:devfrom
z5labs:fix/330-hook-publication-trust

Conversation

@Zaba505

@Zaba505 Zaba505 commented Nov 11, 2026 •

Copy link
Copy Markdown

Fixes #330.

Problem

Changes recorded by the agent hooks could not cross any protected publication boundary (atomic git push, atomic push, atomic insert into a shared view, triage promotion):

  1. After SessionEnd: the attestation exists and verifies, but its signer — the user's own default identity — was reported as unknown (not configured).
  2. During the session: the refusal said no same-session attestation and didn't mention that attestations are only written at session end.

Root cause

create_session_attestation signs with the identity store's default identity (load_did_signing_identity → IdentityStore::get_default). But the gate's only implicit trust root was [author] identity in .atomic/config.toml, which atomic init / atomic git import never write. So the key that signs every session attestation was never trusted by the gate.

A related problem: when [author] identity was set, it was often an identity name (atomic org set writes it that way), and the gate compared it verbatim against the signer DID, so it could never match.

Fix

  • PublicationGateConfig::local_identity: the DID of the host's default identity, read with IdentityStore::open_default_existing (no files are created). It is a self-root alongside the repository identity. PublicationGateConfig::signer_trust evaluates both roots through the unchanged GitTrustConfig::evaluate, so revocation still wins. This adds no third-party default (web of trust, delegation chains), so RFC §19 Q4 stays open as before. Rationale: an attestation that verifies under this key was signed with this machine's own secret key. That is the same self-root argument already used for the repository identity.
  • [author] identity resolution: accepts a DID, an identity name, or an identity ID. Names and IDs are resolved to the DID through the repo-local identity store, then the default store. A reference that can't be resolved is kept verbatim (same behaviour as before).
  • Actionable refusals:
    • MissingAttestation now records whether the session ledger is still Active. If it is, the refusal adds: "the session is still active and its attestation is written when the session ends (the agent's SessionEnd hook): end the agent session, then retry".
    • An unknown DID signer's refusal lists the trusted roots and the exact signers = ["did:…"] line to add under [git.trust] in .atomic/config.toml.
    • An unknown session-mac:* signer means no default identity existed when the session ended. That refusal points to atomic identity new <name> --set-default instead of suggesting allowlisting a per-session MAC.
    • Revoked signers get no remedy hint.
  • Docs: docs/shim-operating-guide.md §7 documents the trust roots, the [git.trust] syntax, and when session-end attestation happens.

To answer the issue's questions: trust has always been configurable with [git.trust] signers = [...] in .atomic/config.toml, but nothing told users that. And yes, session attestations are written at SessionEnd by design. This PR changes neither of those; it makes both explicit in the refusals.

How to verify (commit by commit)

The branch is split so the failure can be reproduced first:

Commit Contents Expected
678e14a test: reproduce #330 … 5 CLI integration tests driving the real atomic agent hooks claude-code verbs in a git imported repo (mirrors the issue's script, isolated HOME/ATOMIC_CONFIG_DIR) all 5 fail
8615f40 fix: trust the host's default identity … the fix, 7 new gate unit tests, and docs all pass
git checkout 678e14a
cargo test -p atomic-cli --test it agent_hook_publication_gate_test::   # 0 passed; 5 failed

git checkout 8615f40
cargo test -p atomic-cli --test it agent_hook_publication_gate_test::   # 5 passed
cargo test -p atomic-repository --lib provenance_gate                   # 26 passed

The reproduction tests:

  • hook_recorded_change_is_git_pushable_after_session_end
  • hook_recorded_change_inserts_into_shared_view_after_session_end
  • author_identity_name_is_resolved_as_the_repository_trust_root
  • in_session_refusal_says_attestations_are_written_at_session_end
  • untrusted_signer_refusal_explains_how_to_configure_trust: also checks that following the advice (adding the DID to [git.trust] signers) lets the push through

I also re-ran the issue's original bash script against the fixed binary. The in-session push is still refused, now with the "end the agent session" hint. After session-end, atomic git push --no-push -b feature exits 0, and atomic insert view <draft> lands the change on main.

Testing done

Rebased onto dev at 8053c02. The following was re-run after the rebase:

  • The reproduction tests commit by commit: 678e14a has 0/5 passing, with the same atomic git push provenance gate refuses every change recorded by the agent hooks (no attestation until SessionEnd, then signer "unknown") #330 refusals as before; 8615f40 has 5/5 passing.
  • cargo test -p atomic-config -p atomic-repository --lib: 46 + 1576 passed
  • Gate-related CLI integration modules (insert_promote, push_integration, git_push_cb4b, remote_sandbox_client, provenance_integration, session_integration, git_guard_cb0c, bridge_agent_workflow, git_shim_cb10a, agent_hook_publication_gate): 72 passed
  • cargo clippy -p atomic-config -p atomic-repository -p atomic-cli --tests: no new warnings. The existing warnings, including one that arrived with the new dev, are all in files this PR doesn't touch.

Before the rebase (on 5c31fae), I ran the full cargo test -p atomic-cli --test it suite (651 tests). Everything passed except two crash-injection tests, graph_only_export_cb9b_test::graph_only_export_matrix_from_recorded_graph and git_shim_cb13d_test::crash_during_effect_recovers_without_partial_bytes. Both also fail on unmodified 5c31fae on my machine, because the ATOMIC_FAIL_* failpoint never fires, so they are pre-existing and unrelated.

  • Local note: the diagnostics_integration_test module copies the 2.2 GB debug binary for every test, so full parallelism on a 16 GB tmpfs /tmp runs out of space and OOMs the test binary. Running with --test-threads=8 avoids it.

Not changed, worth a look

  • Which key signs. atomic agent identity set repro+repro-claude reports "recording hooks now sign as it". The change author is the agent identity, but the session attestation is still signed by the store's default (user) identity. This PR trusts the key that actually signs today. Whether attestations should be signed by the delegated agent identity, and the delegator trusted through the delegation, is a policy question I left for you.
  • Git state binding trust (resurrection.rs::evaluate_trust, atomic git binding verify) still compares [author] identity verbatim. It is a separate path that atomic git push provenance gate refuses every change recorded by the agent hooks (no attestation until SessionEnd, then signer "unknown") #330 doesn't cover. resolve_identity_did could be reused there if you want the same name resolution.
  • On a receiving remote (verify-receive), local_identity is the server's own default identity. That gate runs without key providers, so attestations still fail closed as unverifiable before trust is checked. Nothing changes there in practice.

🤖 Generated with Claude Code

Zaba505 and others added 2 commits November 11, 2026 16:59
… provenance gate

Add CLI integration tests that drive the real `atomic agent hooks
claude-code` verbs in a Git-imported repository, mirroring the issue's
reproduction script under an isolated HOME / ATOMIC_CONFIG_DIR:

- after SessionEnd, `atomic git push --no-push` refuses the hook-recorded
  change: its attestation is signed by the user's own default identity,
  which the gate reports as "unknown (not configured)"
- the same refusal blocks `atomic insert view <draft>` into shared main
- an `[author] identity` given by identity name is never matched against
  the signer DID, so naming the repository identity does not help
- the in-session refusal does not say attestations are written at
  session end
- the untrusted-signer refusal does not say how to configure
  `[git.trust]`

All five tests fail on this commit; the following commit fixes them.

Run: cargo test -p atomic-cli --test it agent_hook_publication_gate_test::

Refs atomicdotdev#330

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cdotdev#330)

Session attestations written at SessionEnd are signed with the host's
default identity (`create_session_attestation` ->
`load_did_signing_identity`), but the trusted provenance gate's only
implicit root was `[author] identity` from `.atomic/config.toml`, which
`atomic init` / `atomic git import` never write. Every hook-recorded
change was therefore refused at every protected boundary (`atomic git
push`, `atomic push`, `atomic insert` into a shared view, triage
promotion), with the user's own DID reported as "unknown (not
configured)".

- `PublicationGateConfig` gains `local_identity`: the DID of the host's
  default identity, read without creating the store. It is a self-root
  like the repository identity; `signer_trust` evaluates both through
  `GitTrustConfig::evaluate`, so revocation still wins. No third-party
  default (web of trust, delegation chains) is introduced.
- `[author] identity` may now be an identity name or ID: it is resolved
  to its DID through the repo-local identity store, then the default
  store. Previously a name was compared verbatim against signer DIDs and
  could never match.
- `MissingAttestation` records whether the session is still active; the
  refusal then says attestations are written when the session ends.
- An unknown DID signer's refusal says how to trust it (`[git.trust]
  signers` in `.atomic/config.toml`); an unknown `session-mac:*` signer's
  refusal says to create a default identity instead.
- Document the trust roots and the session-end timing in
  docs/shim-operating-guide.md.

Fixes atomicdotdev#330

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Zaba505
Zaba505 force-pushed the fix/330-hook-publication-trust branch from b3cd7a5 to 8615f40 Compare November 11, 2026 22:07
@Zaba505
Zaba505 marked this pull request as draft November 12, 2026 03:58
@Zaba505

Zaba505 commented Nov 12, 2026

Copy link
Copy Markdown
Author

@geekgonecrazy I've reverted this to a draft because I realized that manually setting my DID in config.toml gets passed the failure. I'm now working to see if I can get atomic git push to work from my local before proposing a solution

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.

atomic git push provenance gate refuses every change recorded by the agent hooks (no attestation until SessionEnd, then signer "unknown")

1 participant