Repository navigation
perf: frame large JSON-RPC messages in linear time - #540
Open
zhuwenzhuang wants to merge 1 commit into
Open
zhuwenzhuang wants to merge 1 commit into
zhuwenzhuang wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Large app-server history responses can consume a session-load deadline inside the JSON-RPC reader. It appends every stdout chunk to the unfinished line and scans that entire line again, even when no newline has arrived.
Scan only the incoming chunk, retain unfinished fragments, and join once per completed message. Dispose releases retained fragments. The change preserves existing newline framing, malformed-line handling, and decoding behavior; it neither truncates history nor increases timeouts. The separate UTF-8 decoding fix in #397 remains complementary.
Fixes #539.
Validation
npm run typecheckandnpm run buildpass.npm test: 744 passed, 26 skipped, 1 failed. The failure isCodexAcpClient.test.ts > should authenticate with key: an extrawarningevent appears in the expected method sequence. Running that test with the unchangedmainreader reproduces the same failure.mainand 52 ms after this change (macOS, Node v26.5.0; one measured run per version, payload allocation excluded).