mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 00:02:23 +00:00
A daemon that died without unlinking its Unix socket stopped every later daemon on that machine from ever starting. The client launched one, it exited on the bind, the client launched another, forever. run_with does clear a stale endpoint, but only after a probe it skipped whenever the recorded daemon was known dead — reasoning that the bind below would overwrite the file. That is true of a Windows port file, and the whole of #639, where the skip came from, is Windows ports: it added a connect timeout so a firewalled stale port fails fast. On Unix the endpoint is a socket file and bind refuses any path that exists, so the one path that reached the bind with a leftover still there was the one that skipped its removal. What decides the removal is now the single-server seat, not the pidfile. Holding it means nobody else can be serving this config dir, so anything still at the endpoint belongs to a process that is gone — safe by construction, which is the property `singleton` exists to provide. Removing on one failed connect instead is the race that module was written to retire, so it is used only where there is no seat, and even there a socket that answers is refused rather than removed. Reproduced on a Linux box: with a socket nothing was behind and a pidfile naming a dead pid, main exits 1 on the bind and this starts and serves. Claude-Session: https://claude.ai/code/session_015q6HRem76HYy33T39bp34c