Cross-session inbox goes permanently deaf when the /tmp/cc-socks-<uid> fallback directory is removed (systemd-tmpfiles boot sweep race)
Version: 2.1.283 (Linux, WSL2 with systemd; VS Code extension and CLI)
What happens. When $XDG_RUNTIME_DIR/cc-socks can't be used at startup, Claude Code falls back to /tmp/cc-socks-<uid>/<pid>.sock (added in 2.1.248). If that directory is later unlinked, the session keeps listening on a pathless socket. Its ~/.claude/sessions/<pid>.json keeps advertising the dead messagingSocketPath, so:
- other sessions'
ListAgentsomit it, andSendMessageto it fails with "not reachable"; - its own outbound messages carry
from="uds:/tmp/cc-socks-<uid>/<pid>.sock", so replies fail; - nothing re-binds or warns, and the session is one-way until restarted.
How it happens in practice. On WSL2 with systemd, VS Code reconnects and the extension spawns sessions during boot. At that point /run/user/<uid> doesn't exist yet (user-runtime-dir@ starts late), so the fallback is taken. Meanwhile systemd-tmpfiles-setup.service is still running the D /tmp boot sweep, which deletes /tmp/cc-socks-<uid>. The journal shows the sweep running 08:24:29–08:29:40, the sessions starting at 08:25:12 and 08:26:57, and /run/user/1000 appearing at 08:29:41.
Repro (without a reboot).
XDG_RUNTIME_DIR=/nonexistent claude(session A binds/tmp/cc-socks-$UID/…).rm -rf /tmp/cc-socks-$UID.- From session B,
ListAgents: A is missing, andSendMessageto A fails. A's/statusstill reports messaging as active.
Expected.
- (a) Periodically verify that the bound socket path still refers to our listener (inode check). If it doesn't, re-bind, preferring the primary
$XDG_RUNTIME_DIRdirectory once it exists, and updatesessions/<pid>.json. - (b) Or retry the primary directory for a short window at startup before falling back.
- (c) At minimum, surface a visible warning /
/statusdegraded cause when the inbox path disappears.
Workaround. Restart the session after boot, or add x /tmp/cc-socks-* to /etc/tmpfiles.d/.
Related (different failure modes): #85497 (session never binds its socket), #91223 (socket directory squatting).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗