Repository navigation
Conversation
|
Rebased onto current Conflicts were Focused tests: pty-subprocess / local-pty-provider / descendant-termination / job-object contract 232/232 green. |
6be9473 to
186e042
Compare
|
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:
📝 WalkthroughWalkthroughThe changes patch node-pty for Windows Job Object support, native handle cleanup, console process-list fallback, Unix symbol compatibility, and structured POSIX spawn errors. Runtime rebuild scripts now detect platform-specific native artifacts and enable source builds for patched node-pty. PTY spawning selectively propagates 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6d8483ac-a942-4af5-a6e6-216b07c905e8
📥 Commits
Reviewing files that changed from the base of the PR and between 6d55c7f and 186e0422de0cccb617b5f55cdc1d8e0d5eca9699.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
config/patches/[email protected]config/scripts/ensure-native-runtime.mjsconfig/scripts/node-pty-windows-job-object-contract.test.mjsconfig/scripts/rebuild-native-deps.mjssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/terminal-session-teardown.test.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-utils-windows-fallback.test.tssrc/main/providers/local-pty-utils.tssrc/main/pty-descendant-termination.test.tssrc/main/pty-descendant-termination.ts
Restack noteRebased onto latest Remains the Windows Job Object reaping path that #9804 explicitly deferred (authorized kill of agent ConPTY trees without PowerShell/taskkill). Orthogonal to closeLifecycle / host-authoritative session work. Coordinates with:
|
186e042 to
7b6fd0b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/scripts/ensure-native-runtime.mjs (1)
67-67: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd direct coverage for the Windows source-build contract.
The supplied tests skip the Windows artifact path and do not assert
npm_config_build_from_source=true. Add coverage confirming that Windows requiresconpty.node, enables patched source-build eligibility, and passes the environment flag topnpm rebuild node-pty; otherwise regressions in this critical path can go undetected.Also applies to: 303-307, 321-327, 339-346
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 06a031cc-cf96-48a4-a860-17163c3356de
📥 Commits
Reviewing files that changed from the base of the PR and between 186e0422de0cccb617b5f55cdc1d8e0d5eca9699 and 7b6fd0b9b4f797c92829fa93de123539f60a253f.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
config/patches/[email protected]config/scripts/ensure-native-runtime.mjsconfig/scripts/node-pty-windows-job-object-contract.test.mjsconfig/scripts/rebuild-native-deps.mjssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/terminal-session-teardown.test.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-utils-windows-fallback.test.tssrc/main/providers/local-pty-utils.tssrc/main/pty-descendant-termination.test.tssrc/main/pty-descendant-termination.ts
🚧 Files skipped from review as they are similar to previous changes (11)
- src/main/providers/local-pty-utils-windows-fallback.test.ts
- src/main/pty-descendant-termination.test.ts
- config/scripts/rebuild-native-deps.mjs
- src/main/daemon/terminal-session-teardown.test.ts
- src/main/providers/local-pty-provider.test.ts
- config/scripts/node-pty-windows-job-object-contract.test.mjs
- src/main/providers/local-pty-provider.ts
- src/main/daemon/pty-subprocess.test.ts
- src/main/providers/local-pty-utils.ts
- src/main/daemon/pty-subprocess.ts
- config/patches/[email protected]
7b6fd0b to
b9ee8d8
Compare
|
Rebased onto current Upstream #10100 ( Why it is still worth having on top of #10100: the Job Object binds at spawn (agent ConPTY, Adjacent upstream work checked and not overlapping: #10069 (never sweep descendants of an already-exited PTY root, POSIX hardening) and #10011 (orphan terminal recovery). Verified: |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
config/patches/[email protected] (1)
196-247: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winGuard the spawn-error helpers for OpenBSD too.
PtyForknow callspty_posix_spawn(...)andpty_format_spawn_error(...), and those helpers usepty_errno_nameandpty_set_spawn_error, but all of them are defined only inside#if defined(__APPLE__)even though the declarations and OpenBSD call path also include__OpenBSD__. This can leave an OpenBSD build with unresolved-spawn-error symbols or a miscompiled error path; wrap the helper definitions in the same__APPLE__ || __OpenBSD__guard as the declarations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fcc861ce-674c-4a73-8e3a-4ad140ce9f46
📥 Commits
Reviewing files that changed from the base of the PR and between 7b6fd0b9b4f797c92829fa93de123539f60a253f and b9ee8d868d609dbd4cdd81bb20bb0b3d5a08dadd.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
config/patches/[email protected]config/scripts/ensure-native-runtime.mjsconfig/scripts/node-pty-windows-job-object-contract.test.mjsconfig/scripts/rebuild-native-deps.mjssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/terminal-session-teardown.test.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-utils-windows-fallback.test.tssrc/main/providers/local-pty-utils.tssrc/main/pty-descendant-termination.test.tssrc/main/pty-descendant-termination.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/main/daemon/terminal-session-teardown.test.ts
- src/main/providers/local-pty-utils-windows-fallback.test.ts
- src/main/providers/local-pty-provider.ts
- config/scripts/node-pty-windows-job-object-contract.test.mjs
- config/scripts/rebuild-native-deps.mjs
- config/scripts/ensure-native-runtime.mjs
- src/main/daemon/pty-subprocess.ts
b9ee8d8 to
563bb9b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
config/scripts/ensure-native-runtime.mjs (1)
303-307: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd or verify Windows regression coverage for the new rebuild contract.
The supplied
config/scripts/ensure-native-runtime.test.mjscase is skipped onwin32, so it does not exerciseconpty.nodeselection or verifynpm_config_build_from_sourceon the target platform. Please confirm the separate contract/smoke tests cover both behaviors; otherwise add a Windows-safe test.Also applies to: 339-346
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3905e60e-5dd2-4747-bdc3-cc5ee7915ce0
📥 Commits
Reviewing files that changed from the base of the PR and between b9ee8d868d609dbd4cdd81bb20bb0b3d5a08dadd and 563bb9b.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
config/patches/[email protected]config/scripts/ensure-native-runtime.mjsconfig/scripts/node-pty-windows-job-object-contract.test.mjsconfig/scripts/rebuild-native-deps.mjssrc/main/daemon/pty-subprocess.test.tssrc/main/daemon/pty-subprocess.tssrc/main/daemon/terminal-session-teardown.test.tssrc/main/providers/local-pty-provider.test.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-utils-windows-fallback.test.tssrc/main/providers/local-pty-utils.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/main/daemon/terminal-session-teardown.test.ts
- src/main/providers/local-pty-utils-windows-fallback.test.ts
- config/scripts/rebuild-native-deps.mjs
- config/scripts/node-pty-windows-job-object-contract.test.mjs
- src/main/daemon/pty-subprocess.test.ts
- src/main/daemon/pty-subprocess.ts
- config/patches/[email protected]
24f55b3 to
e78365c
Compare
After rebase, useConptyJobObject referenced isAgentPty before definition. Hoist the agent-session predicate and restore tip local-pty tests.
Drop redundant Windows root-identity plumbing already covered by upstream stablyai#10484/stablyai#10674, document Job Object as the primary reaper with identity-gated taskkill as fallback, guard Apple/OpenBSD spawn helpers to avoid unused-function -Werror noise, and regenerate the node-pty patch so it applies cleanly to 1.1.0.
Rebase conflicts kept main's local-pty suite; re-add the Windows Job Object opt-in and WSL sweep assertions from the pre-rebase tip.
e78365c to
9a170e3
Compare
|
Closing as part of fork PR backlog cleanup. This branch is long-conflicted (DIRTY) against current |
Summary
node-ptyinstalls to build the matching native addon from source.Fixes #9704
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused verification passed: 10 files / 350 tests, changed-file oxlint and oxfmt, max-lines, patch-hash, lockfile, and diff checks.
pnpm run build:desktopalso passed.On Windows 11
10.0.22631with Node24.10.0and VS2019 Build Tools, the final package patch installed cleanly and Orca's product path,npm_config_build_from_source=true pnpm rebuild node-pty, producedwinpty-agent.exe,winpty.dll,conpty.node,conpty_console_list.node, andpty.node(gyp info ok). A native ConPTY smoke verified that explicit kill and natural root exit both reaped parent/child/grandchild processes, while the plain-terminal control left detached descendants alive until harness cleanup.The full
pnpm lintcommand is currently blocked by the existingsrc/renderer/src/components/skills/skill-freshness-group.ts:101switch-exhaustiveness error onorigin/main. The full repository test command and the exact template commandpnpm buildwere not run; focused tests pluspnpm run build:desktopand the Windows native build/smoke were used instead.AI Review Report
Independent AI reviews checked Job Object ownership, suspend/assign/resume ordering, handle races, natural-exit cleanup, resume failure, direct-root fallback, daemon/local ownership, plain-terminal and WSL exclusion, patch integrity, and cross-platform routing. Earlier review findings about cleanup lock placement and native warning-prone handle reuse were corrected and covered by contract tests; the final review returned spec-compliance
PASSand code-qualityAPPROVED.The cross-platform review explicitly covered macOS, Linux, Windows, WSL, daemon/local providers, Electron native rebuild selection, shell behavior, and SSH relay scope. No shortcut, label, or UI behavior changed.
Security Audit
Reviewed process-termination scope, native handle lifetime, failure cleanup, command execution, path handling, IPC/API threading, dependencies, and secrets. Job Object ownership is opt-in only for recognized agent PTYs; ordinary terminals are excluded. The implementation removes the proposed PowerShell/PID sweep, introduces no user-derived shell command, adds no dependency or secret handling, and falls back only to terminating the known root when Job setup fails.
Notes
Windows local and daemon-owned agent PTYs are covered, including the remote-server daemon path. Windows SSH relay remains unchanged because it installs vanilla
node-pty; shipping the patched native addon through that boundary is tracked separately by TODO #1693.The issue also discusses why kill requests may be initiated, transient
EAGAIN, and stale registry entries. This PR fixes descendant cleanup once the agent PTY is killed; it does not claim to change those separate initiators or diagnostics.ELI5
On Windows, killing an agent terminal could leave child processes behind. Agent ConPTY sessions join a kill-on-close Job Object so the whole tree dies with the root without sweeping every PID by hand.