Repository navigation
fix(agent): fire recording hooks inside sandboxes - #98
Merged
Merged
Conversation
geekgonecrazy
force-pushed
the
fix/agent-enable-sandbox-guard
branch
from
July 1, 2026 00:35
6dd9ad0 to
3d65f29
Compare
Installed agent hooks were guarded with `test -d .atomic && … || true`.
An agent sandbox working tree has no `.atomic/` of its own — only a
`.atomic-sandbox` pointer to the canonical graph — so the guard was
always false there and every turn's provenance was silently dropped.
Widen the guard to fire when either marker is present:
test -d .atomic || test -f .atomic-sandbox && … || true
POSIX `&&`/`||` are equal-precedence and left-associative, so this
parses as `(((test -d .atomic || test -f .atomic-sandbox) && …) || true)`
— the recorder runs when either marker exists, and a recorder failure is
still swallowed so the agent turn is never blocked. `atomic agent hooks`
already resolves the sandbox pointer and records into the canonical graph.
Centralize the guard in `hooks::guarded_hook_command` so claude-code,
gemini-cli, and codex share one definition, and update the manifest doc
example. Hook detection is substring-based, so already-installed legacy
hooks are still recognized for `is_installed`/uninstall/--force.
geekgonecrazy
force-pushed
the
fix/agent-enable-sandbox-guard
branch
from
July 1, 2026 00:51
3d65f29 to
33f71fe
Compare
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.
Problem
atomic agent enableinstalls recording hooks guarded with:An agent sandbox working tree (
atomic sandbox create) has no.atomic/directory of its own — it carries only a.atomic-sandboxpointer file to the canonical graph. So inside a sandbox the guard is always false, the recorder never runs, and every turn's provenance is silently dropped.Fix
Widen the guard to fire when either marker is present:
POSIX
&&/||are equal-precedence and left-associative, so this parses as(((test -d .atomic || test -f .atomic-sandbox) && CMD) || true):.atomic-sandboxpointer only (sandbox).atomic/dir only (canonical checkout)atomic agent hooksalready resolves the sandbox pointer viaRepository::openand records into the canonical graph, so nothing else needs to change on the runtime side.Details
hooks::guarded_hook_commandso claude-code, gemini-cli, and codex share one definition (previously duplicated as literals /format!calls in each adapter). The sandbox-pointer filename comes fromatomic_repository::SANDBOX_POINTER.is_installed,is_atomic_hook, uninstall) is substring-based on theatomic agent hooks <agent>prefix, so already-installed legacy hooks are still recognized for status/uninstall/--forcereinstall.is_atomic_hooktests to cover the new format.Testing
cargo test -p atomic-agent hooks::— 414 passedcargo test -p atomic-cli agent— 59 passed