Guard against PM2 socket paths over the macOS 104-char limit#34
Merged
Conversation
A workspace whose PM2_HOME makes the socket path (PM2_HOME + /interactor.sock) exceed macOS's 104-char sun_path limit can never bind its daemon socket — every pm2 command auto-spawns a fresh daemon that instantly breaks with EINVAL, piling up zombies. reeve now detects this in fetchProcessesSync and returns early without running any pm2 command, so it stops contributing to the spawn cascade. The workspace shows a tailored "Workspace path too long" banner pointing at the real fix (shorter name) instead of the generic socket error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- Measure the socket path in UTF-8 bytes, not grapheme clusters: sun_path is a fixed 104-byte C buffer, so a multi-byte character in the path would otherwise under-report and slip past the check. - Fix the misleading comment on the path-too-long banner: reeve avoids polling with pm2 (which auto-spawns), but "Kill daemon" is still offered and is safe — it SIGKILLs any zombie directly, no pm2 command. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Guards against PM2 workspaces whose socket path exceeds macOS's 104-character
sun_pathlimit.Background
A workspace whose
PM2_HOMEis long enough thatPM2_HOME + /interactor.sockexceeds 104 chars can never bind its daemon socket — the daemon fails withEINVAL. Worse, because PM2 auto-spawns a daemon on any command when it can't reach one, everypm2 jlist/pm2 killagainst such a home spawns a fresh broken daemon that immediately dies and orphans, piling up zombie God Daemons. reeve's own polling was one of the things feeding that cascade (it runsjlistwhenever a live pid file is present).Seen in the wild with a long Conductor branch name:
Change
PM2Environment.socketPathTooLong— pure length check (PM2_HOME + /interactor.sock > 104).fetchProcessesSyncreturns early for such workspaces without running any pm2 command, so reeve never auto-spawns a broken daemon into them.This is defense-in-depth: it stops reeve from making the situation worse and labels it accurately. The root-cause prevention (shorter
PM2_HOMEnames) lives in the workspace launcher that setsPM2_HOME, which is being addressed separately.Budget
$HOME/(19) +.pm2-<name>+/interactor.sock(16) ≤ 104 → workspace-name portion max ≈ 64 chars.Tests
5 new tests covering the boundary (88-char home == 104-char path is fine, 89 is too long), the real over-long path, and the instance property. Full suite green (138).
swiftlint --strictclean.🤖 Generated with Claude Code
Summary by cubic
Prevents broken PM2 daemons by detecting when the PM2 socket path exceeds macOS’s 104‑byte limit and skipping any
pm2commands; the UI now shows a clear “Workspace path too long” message with the fix.PM2Environment.socketPathTooLong(UTF‑8 byte-length check forPM2_HOME + "/interactor.sock").fetchProcessesSyncreturns early with a sentinel error and never spawns a daemon for these workspaces.pm2).Written for commit 7f1a180. Summary will update on new commits.