Repository navigation
Conversation
Linux Claude Code records procStart as /proc/<pid>/stat field 22 (starttime, clock ticks), not the ps -o lstart= date string the existing PsProcInfo reads. Every real session was failing the roster's proc-start comparison and getting classed as recycled, so cc-peer and a live Claude Code session never saw each other on Linux. LinuxProcInfo reads that field, parsing after the last ")" so a comm containing spaces or parens cannot shift the fields. cc-peer.ts now picks it via a selectProcInfo() helper, kept as its own export so the platform choice itself has direct unit coverage.
On Linux Claude Code binds its inbox under $XDG_RUNTIME_DIR/cc-socks, not /tmp/cc-socks, so socketDirCandidates() tried the wrong directory first and a default-path cc-peer peer never found a live session to connect to. An explicit socketDir still overrides the whole list, on every platform, as before. Two existing tests asserted the old fixed order using this machine's real platform and its real $XDG_RUNTIME_DIR, so they now pin the platform and env they mean to exercise (a new withEnv test helper, mirroring withPlatform), and the Linux-first order gets its own test.
PROTOCOL.md was verified on macOS and documents procStart and the socket directory as if ps -o lstart= and /tmp/cc-socks were universal. Neither holds on Linux: add the two notes next to the rules they override, so an implementer reading this file does not reproduce the same Linux mismatch cc-peer itself shipped with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux, Claude Code writes two registry values differently from what cc-peer 1.6.8 expects. As a
result, a cc-peer peer and real Claude Code sessions do not see each other.
procStart. Linux Claude Code records the process start time in clock ticks, field 22 of
/proc/<pid>/stat. cc-peer compares it withps -o lstart=output, so it classes every real session as arecycled pid and leaves it out of
roster(). Claude Code in turn leaves cc-peer's own entry out ofListAgents.Socket dir. Linux Claude Code binds its inbox under
$XDG_RUNTIME_DIR/cc-socks. cc-peer bindsunder
/tmp/cc-socksfirst.Changes
LinuxProcInfo. Itslstart()reads/proc/<pid>/statand returns field 22. It parses afterthe last
), so a command name with spaces or parentheses does not shift the fields.CcPeer.create()uses it on Linux. macOS and Windows are unchanged.socketDirCandidates()puts$XDG_RUNTIME_DIR/cc-socksfirst when the variable is set.Other platforms and an explicit
socketDirare unchanged.CachedPidCommand's cache hit. Linux no longer reaches that paththrough
PsProcInfo, so it needs its own test. A Linux note indocs/PROTOCOL.md.Evidence (Debian 13, kernel 6.12.101, Claude Code 2.1.294):
The same holds for 2.1.281 and 2.1.296.
Repro. On Linux with a Claude Code session running:
CcPeer.create({ name: "probe" }), thenroster()returns no sessions, and the session'sListAgentsdoes not showprobe. With this branch,roster()lists the session andListAgentsshowsprobe. Lint, typecheck, build and the 100% coveragegate pass. I ran them as a non-root user: three existing tests expect an unreadable file, and root can read
every file. Mutation testing passes too, but its config only mutates
src/domainandsrc/schemas, so it does not cover these changes.