From CodeRabbit review on #141 (comment 3790957344, serve.rs:56).
ipc::running() treats LocalResponse::Error, connect failure, timeout, and invalid responses all as "not running". serve start then unconditionally calls remove_daemon_info(), even when an active daemon still holds daemon.lock — the replacement waits 15s and fails.
Action: only clear daemon.json after confirming the connection was refused, the control file is absent, or the daemon has exited. Keep the control file when an active daemon returns an error. Add an integration test covering the active-daemon-error case.
From CodeRabbit review on #141 (comment 3790957344, serve.rs:56).
ipc::running()treats LocalResponse::Error, connect failure, timeout, and invalid responses all as "not running".serve startthen unconditionally calls remove_daemon_info(), even when an active daemon still holds daemon.lock — the replacement waits 15s and fails.Action: only clear daemon.json after confirming the connection was refused, the control file is absent, or the daemon has exited. Keep the control file when an active daemon returns an error. Add an integration test covering the active-daemon-error case.