agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

[Bug]: Windows: claude-code trust pre-seed writes backslash path keys in .claude.json, but Claude Code only reads forward-slash keys — trust dialog blocks every session (no_signal)

Open faogomes opened this issue 4 months ago • 1 comments

Summary

On Windows, AO pre-seeds Claude Code workspace trust by writing projects["<worktree>"].hasTrustDialogAccepted = true into %USERPROFILE%\.claude.json — but it writes the path key with backslashes ("D:\\...\\worktrees\\<project>\\<session>"). Claude Code keys the same map with forward slashes ("D:/.../worktrees/<project>/<session>") and its trust lookup only ever matches forward-slash keys. The keys never match, so the pre-seeded flag is never read. Claude Code then renders the interactive workspace-trust dialog inside AO's ConPTY and waits for a keypress forever.

Consequence chain: agent never starts → no hook (ao hooks claude-code <event>) ever fires → sessions.first_signal_at stays NULL → AO reports no_signal for every claude-code session.

This looks like the Windows follow-up to #2119: the pre-seeding approach adopted there is defeated on Windows by the path-separator mismatch.

Steps to reproduce

  1. Windows, AO 0.11.2, claude resolving to the native claude.exe on the daemon's PATH.
  2. ao project add --path <repo> --id demo --name Demo --worker-agent claude-code
    ao spawn --project demo --harness claude-code --name demo --prompt "Create src/demo.txt containing exactly DEMO OK."
    ao session ls --json    # idle → no_signal after ~90 s, no file created
    
  3. Inspect %USERPROFILE%\.claude.json: AO's entry for the worktree uses backslashes; every entry written by Claude Code itself uses forward slashes.

To see why it hangs, run AO's exact agent argv under a PTY (e.g. winpty from Git for Windows) and read the screen:

 Accessing workspace:
 D:\...\worktrees\<project>\<session>
 Quick safety check: Is this a project you created or one you trust? ...
 > 1. Yes, I trust this folder
   2. No, exit
 Enter to confirm · Esc to cancel

Expected behavior

The trust key AO writes is the one Claude Code actually reads; worker sessions start unattended on Windows.

Actual behavior

AO writes:

"projects": {
  "D:\\...\\worktrees\\<project>\\<session>": { "hasTrustDialogAccepted": true }
}

Claude Code reads/writes its own entries in the same file as:

"D:/.../repo": { "hasTrustDialogAccepted": false }

Keys never match → blocked interactive prompt → no_signal.

Proof by inversion: adding the same trust entry keyed with forward slashes, changing nothing else, removes the dialog; the session reaches activity (POST /api/v1/sessions/<id>/activity status=200), creates the requested file, and kills cleanly.

AO version

0.11.2 (desktop app; bundled daemon resources\daemon\ao.exe)

Environment

Windows 10 Pro (10.0.19045) x64; ConPTY runtime; native claude.exe (not the npm .cmd shim)

Logs / extra context

  • Claude Code's trust check walks up the directory tree (any ancestor with hasTrustDialogAccepted: true passes). Operational workaround until fixed: trust %USERPROFILE%\.ao\data\worktrees once, interactively — it covers every future worktree AO creates beneath it, with no per-session prediction. Per-session pre-seeding with forward-slash keys, and answering the dialog via ao send --session <id> --message "1", both also work but are per-session only (Claude Code does not persist the dialog answer for AO-created worktrees, and each session gets a fresh path).
  • Suggested fix: write the projects key in the format Claude Code reads on Windows (forward slashes).
  • Side note: CLAUDE_CONFIG_DIR appears to be unknown to AO (no occurrences in the binary) — trust is always written to %USERPROFILE%\.claude.json regardless of that variable.
  • Downstream effect: the blocked process holds the worktree directory as its cwd, so ao session kill fails post-kill cleanup with INTERNAL_ERROR (filing separately).
  • Duplicate search: #2119 (macOS, the pre-seed request this defect follows from), #1396, #3110 — none cover the Windows path-separator mismatch.

faogomes avatar Jul 31 '26 19:07 faogomes

Thanks for contributing to Agent Orchestrator.

This issue is being picked up by the current external contributor on-call pair:

  • @illegalcall
  • @pulkit7070

If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @pulkit7070 here.

For faster context or live questions, you can also join the AO Discord.

Join the session here: https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

somewherelostt avatar Aug 01 '26 15:08 somewherelostt