Conflict-resolution agents (and any initiative-based agent) can write .cw/output/signal.json inside a project subdirectory (e.g. agent-workdirs/<name>/codewalk-district/.cw/output/) rather than the parent agent workdir. This caused two failures: 1. spawnInternal wrote spawn-diagnostic.json before registering the agent in activeAgents and starting pollForCompletion. If the .cw/ directory didn't exist (no inputContext provided), the write threw ENOENT, orphaning the running process with no completion monitoring. 2. resolveAgentCwd in cleanup-manager and output-handler only probed for a workspace/ subdirectory (standalone agents) but not project subdirectories, so reconciliation and completion handling couldn't find signal.json and marked the agent as crashed. Fixes: - Move activeAgents registration and pollForCompletion setup before the diagnostic write; make the write non-fatal with mkdir -p - Add project subdirectory probing to resolveAgentCwd in both cleanup-manager.ts and output-handler.ts
20 KiB
20 KiB