Skip to content

fix(extensions): bound split native-host header copies - #35359

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/native-host-header-fragment-copy-independent
Oct 29, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/native-host-header-fragment-copy-independent

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

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

When a native host splits its four-byte header across stdout chunks, Orca repeatedly concatenates the accumulating message body just to read the size. Limit that temporary concat to the four header bytes. Final message assembly and the incoming 1 MiB limit retain their existing behavior.

Actual production-reader measurements for a valid 1 MiB JSON message, with a one-, two-, or three-byte initial header fragment:

Body fragments Copied bytes before Copied bytes after
1 2,097,164 1,048,588
10 6,815,788 1,048,624
100 54,002,024 1,048,984

The 24 before/after rows preserve exact output. An intact header retains its single final concat. Five original framing tests pass on both variants; final focused preload/main-world/ports/process/framing validation passes 42 tests across five suites. Node typecheck, targeted formatting and all nine changed-code quality groups pass. Normal precommit hooks pass. Six source inputs match the measured proposal, and the original evidence seal is verified.

Rebased onto main ed7fe7d5dc7 (head 843b2ae973, same one-line diff). The required ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 passed on the rebased head: 20/20 checks in 411.4s. The author's pre-rebase run on 32f485d passed 19/19 in 177.4s. The existing framing test splits the header at byte 1 and byte 3 with body bytes in the same chunk, so a truncated header concat would fail it. The copy counts are not native CPU or latency evidence.

This is a one-line desktop reader change, pre-existing since #30940. Native-endian framing, failure handling, coalesced output, remote wire compatibility and workspace routing use the existing code. The separate retained-carry issue is outside this fix. Measurements use actual production TypeScript, real Node Buffers and a counting wrapper delegated to native Buffer.concat, on Linux/Node 26.8.1. No native host, Electron UI, CPU/latency, physical heap, macOS or Windows result is claimed.

Evidence: /home/neil/.local/state/orca-electron-audit/native-incoming-framing-candidate/report.md, operation-results.json, source manifest/integrity; author logs, exact source verification and commit bundle in native-host-header-fragment-candidate/implementation/.

@OrcaWin
OrcaWin force-pushed the OrcaWin/native-host-header-fragment-copy-independent branch from 32f485d to 843b2ae Compare October 29, 2026 01:00
@OrcaWin
OrcaWin marked this pull request as ready for review October 29, 2026 01:00
@coderabbitai

coderabbitai Bot commented Oct 29, 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 7 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
  • 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: 5f398fd0-8945-49c4-8651-657ff8fac9f6
Commits

Reviewing files that changed from the base of the PR and between 3a51382 and 843b2ae.

Files selected for processing: 1
  • src/main/browser/extensions/browser-extension-native-host-framing.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.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

The PR limits temporary copies of split native-host headers to four bytes.

  • Split native-host headers now copy only the four bytes needed to read their size.

Reviews (1) · Last reviewed commit: "fix(extensions): bound split native-host..." · Reviewed by Greptile

@OrcaWin
OrcaWin merged commit fe7d4c9 into main Oct 29, 2026
61 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