Skip to content

fix(git): preserve binary output through termination barriers - #32633

Merged
nwparker merged 1 commit into
mainfrom
nwparker/bug-barrier-binary-capture
Oct 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/bug-barrier-binary-capture

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​122 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14

ELI5

Git commands that request binary output and wait for complete child termination can corrupt non-UTF-8 bytes. They now return the original bytes on success and failure.

What Changed

Retain bounded raw stdout and stderr through process-host capture, including its synchronous API. The Git termination-barrier path uses those buffers directly and strips WSL control markers through reversible Latin-1 mapping. Error-message text alone is decoded as UTF-8.

Why

On untouched main, a real Git blob containing [0,255,128,10] returned [0,239,191,189,239,191,189,10] through public gitExecFileAsync with { encoding: 'buffer', terminationBarrier: true }. The existing bounded byte sink preserves the original data while retaining output caps and termination behavior.

Linked Issue

Discovered during independent validation of @fancive’s #30961. This separate correction contains no code adopted from that PR.

Visual Proof

N/A — this changes subprocess byte capture and has no visible UI flow.

Testing

  • Reproduced before the fix through public production runner exports, actual Git and a disposable repository; the identical witness passes after the main refresh.
  • Added real-child byte regressions for success, nonzero exit, truncation, WSL markers, timeout and abort, plus async/sync process-host byte coverage.
  • After the final refresh: 128 tests across 14 focused suites, full Node typecheck, all seven changed-code quality scans, scoped anti-slop, formatting and whitespace checks pass.
  • Independent review passed 55 tests, including 33 reviewer-authored adversarial cases. All five changed files have identical parsed code and types after refreshing onto main.
  • Local checks ran on macOS/Node24. Exact-head CI now passed all ten workflows, including Linux/Windows packaging, platform preflight, Windows SSH hosts, headless server, mobile, and Ubuntu/Debian/Fedora WSL. Final rollup: 53 successful checks and 10 expected skips. Fedora setup exceeded its 45-minute limit on the first attempt; one failed-only retry passed both Orca test phases, preserving successful jobs.

Review

Independent adversarial review: LOW merge risk; no blockers. Five changed files, +141/−10. Text defaults, spawn policy, termination proof, admission, deadlines and input handling retain their existing behavior. The new byte flags are internal package options and add no wire-protocol fields.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied or translated.

Checklist

  • Small, focused change with a real before/after reproduction.
  • Self-review and independent correctness, compatibility and performance review completed.
  • Folder workspaces, remote hosts, mobile clients and platform behavior considered.
  • Fresh full PR workflow and all platform workflows pass at exact head 7be53ffbd5ef38c5c90c6f7df6ed8137ddaa93fa.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ 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: 195e1da5-77eb-40b2-a171-9778d676d3d8
📥 Commits

Reviewing files that changed from the base of the PR and between 9aa208a and 7be53ff.

📒 Files selected for processing: 5
  • src/main/git/command-runner/exec-file-capture-bytes.test.ts
  • src/main/git/command-runner/exec-file-capture.ts
  • src/packages/process-host/src/process-spec.ts
  • src/packages/process-host/src/run-process-bytes.test.ts
  • src/packages/process-host/src/run-process.ts

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

📝 Walkthrough

Process execution now supports optional stderr capture as bytes in asynchronous and synchronous runs. The command runner requests byte capture for buffer output and preserves captured bytes through termination-marker stripping. Tests cover binary stdout and stderr, truncation, nonzero exit, abort, timeout, and marker removal.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 7be53

The available evidence identifies no issue that needs correction before merge. Complete the normal platform and CI checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "fix(git): preserve binary output through termination barriers" names the main change. The raw summary shows process-host byte capture, the Git termination-barrier path using raw buffers, an…
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.
Description check Passed The pull request description is detailed and covers the change, motivation, testing, review, visual proof, compatibility considerations, and checklist. It provides a reference to issue #30961, but it …
Full details: Title check

Explanation

The title "fix(git): preserve binary output through termination barriers" names the main change. The raw summary shows process-host byte capture, the Git termination-barrier path using raw buffers, and regression tests for binary stdout and stderr. The title follows a conventional commit format and is specific. It does not mention the process-host stderr byte option, but that is a supporting detail, so the title is related to the main change.

Full details: Description check

Explanation

The pull request description is detailed and covers the change, motivation, testing, review, visual proof, compatibility considerations, and checklist. It provides a reference to issue #30961, but it does not use the required Fixes # format or include a direct issue link. The Notes section and AI Disclosure section are also omitted; the AI Disclosure omission may be valid for an internal contributor.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@nwparker
nwparker merged commit 4975e24 into main Oct 24, 2026
68 of 69 checks passed
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