Skip to content

fix(process-host): accept string stdin in synchronous runs - #28225

Merged
nwparker merged 1 commit into
mainfrom
nwparker/scan-cookie-buffer
Oct 14, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/scan-cookie-buffer

Conversation

@nwparker

@nwparker nwparker commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

The helper that reads Chrome's encryption key on Windows could fail before starting because Orca used an invalid text setting. The helper can now receive its input.

What Changed

Before, sending string input through the synchronous process runner threw ERR_UNKNOWN_ENCODING: Unknown encoding: buffer. Windows Chrome cookie import uses that runner to send input to its key helper, so users saw an encryption-key access error before the helper ran.

The runner now requests raw output with encoding: null. Node can encode the string input correctly, while Orca still receives binary output and explicitly decodes text output as UTF-8.

Why

Changing the raw-output option fixes the shared runner directly, rather than adding an input conversion workaround to the cookie importer. This keeps its existing command resolution, hidden Windows console, timeout, and output handling.

Linked Issue

Fixes #27617

Visual Proof

N/A — this changes a subprocess option, with no rendered UI or interaction change. Proof comes from the actual runner executing harmless input before and after the fix.

Testing

Cross-platform verification: the final combined branch passed 27 focused suites on each execution host: macOS 349 passed, Linux 349 passed, Windows 348 passed and 1 platform skip. Core typecheck, changed-code quality (67 files, zero findings), and the production Electron bundle build also passed. Tests ran in dedicated background worktrees through Orca; native Windows/Linux UI and private cookie imports were not exercised.

Under actual Node 24.20.0, the built production package failed before the fix with ERR_UNKNOWN_ENCODING: Unknown encoding: buffer. After rebuilding, the identical command returned {"code":0,"output":"nonsecret-probe"}:

node -e "const {runProcessSync}=require('@orca/process-host'); try { const r=runProcessSync({program:process.execPath,args:['-e','process.stdin.pipe(process.stdout)'],input:'nonsecret-probe',timeoutMs:3000}); console.log(JSON.stringify({code:r.code,output:r.stdout})); } catch (e) { console.error(e.code+': '+e.message); process.exitCode=1; }"

Two new real-runner regression cases failed before the fix and pass after. They verify Unicode string input, Unicode diagnostic output, decoded text output, and raw NUL/invalid UTF-8 bytes. They live in the existing suite required to run under real Node even through the default Bun-backed test command.

  • Runner, byte capture, and spawn observer suites: 27 tests passed under real Node with at most two workers.
  • Independent verification of the full process-host suite under real Node: 122 passed, six platform skips.
  • Default test command also passes both new regression cases under its required Node runtime.
  • Cookie import and snapshot ownership suites: 32 tests passed.
  • Node application typecheck and process-host source/test typechecks passed.
  • Changed-code quality, focused oxlint, formatting, and git diff --check passed.
  • Actual local execution: macOS. Remote Windows and Linux runner validation is in progress; those results are not yet claimed here.

No private cookies or encryption keys were used.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Final platform verification: tested together with the other reviewed fixes in 59 selected suites. macOS: 748 passed. Linux: 748 passed. Windows: 725 passed, 13 platform skips (including the Bash-only suite). Core typecheck, changed-code quality (zero new findings), and the production Electron bundle build passed. UI screenshots are hidden macOS renderers; fixture and live-host limits are described above.

Merge verification: all required CI checks passed before merging. Community co-author credit, where applicable, was verified in the actual squash commit. Native Windows awin (Node24.18.0) reproduced the original ERR_UNKNOWN_ENCODING before child startup. The fixed real runner preserves Unicode stdin, binary stdout and diagnostic stderr; the real Windows DPAPI function recovered a synthetic32-byte key after failing on the baseline. No private browser data was accessed; app-bound encryption was not tested.

Review

Reviewed community PR #27683 as a cross-reference and credited Joe Esposito as a commit co-author. Independent review found no blocking issues. The production change is one encoding option. Merge risk is low, with no negative user-facing trade-offs identified. The execution host still owns subprocess execution; SSH behavior and wire compatibility do not change. Folder workspaces and mobile presentation do not depend on this option.

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

This removes the reported subprocess exception. It does not add support for Chrome's app-bound cookie encryption or change the existing error wording when key extraction fails for another reason. Full lint, full multi-project typechecking, full test suite, and build were not run locally; CI covers these broader checks.

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)
  • 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)

Request raw subprocess output with null encoding so Node can encode string stdin as UTF-8. Preserve explicit text decoding and byte capture, with real-runner coverage for both output modes.

Co-authored-by: Joe Esposito <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c41b088-6341-4c67-a2eb-6d3e99097255
📥 Commits

Reviewing files that changed from the base of the PR and between f844518 and 9418ce6.

📒 Files selected for processing (2)
  • src/packages/process-host/src/run-process.test.ts
  • src/packages/process-host/src/run-process.ts
  • 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

Comment @coderabbitai help to get the list of available commands.

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.

[Bug]: Chrome cookie import still fails on Windows in 1.4.224: ERR_UNKNOWN_ENCODING buffer

1 participant