Repository navigation
fix(ssh): name missing build tools when the relay has no node-pty - #22670
brennanb2025 merged 6 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between c3d2ea9122e7ba3aee427634fd2c7e31d41eab9b and 986839445ed69e544e29f781183383d603ed3f5b. 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe relay distinguishes an absent node-pty installation directory from one that cannot be read. It reports the installation path when the directory is absent. The spawn error path passes the resolved directory to diagnosis collection. The terminal pane uses the full IPC error detail, preserving later diagnosis and remedy lines. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to The diagnosis now distinguishes missing installations and preserves actionable multiline details. A packaged relay missing node-pty can still report the development fallback path, potentially confusing troubleshooting. This bounded diagnostic issue warrants owner awareness but does not establish a terminal availability regression. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change improves recovery instructions when a remote host lacks build tools. It does not appear to expand terminal access, but the full error text is also used in connection-error decisions, so this is more than a display-only change. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 2 | ❌ 1 | ❓ 2❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: ff66d02c-8e6a-47c7-8aea-d6ec2115b2c9
📥 Commits
Reviewing files that changed from the base of the PR and between 122b8c2 and 98afcf79f001b702d94f082e053ba3a6a1edde33.
📒 Files selected for processing (8)
src/relay/node-pty-binding-survey.test.tssrc/relay/node-pty-binding-survey.tssrc/relay/node-pty-unavailable-diagnosis.test.tssrc/relay/node-pty-unavailable-diagnosis.tssrc/relay/pty-handler-spawn-admission.test.tssrc/relay/pty-handler.tssrc/renderer/src/components/terminal-pane/ipc-pty-connect.tssrc/renderer/src/components/terminal-pane/pty-transport-spawn-errors.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline, plus a small diagnostic-accuracy note.
Reviewed changes
- Relay observes an absent node-pty dir instead of calling it unverifiable —
readNodePtyDirPresencemapsENOENTto absent and every other stat error to unverifiable, andcollectNodePtyUnavailableDiagnosisfeeds aninstalled: falsesurvey into the existing toolchain/build-tools diagnosis, so the reconnect loop is replaced with an actionable message. - The diagnosis names the missing install —
NodePtyBindingSurvey.installedand the newsearchedPhrasebranch producenode-pty is not installed at <dir>;pty-handlernow passesrelayNodePtyDir()through instead of nulling a missing dir. - Terminal errors keep every line —
handleConnectErrorusesreadIpcErrorDetailinstead of first-line-clampingextractIpcErrorMessage, so the install command on later lines reaches the pane toast. - Tests — new cases cover the absent dir, the EACCES "can't tell" path, the real
pty.spawndiagnosis, and the multi-line toast. I reverted each production fix in place and confirmed the matching test fails, then restored (git statusclean).
ℹ️ A packaged relay can print the bundle fallback path instead of the packaged install location
Worth confirming, not blocking. relayNodePtyDir() returns the packaged path only when it already exists; when node-pty is missing from a packaged relay it falls back to join(__dirname, 'node_modules', 'node-pty'), and that fallback is what the new message prints. A user may go looking at a directory the deploy never targeted, even though the remedy stays correct.
Technical details
# Diagnosed path vs deploy path
## Affected sites
- `src/relay/pty-handler.ts:657` — passes `relayNodePtyDir()` into the diagnosis.
- `src/relay/pty-handler.ts:636-645` — `relayNodePtyDir()` returns the packaged path only when `existsSync(packagedDir)`, else the bundle-relative fallback.
- `src/relay/node-pty-binding-survey.ts:242` — the absent-dir survey's `moduleDir` is whatever path was passed.
## Required outcome
- On a packaged relay, the absent-node-pty message should name the packaged install location (the path the deploy and `formatSkippedNodePtyWarning` refer to), while the dev fallback stays for local bundles.
## Open questions for the human
- Is the bundle-relative fallback deliberately canonical, or incidental? If incidental, is it worth threading the packaged path into the diagnosis only, without changing the load fallback?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
98afcf7 to
c4e4120
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The only change since the prior pullfrog review is one amended commit that addresses its single inline finding — the presence check now follows the symlink. All four changed test files pass (57 relay + 8 renderer).
- Fixed
readNodePtyDirPresenceto usestatSyncinstead oflstatSync, so a dangling node-pty symlink is judgedabsentand an unreadable target staysunverifiable, while the existing EACCES case keeps its "can't tell" behavior. - Added a win32-skipped regression test (
treats a node-pty link whose target is gone as not installed) that fails against the oldlstatSyncbehavior.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
b8d2f1a to
c3d2ea9
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review (c4e4120) the branch was rebased, and the only new commit removes dead code already vetted in the previous incremental pass.
- Dropped the unreachable
nodePtyDir: nullearly return incollectNodePtyUnavailableDiagnosisand narrowed its parameter tostring. The only caller,pty-handler, always passesrelayNodePtyDir(), which always returns a non-empty path (src/relay/pty-handler.ts:637), so absence is now judged solely insidereadNodePtyDirPresence. The removed'the relay could not locate its node-pty install directory'message has no other references. - Reworked the matching tests: the null-input case is replaced by the absent-directory and dangling-symlink cases, and the EACCES case absorbs the "could not establish why" plus raw-error assertions the null test owned.
The one open pullfrog thread (presence check following the wrong inode) was already resolved by c4e4120.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (c3d2ea9) is a merge with main plus one new guard test; no production behavior changes.
- Added a pure-function guard test in
node-pty-unavailable-diagnosis.test.ts: an absent node-pty survey (installed: false) on a host whose toolchain probe foundmake/g++/python3must staydependency_missing, say the build tools "are present", and print noapt-getinstall hint. This pins the case where a node-pty-less reinstall failed for an unrelated reason (ENOSPC, registry unreachable) so the fix cannot drift into the confidently-wrong toolchain diagnosis it was meant to avoid. - Merged
origin/main(4d8e9739b8).mainnow carries the same multi-line IPC error handling (#23538), so the branch's renderer production change collapses to the explanatory comment inipc-pty-connect.ts; the multi-line toast test stays and still guards the behavior. The relay files are untouched by the merge.
All four changed test files pass (66 tests). The one prior pullfrog inline thread (presence check following the wrong inode) was already resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
A host without a compiler gets a relay installed without node-pty, and that was reported as unverifiable, so users were told to reconnect forever. Fixes stablyai#20386
The caller always passes a path now; absence is judged inside.
A bare node-pty import walks up to an ancestor node_modules, so the directory beside the relay bundle can be absent while the install that failed to load is not. Diagnosing only the bundle's own directory then reported node-pty as not installed.
9868394 to
d8131f8
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (9868394) is one new commit, d8131f84dd, which makes the diagnosis follow the node-pty install the bare import actually resolves. The three earlier commits are rebased equivalents of content already reviewed and approved.
- Diagnose the resolved install, not the beside-relay directory — new
resolveNodePtyInstallDir(fromDir)innode-pty-binding-survey.tsreturnsdirname(createRequire(join(fromDir, 'relay.js')).resolve('node-pty/package.json'))(null on any throw), andpty-handler.nodePtyUnavailableErrorusesresolveNodePtyInstallDir(__dirname) ?? this.relayNodePtyDir(). A copy supplied by an ancestornode_modules— packagedResources/node_modules, or a user's~/node_modulesthat Node's upward walk would load — is now described by the survey instead of a directory the import never reached. This resolves the prior-review note about the packaged relay printing the bundle fallback path. - Tests — two pure-function cases for
resolveNodePtyInstallDir(ancestor-supplied install found; nothing up the tree → null) plus twopty-handlercases: an absent-beside-relay install still yieldsnode-pty is not installed atand theapt-gethint, while an ancestor-supplied install yieldsunder <ancestor>and no "not installed". I reverted the production line tothis.relayNodePtyDir()and confirmed the ancestor case fails, then restored (tree clean). All 61 tests in the three touched relay test files pass;check:code-quality:changedreports 0 new findings.
node-pty declares no exports map, so require.resolve('node-pty/package.json') is not blocked, and any resolution failure degrades to the existing relayNodePtyDir() fallback, so the change is safe on hosts where the package layout differs.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
…at spawn admission The stablyai#20386 rewrite of the stablyai#17830 admission test dropped its check that the relay forwards the spawn error it was handed. Assert the structured cause still carries it as rawError, and that the no-toolchain verdict is not repairable so the client never auto-reconnects on it.
|
Thanks @AmoabaKelvin, this is the right fix at the right layer. The relay now decides "not installed" only from its own I pushed two things:
For context: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (d8131f8) is a merge with main plus one test commit; the relay and renderer production code is unchanged across this range.
- Merged
origin/maininto the branch — base-branch noise only; the PR's net diff stays the same 8 files and the merge touches no relay or renderer production code. - Pinned the structured spawn-rejection cause end-to-end —
failSpawnWithToolchainProbenow returns the rejection error instead of its.message, and the toolchain-missing case assertsrejection.datais{ reason: 'toolchain_missing', repairable: false, rawError: <load error> }. That is theTerminalUnavailableCausea client acts on, and it now has a guard through the realdispatcher.callRequestpath rather than only the pure-function unit tests innode-pty-unavailable-diagnosis.test.ts.
All four changed test files pass (69 tests) and pnpm run check:code-quality:changed reports 0 new findings.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
On SSH hosts without a C compiler, Orca's terminal error said "we couldn't tell what's wrong, reconnect to retry". Reconnecting never helped. Now it says the build tools are missing and shows the command to install them. Terminals still need those tools until the host no longer has to compile node-pty (#1693).
What Changed
Before: opening a terminal on such a host showed "the relay could not establish why: the relay could not locate its node-pty install directory … reconnect to retry", on every reconnect.
After: the exact text the relay now prints, for a Debian host missing make and g++:
The install line is tailored to the host's own package manager (apt-get, dnf, yum, pacman, apk, zypper), because the relay probes for it rather than guessing; when it finds none, the message lists one command per distro family instead of naming the wrong one. After installing and reconnecting, terminals work.
How it works:
mainon its own (Improve PTY device error messages with localization support #23538), which made the identicalhandleConnectErrorchange; this branch is rebased onmainand keeps only the comment explaining why the message must stay unclamped. The renderer test asserting the multi-line toast is still this PR's, and still guards the behaviour.Why
A missing folder is something the relay can see on its own host, so reporting it as unknown was wrong, and it sent users into a reconnect loop that could never succeed. Two alternatives were considered and not taken. Recording "node-pty skipped" at deploy time would add a file both sides must agree on and only covers one way the folder can go missing. Showing the deploy warning at connect time would still leave the terminal error wrong on older relays.
Linked Issue
Part of #20386. This PR makes the terminal error name the missing build tools and the command to install them; it does not remove the need for them, so terminals on such a host still need the tools installed. Removing that need (shipping node-pty prebuilt so the host needs no compiler) is #1693, so #20386 stays open.
Visual Proof
After:

Testing
Tested on macOS with the dev app from main and from this branch, against a Docker Debian SSH host (Node 22) with make/gcc/g++ removed. Then restored the tools, reconnected and confirmed a working shell.
Unit tests cover the relay diagnosis, the permission-denied case, the dangling-symlink case, the real
pty.spawnpath and the pane keeping every line; each fails without the fix. One more case was added during review: an absent node-pty directory on a host that does have the build tools must staydependency_missingand must not print an install command, so a node-pty-less reinstall that failed for an unrelated reason (disk full, registry unreachable) never sends the user to install tools they already have.A further case covers the parent-folder lookup: when node-pty resolves from a parent folder, the message describes that copy and does not say "not installed"; it fails without the fix.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
installedis relay-internal and never reachesTerminalUnavailableCause, the only thing that crosses the wire. With a new relay and an app older than Improve PTY device error messages with localization support #23538, the first line is correct but the install command stays hidden until the app updates. With an older relay and a new app, the old message now shows in full.mainrather than this branch. The error box caps them at 24 lines / 4,000 characters (terminal-error-accumulation.ts), and this message is three lines, so nothing is trimmed.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)