fix(codex): cap app-server JSONL messages before join/parse - #4
Closed
cestercian wants to merge 1 commit into
Closed
cestercian wants to merge 1 commit into
cestercian wants to merge 1 commit into
Conversation
Unbounded remainder fragments could be joined and parsed as one huge line. Track decoded size while chunks arrive, drop the buffer above 128 MiB, and terminate the session with a typed transport error. Tests inject a tiny limit.
Owner
Author
|
upstream is pingdotgg#12889 |
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.
What Changed
The Codex app-server JSONL reader now tracks decoded remainder size while stdin chunks arrive. If a line would exceed 128 MiB, it drops the buffer and terminates the provider session with a typed
CodexAppServerTransportErrorbeforejoinor JSON parse. Tests can inject a smallermaxIncomingMessageBytesceiling.Why
MAX_BUFFERED_RAW_MESSAGESonly bounds decoded queue depth. One huge provider line could still accumulate unbounded fragments, then allocate the full joined string and parsed object. Real Codex diffs have been near 49 million characters, so 16 MiB (Effect ndjson's default) would reject legitimate sessions. 128 MiB sits above those diffs and well below a V8 heap-threatening line.Checklist