Escape Unicode separators in JSON-RPC lines - #1671
Open
georgecollier-nqu wants to merge 2 commits into
Open
Conversation
georgecollier-nqu
marked this pull request as ready for review
August 16, 2026 20:33
Contributor
Author
|
reviewed manually too |
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.
Current failure
BB uses one JSON object per line between the host daemon and each provider bridge.
Injected instructions can contain U+2028 or U+2029. These are valid Unicode line separator characters.
JSON.stringifyleaves each character literal inside the JSON string.readlinetreats each character as the end of a line.thread/startrequest becomes two incomplete lines before the bridge parses it.JSON.parsefailure and returns without a response.thread/starttimes out. Claude never starts.This failure occurs before BB starts Claude. It is a BB message framing bug, not a Claude Code failure.
Why BB must fix this
The input text is valid and must remain valid. It can come from these sources:
AGENTS.mdSanitizing each source would be fragile and could change user text. The JSON-RPC framing layer owns this requirement.
Escaping these characters keeps each message on one physical line.
JSON.parserestores the original Unicode text at the receiver.Fix
readline.Validation
pnpm exec vitest run src/runtime-json-rpc.test.ts --config vitest.config.tspnpm exec turbo run typecheck --filter=@bb/agent-runtime