fix-chat-dir-race

Implement: fix chat-dir creation race for register_coordinator_session ENOENT

Metadata

Statusdone
Assignedagent-1785
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Modelcodex:gpt-5.5
Created2026-05-02T23:54:22.234192057+00:00
Started2026-05-03T00:53:28.826543634+00:00
Completed2026-05-03T01:11:18.534422907+00:00
Tagsfix,nex,chat,bug, eval-scheduled
Eval score0.79
└ blocking impact0.85
└ completeness0.78
└ constraint fidelity0.70
└ coordination overhead0.78
└ correctness0.75
└ downstream usability0.80
└ efficiency0.85
└ intent fidelity0.93
└ style adherence0.85

Description

Description

daemon.log shows Coordinator-N: register_coordinator_session failed: No such file or directory (os error 2) for newly-spawned chat supervisors. coordinator_agent.rs:662 calls register_coordinator_session before any code that creates .wg/chat/.chat-N/. Race between CreateChat IPC (writes graph), dispatch_boot (creates chat dir), and supervisor spawn (registers session).

Fix: ensure the chat dir exists before register_coordinator_session is called. Easiest: have register_coordinator_session itself create the dir if missing (defensive). Or: make the supervisor wait for the dir to appear, with a short timeout.

Implement directly — do not decompose further.

File scope (limit to these files)

  • src/commands/service/coordinator_agent.rs (register_coordinator_session call site)
  • src/chat_sessions.rs (register_coordinator_session implementation)
  • tests/ (unit test for the ENOENT path)

DO NOT touch: ipc.rs CreateChat handler, dispatch_boot.

Validation

  • Failing test written first: spawn supervisor before chat dir exists → assert no ENOENT, assert dir is created
  • Implementation makes the test pass
  • cargo build + cargo test pass with no regressions
  • Live verification: daemon log no longer shows register_coordinator_session failed: No such file or directory for new chats

Depends on

Required by

Log