Session worktrees are untrusted, so Claude Code workers stop at the trust dialog and the allowlist never applies
Summary
Every AO session gets a fresh git worktree. Claude Code has never been trusted
in that brand-new directory, so the worker opens the interactive trust dialog
instead of starting work. No, exit is the pre-selected option and no human is
attached to the tmux pane, so the session stalls or exits. The permissions in
.claude/settings.local.json never apply.
From the outside this looks like a permissions bug. It is a trust bug, and the distinction cost us three sessions.
Environment
- AO v0.12.10, Linux x64, running headless under systemd with Xvfb.
- Claude Code 2.1.258 in the guest; 2.1.260 on the machine the probe ran on.
- Ubuntu 24.04 guest.
Why it happens
AO runs agents through its bundled tmux
(~/.ao/runtime/tmux/0.12.10-linux-x64/tmux), so the worker gets a real PTY
and Claude Code starts in interactive mode. Interactive mode enforces
workspace trust. Print mode (-p) skips the trust check entirely, which is why
this is easy to miss when testing by hand with claude -p.
The worktree layout:
~/.ao/data/worktrees/sandbox/sandbox-12/.git
-> gitdir: /home/rose/sandbox/.git/worktrees/sandbox-12
~/.ao/data/worktrees/sandbox/sandbox-12 is new on every session, so it is
never in ~/.claude.json's projects map.
Reproduction
Independent of AO — a fresh repository and a real linked worktree:
git init probe-repo
cd probe-repo && git commit --allow-empty -m init
git worktree add ../probe-wt
mkdir -p ../probe-wt/.claude
cat > ../probe-wt/.claude/settings.local.json <<'JSON'
{"permissions":{"allow":["Bash(touch:*)"],"deny":[],"defaultMode":"default"}}
JSON
cd ../probe-wt && claude --setting-sources=user,project,local
With neither the worktree nor its parent repository trusted, the session opens with:
Quick safety check: Is this a project you created or one you trust?
⚠ This folder pre-approves 1 tool permission in .claude/settings.local.json:
Bash(touch:*)
These will apply without asking. Only proceed if you trust this configuration.
❯ No, exit
Yes, I trust this folder
Vary the trust state in ~/.claude.json and re-run:
| Trusted path | Result |
|---|---|
| nothing | blocked at the dialog above |
| the worktree itself | starts normally |
the worktree's git-common-dir repository |
starts normally |
Either path satisfies the gate on its own.
Suggested fix
When AO creates a session worktree, mark that worktree trusted for Claude Code
— set projects["<worktree path>"].hasTrustDialogAccepted = true in
~/.claude.json (honouring CLAUDE_CONFIG_DIR where set). AO created the
directory and chose its contents, so it is in a position to vouch for it.
Trusting the git-common-dir repository instead also works and covers every
future worktree cut from it, but it grants trust to a directory outside the one
AO made, so the worktree-scoped version seems the better default.
Second, smaller point
Whatever the resolution, the reason is currently invisible. The dialog text is clear and specific, but it exists only on the PTY — we could not find it surfaced in AO's UI, its API, or its database. A worker that stops for this reason reports nothing that distinguishes it from a worker that hit a genuine permission denial. Surfacing the stall reason would have saved most of the time this took to isolate, independently of the fix above.
(We did not read AO's source for this; the observation is from the outside.)
Correction from the reporter — I got the scope of this wrong, and the headline claim above is not right as written.
I kept measuring after filing. The default worker path is not affected, and I should not have said it was.
What I had wrong
I inferred from AO shipping its own tmux that workers get a PTY and therefore run Claude Code interactively. That inference was wrong. A live worker's /proc/<pid>/cmdline on v0.12.10 is:
claude --output-format stream-json --verbose --input-format stream-json
--permission-prompt-tool stdio --resume=<uuid> --tools default
--setting-sources=user,project,local --permission-mode default
--allow-dangerously-skip-permissions
--include-partial-messages --replay-user-messages
That is a child of the ACP adapter (@agentclientprotocol/claude-agent-acp), with stdout on a pipe. It is non-interactive, so Claude Code skips the trust check completely.
I re-ran the probe with those exact flags in a fresh repository's linked worktree with nothing trusted:
| Allowlist in the worktree | Result |
|---|---|
Bash(touch:*) present |
allowed, 0 denials |
| removed | denied, 1 denial |
The second row is the control, so the first is not a probe that simply cannot fail. On defaultSessionMode: chat the allowlist reaches the worker and trust is never consulted.
What still stands
The trust gate itself is real and does block, but only on a terminal. In the same worktree, interactively:
| Trusted path | Result |
|---|---|
| nothing | blocked at the trust dialog, No, exit pre-selected |
| the worktree itself | starts normally |
the git-common-dir repository |
starts normally |
Also worth correcting from my original text: trust is not keyed only to the common-dir repository. Trusting the worktree's own path satisfies the gate on its own, which makes the worktree-scoped fix straightforwardly available.
strings on resources/daemon/ao shows tmux being driven directly — new-session, send-keys, #{pane_pid}, has-session — next to ao-reviewer and auto_review. A tmux pane is a PTY, so the automatic reviewer and tui session mode look like they would hit this. I have not exercised either, so please treat that as the open question rather than as a reported failure.
Suggested disposition
Narrow this to the terminal paths, or close it if the reviewer and tui already trust the worktree they create. If it stays open, the fix is unchanged: mark the session worktree trusted when AO creates it (projects["<worktree path>"].hasTrustDialogAccepted = true, honouring CLAUDE_CONFIG_DIR).
Sorry for the noise on the original framing.