Found while producing #1535's live repair evidence; reproduces on current main, so unrelated to the #1478 stack.
In a git worktree using the default per-worktree dev state dir (~/.agent-device/dev/<worktree>-<hash>), each CLI invocation spawned a NEW daemon instead of connecting to the existing one — three coexisting dist/src/internal/daemon.js processes were observed against one state dir within two minutes (ages 2:35 / 2:18 / 1:28), each command seeing an empty session store. Practical consequence: any multi-command session flow silently breaks with SESSION_NOT_FOUND — a held repair session (repairSessionHeld: true) is unreachable from the very next command, which presents exactly like a held-session regression and cost real diagnosis time. The CLI also intermittently printed "Replacing daemon (pid …): code-signature mismatch" in these worktrees earlier the same day, suggesting the daemon identity/signature check misbehaves for worktree dev builds (mismatch on every connect → spawn-instead-of-connect, without killing the predecessor).
Workaround: pass an explicit shared --state-dir on every command of the flow (all such flows worked flawlessly).
Repro sketch: in a worktree, pnpm build, then run any two session commands seconds apart without --state-dir (e.g. replay <flow> --save-script --session s then click … --session s), and check ps for multiple daemon processes plus SESSION_NOT_FOUND on the second command.
Found while producing #1535's live repair evidence; reproduces on current main, so unrelated to the #1478 stack.
In a git worktree using the default per-worktree dev state dir (
~/.agent-device/dev/<worktree>-<hash>), each CLI invocation spawned a NEW daemon instead of connecting to the existing one — three coexistingdist/src/internal/daemon.jsprocesses were observed against one state dir within two minutes (ages 2:35 / 2:18 / 1:28), each command seeing an empty session store. Practical consequence: any multi-command session flow silently breaks with SESSION_NOT_FOUND — a held repair session (repairSessionHeld: true) is unreachable from the very next command, which presents exactly like a held-session regression and cost real diagnosis time. The CLI also intermittently printed "Replacing daemon (pid …): code-signature mismatch" in these worktrees earlier the same day, suggesting the daemon identity/signature check misbehaves for worktree dev builds (mismatch on every connect → spawn-instead-of-connect, without killing the predecessor).Workaround: pass an explicit shared
--state-diron every command of the flow (all such flows worked flawlessly).Repro sketch: in a worktree,
pnpm build, then run any two session commands seconds apart without--state-dir(e.g.replay <flow> --save-script --session sthenclick … --session s), and checkpsfor multiple daemon processes plus SESSION_NOT_FOUND on the second command.