Cross-session inbox goes permanently deaf when the /tmp/cc-socks-<uid> fallback directory is removed (systemd-tmpfiles boot sweep race)

Status Open
Reported on v2.1.283
Maintainer reply None cached
Activity 1 comment · opened Sep 26, 2026

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' ListAgents omit it, and SendMessage to 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).

  1. XDG_RUNTIME_DIR=/nonexistent claude (session A binds /tmp/cc-socks-$UID/…).
  2. rm -rf /tmp/cc-socks-$UID.
  3. From session B, ListAgents: A is missing, and SendMessage to A fails. A's /status still 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_DIR directory once it exists, and update sessions/<pid>.json.
  • (b) Or retry the primary directory for a short window at startup before falling back.
  • (c) At minimum, surface a visible warning / /status degraded 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).

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗