Split codex app-server stdout on newline only - #2913
Open
JanderV wants to merge 1 commit into
Open
Conversation
node:readline also breaks lines on U+2028 and U+2029. Codex emits those characters unescaped inside JSON strings, so a thread/resume or thread/fork response for a thread whose history contains them was split into unparseable fragments. The pending request never resolved and failed with "codex app-server did not answer thread/resume within 60000ms". Read the child's stdout with a decoder and split on "\n" only.
Collaborator
|
@slopcop check |
Collaborator
|
@slopcop check please |
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.
Problem
Resuming or forking a Codex thread fails with
JSON-RPC request timed out: thread/resumewhen the thread history contains a raw U+2028 (LINE SEPARATOR) or U+2029, for example pasted email or WhatsApp text. Fresh threads work.createCodexAppServerConnectionreads the child's stdout withnode:readline, which also treats U+2028/U+2029 as line breaks. Codex emits those characters unescaped inside JSON strings, so thethread/resumeresponse (1.6 MB in my case) arrives as 17 unparseable fragments. The pending request never resolves and hitsCHILD_REQUEST_TIMEOUT_MS.Verified with
BB_PROVIDER_BRIDGE_RECORD_DIR: codex answered in 0.3 s, the bridge reported the 60 s timeout.Fix
Read stdout with a
StringDecoderand split on\nonly. Adds a regression test that spawns a fake server echoing a JSON line with a raw U+2028.Tested on bb 0.41.0 / codex 0.152.1: with this change the affected thread resumes in about 1 s.