Skip to content

fix(ssh): expand ControlPath %C ourselves — socket must fit sun_path - #85

Merged
MikeGibbsOnyx merged 1 commit into
MiaAI-Lab:mainfrom
MikeGibbsOnyx:fix/ssh-controlpath-sun-path
Sep 8, 2026
Merged

fix(ssh): expand ControlPath %C ourselves — socket must fit sun_path#85
MikeGibbsOnyx merged 1 commit into
MiaAI-Lab:mainfrom
MikeGibbsOnyx:fix/ssh-controlpath-sun-path

Conversation

@MikeGibbsOnyx

Copy link
Copy Markdown
Collaborator

Follow-up to #84. Reproduced and fixed on macOS against a live Spark.

Bug: #84 passed ControlPath=$TMPDIR/sparkdash-%C through execFile. execFile does no %-expansion, and the socket is created locally — macOS $TMPDIR is a ~60-char per-user dir, so the literal is ~120 chars, past the ~104-byte sun_path limit. Result: unix_listener: path ... too long on EVERY remote collector; remote Sparks render offline with a log-spam per poll tick. Unit tests missed it because they asserted the template string, not the expanded literal.

Fix: compute OpenSSH's own %C formula (sha1 of localHost:user:remoteHost:port) and put the socket at /tmp/sparkdash- = 60 chars on every platform.

Receipts (fresh clone of 950ac31/ef5b314, run on Mac against nyx-den):

  • Before: every collector erroring (GPU/CPU/RAM/Network/Storage), spark online:false, log spam each tick
  • After: online:true, uptime 10,948s, control socket at /tmp/sparkdash-9db2..., zero errors over 70s of polling
  • Suite: server 314/314, frontend 23/23, tsc 0 errors, build green
  • Live LaunchAgent deploy was unaffected (launchd TMPDIR=/tmp) — this bit any non-launchd run on macOS.

MiaAI-Lab#84 shipped ControlPath=os.tmpdir()+"sparkdash-%C" through execFile. Two
assumptions were wrong: execFile performs no %-expansion (ssh only expands
%C for shell-parsed configs, not execFile argv), and the socket is created
LOCALLY — on macOS $TMPDIR is a ~60-char per-user path, so the literal
landed at ~120 chars, past the ~104-byte sun_path limit. Every remote
collector died with 'unix_listener: path ... too long' and remote Sparks
rendered offline with a log spam per poll tick.

Fix: compute the same hash OpenSSH uses for %C (sha1 of
localHost:user:remoteHost:port) and hang the socket at /tmp/sparkdash-<hex>
— 60 chars, every platform. Test now asserts the expanded literal's length
and absence of '%' so the template can never regress.

Verified on macOS against a live Spark: before = all collectors erroring,
spark offline; after = online, uptime/GPU/network collected, zero errors,
control socket present at /tmp/sparkdash-9db2... Suite 314/314, frontend
23/23, tsc 0, build green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant