Daemon identity-mismatch error (two concurrent checkouts) is silently swallowed by generic 'AO daemon is not ready'
Bug
When two Electron dev instances of AO run concurrently against the same ~/.ao data dir (e.g. one from a git worktree checkout, one from the main checkout), the second instance's daemon-attach logic correctly detects a checkout-identity mismatch and computes a specific, actionable error message. That message never reaches the user — every subsequent API call instead shows the generic, unhelpful "AO daemon is not ready." toast/error, with no indication of the real cause (another checkout already owns the daemon) or how to fix it (stop the other instance).
Analyzed against: 863853e3 (origin/main)
Confidence: High — traced the exact code path end to end, see below.
Reproduction
- Check out this repo twice (e.g. main checkout + a worktree/second clone), both resolving to the same
~/.ao(noAO_DATA_DIRoverride). - Run
npm run devinfrontend/in the first checkout. It spawns and owns the daemon (~/.ao/running.jsonrecords"owner": "app"). - Run
npm run devinfrontend/in the second checkout while the first is still open. - The second instance's UI never explains why it can't connect — any action that hits the API surfaces only
"AO daemon is not ready."
Root Cause
daemonIdentityError()infrontend/src/main.ts:390-403builds a specific message, e.g. "Another AO daemon is already running from<path>; expected this checkout at<path>."readinessStatus()infrontend/src/shared/daemon-attach.ts(~line 153-162) wraps this intodaemonStatus = { state: "error", message: <specific text> }.- This is sent to the renderer via
mainWindow?.webContents.send("daemon:status", daemonStatus)(main.ts:171-172) — so the message does leave the main process correctly. - However, no renderer component ever reads
.message. The only UI consumer of daemon status,Sidebar.tsx(~line 328-342), typesdaemonStatus: { state: string; message?: string }but only renders`daemon {daemonStatus.state}`in a tooltip —.messageis dropped on the floor. - Separately,
frontend/src/renderer/lib/daemon-status.ts→applyDaemonStatus()only callssetApiBaseUrl(url)whenstate === "ready" && port; for any other state (including"error") it callssetApiBaseUrl(null). SoruntimeApiBaseUrlstaysnullindefinitely in this scenario. - Every API call goes through
runtimeFetch()infrontend/src/renderer/lib/api-client.ts(~line 42-49), which short-circuits to a hardcoded{"message": "AO daemon is not ready."}(503) wheneverbaseUrl === null— this generic string is the only thing surfaced viaapiErrorMessage()to whatever toast/error UI the caller uses.
Net effect: the specific, correctly-computed identity-mismatch diagnostic is dead code from the user's perspective — it's computed, sent over IPC, and then discarded.
Fix
Render daemonStatus.message when present and state !== "ready" — e.g. in the Sidebar.tsx tooltip (trivial), and/or in a dedicated banner shown wherever daemon-dependent actions are surfaced (larger, overlaps with #2242's ask for a "Restart daemon / Reconnect" affordance). At minimum, the generic 503 body in api-client.ts should not fully mask a more specific daemonStatus.message when one exists.
Impact
- Confusing dev/QA experience running multiple checkouts side by side (worktree-based workflows, which this project uses heavily, per
AGENTS.md/CLAUDE.mdworktree conventions). - More generally: any
daemonStatus: "error"case (not just identity mismatch — e.g. binary/version mismatch errors from the samedaemonIdentityError()function) hits the same dead-end, so the fix benefits multiple error paths, not just this one trigger.
Related
- #2242: same generic-message-swallows-everything symptom (
"AO daemon is not ready"with no recovery UI), but triggered by the daemon exiting while the app stays open, rather than a checkout-identity mismatch between two concurrent instances. Both point at the same underlying gap: daemon-status errors have no UI surface beyond the generic API fallback message.
Priority: medium — feature degraded, workaround exists (stop the other checkout's instance), but the error message gives the user no way to discover that on their own. Could not apply the bug/priority:medium labels directly (insufficient repo permissions on this account) — flagging here instead.
Thanks for contributing to Agent Orchestrator.
This issue is being picked up by the current external contributor on-call pair:
- @neversettle17-101
- @somewherelostt
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 @neversettle17-101 and @somewherelostt here. You can also join the AO Discord if you want faster context, want to ask questions live, or just want to follow what the community is building.
You are also welcome to join the AO Discord community.
We do daily Discord calls at 10 PM IST, except Saturday.
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.
Another cost of this being swallowed: it silently blocks worker-side desktop verification entirely.
Repro path on macOS, cursor harness worker, repo at 3934bc86a:
- Worker follows
.agents/skills/ao-desktop-dev/SKILL.mdand runsnpm run dev build-daemon.mjsneeds Go; no Go toolchain exists in the worker environment- Worker locates a prebuilt daemon at
/Applications/Agent Orchestrator.app/Contents/Resources/daemon/ao, copies it tofrontend/daemon/ao, relaunches with--ignore-scripts - App still never comes up — the daemon identity mismatch fires, surfaced only as a generic failure
Because the real reason is swallowed, the agent has nothing actionable to react to. It burned roughly 35 consecutive tool calls escalating through AwaitShell polling, --remote-debugging-port=9222 with CDP /json/list, Playwright connectOverCDP, raw WebSocket driving, osascript window queries, and sample process profiling — before concluding "desktop verification is blocked by a daemon identity mismatch (no Go to rebuild)" and falling back to unit tests.
Surfacing the actual mismatch reason at step 4 would have ended that in one step instead of thirty-five, and the frontend PR would have carried an accurate verification status rather than an attempted-and-failed one.
Filed the surrounding environment gap as #3638; that issue depends on this one being resolved for the prebuilt-daemon fallback to be viable.
@AgentWrapper The specific daemon identity-mismatch message now reaches the UI This was fixed in #2972 and the focused tests pass. #2584 is still open, but its fix has been superseded.
This issue should be closed.
Hi @mukesher4, daemon identity mismatches are no longer silently swallowed: the failure banner surfaces the real error on current main. Closing as completed. Thanks for tracing this so carefully originally.