Skip to content

fix(terminal): guard dropInheritedNiceBoost to Linux in PTY spawn paths - #51064

Merged
nwparker merged 1 commit into
mainfrom
bugbash/issue-51055
Nov 27, 2026
Merged

nwparker merged 1 commit into
mainfrom
bugbash/issue-51055

Conversation

@nwparker

@nwparker nwparker commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On Windows (and macOS) Orca could fail to open any terminal after an update, with dropInheritedNiceBoost is not a function. That helper only does anything on Linux, so Orca now only calls it on Linux and the terminal opens again everywhere else.

Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

What Changed

  • Before: both PTY spawn paths (spawnNativeDaemonPty in the daemon and the local PTY runtime spawn) called dropInheritedNiceBoost(pid) on every platform right after pty.spawn. If the @orca/process-host module in the install was older and lacked that export (seen after a partial 1.4.280 update), the call threw, so the shell spawn failed and the daemon reported "Daemon failed to spawn shell".
  • After: both call sites check process.platform === 'linux' before calling the helper. On Windows and macOS the call is skipped, so a stale process-host can no longer break PTY spawn there. Linux behaviour is unchanged.

Why

dropInheritedNiceBoost already returns immediately when the platform is not Linux, so skipping the call off Linux changes no behaviour. It just removes the dependency on that export from the spawn path on the platforms where the crash was reported. This is a partial fix: it does not address how a partial update can leave a mismatched process-host behind, and a Linux install in the same mismatched state could still hit the error.

Linked Issue

Refs #51055

Visual Proof

N/A. No UI change. The fix removes a thrown error in the PTY spawn path, and the code change only affects which platforms make one helper call.

Testing

  • Repro (from the issue): Windows 1.4.280, opening a terminal fails with (0 , ce.dropInheritedNiceBoost) is not a function, raised from the unconditional call after pty.spawn.

  • Verification: the off-Linux path no longer calls the import at all, so a missing export cannot throw there. vitest run src/main/daemon/pty-subprocess/native-pty-spawn.test.ts passes. CI static gates (anti-slop oxlint, code-quality native-plugin oxlint, ast-grep, changed-code quality), oxlint and oxfmt are clean on both touched files.

  • Platforms: macOS (unit tests and static gates). Not manually tested on Windows.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

No test was added. The behaviour change is a single platform guard around a helper that was already a no-op off Linux.

Performance

None, because this adds one process.platform string comparison per PTY spawn, which is not a hot path. A micro-benchmark puts it at about 10 ns per spawn (old 8.4 ns, new 10.4 ns), against a PTY spawn that takes milliseconds. There is no new I/O, subprocess work, polling or per-item fan-out.

Risk

Level: Low

Linux still makes the same call. On Windows and macOS the helper was already a no-op, so skipping it changes nothing except that a missing export can no longer throw. To back it out, revert this commit.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Reported by @lengocanh2005it

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

An older process-host left behind by a partial update does not export
dropInheritedNiceBoost, so calling it unconditionally failed every PTY
spawn on Windows and macOS. The helper is a no-op off Linux anyway, so
only call it there.

Refs #51055
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Both PTY spawn paths now call dropInheritedNiceBoost only on Linux. Other platforms no longer make this call after spawning a PTY.

Merge Risk: Minimal · up to 53729

Terminal spawning on Windows and macOS no longer calls a Linux-only helper, which avoids failures when an older process-host lacks it. Linux behavior is unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a Linux-only guard around dropInheritedNiceBoost in the PTY spawn paths. The raw summary confirms both spawn paths (native-pty-spawn.ts and local-pty-runtime-spawn.ts)…
Description check Passed The description follows the template closely. It has ELI5, What Changed (before and after with the mechanism), Why (including the partial-fix caveat), Linked Issue (Refs #51055), Visual Proof (N/A wit…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a Linux-only guard around dropInheritedNiceBoost in the PTY spawn paths. The raw summary confirms both spawn paths (native-pty-spawn.ts and local-pty-runtime-spawn.ts) now call the helper only on Linux. The title is specific, uses the conventional fix(scope) form, and needs no revision.

Full details: Description check

Explanation

The description follows the template closely. It has ELI5, What Changed (before and after with the mechanism), Why (including the partial-fix caveat), Linked Issue (Refs #51055), Visual Proof (N/A with reason), Testing (repro, vitest run, platforms tested), Performance (None, with reasoning), Risk (Low, with backout), AI Disclosure section left blank, and a completed checklist. Gaps: the Linked Issue uses 'Refs' rather than 'Fixes', and the template says outside contributors need an actual issue link, which is present. The manual testing box is unchecked and the author states Windows was not tested manually. The final checklist item for pnpm lint/typecheck/test/build is unchecked. These are minor and do not make the description incomplete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 320d6a23-4991-4786-a179-14241a6260a3
Commits

Reviewing files that changed from the base of the PR and between 13defff and 5372948.

Files selected for processing: 2

  • src/main/daemon/pty-subprocess/native-pty-spawn.ts
  • src/main/providers/local-pty/local-pty-runtime-spawn.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@nwparker
nwparker merged commit 12c03df into main Nov 27, 2026
108 of 110 checks passed
@nwparker
nwparker deleted the bugbash/issue-51055 branch November 27, 2026 18:36
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