Skip to content

Fix oversized daemon stream output drops - #4160

Merged
nwparker merged 1 commit into
mainfrom
fix/daemon-stream-data-chunking
May 31, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/daemon-stream-data-chunking

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Summary

  • Split daemon terminal stream data into NDJSON events that fit the parser line-size limit.
  • Preserve event order and UTF-16 surrogate pairs while chunking oversized stream bursts.
  • Add a focused regression that feeds the daemon writer output back through createNdjsonParser.

Repro evidence

After NDJSON_MAX_LINE_BYTES was added, the parser correctly rejects oversized lines. The daemon stream writer still emitted large terminal output as one NDJSON event, so its own receiver could drop the data.

Focused repro before the fix:

NDJSON line exceeds max 256 bytes (845 bytes received)
expected onError not to have been called

That is a direct terminal-output loss path for large daemon stream bursts.

Verification

  • Failing focused test before fix: pnpm vitest run --config config/vitest.config.ts src/main/daemon/daemon-stream-data-batcher.test.ts
  • Passing focused tests after fix: pnpm vitest run --config config/vitest.config.ts src/main/daemon/ndjson.test.ts src/main/daemon/daemon-stream-data-batcher.test.ts
  • pnpm run typecheck:node
  • pnpm oxlint src/main/daemon/daemon-stream-data-batcher.ts src/main/daemon/daemon-stream-data-batcher.test.ts src/main/daemon/ndjson.ts src/main/daemon/ndjson.test.ts
  • pnpm oxfmt --check src/main/daemon/daemon-stream-data-batcher.ts src/main/daemon/daemon-stream-data-batcher.test.ts src/main/daemon/ndjson.ts src/main/daemon/ndjson.test.ts
  • git diff --check

Risk: low. The change only affects daemon stream data events whose encoded line would exceed the configured parser limit; normal-sized stream events keep the existing single-write behavior.

@nwparker nwparker added the risk:low Low risk change label May 31, 2026
@nwparker
nwparker merged commit 918790f into main May 31, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Low risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant