Repository navigation
fix(threads): keep spaces and line breaks in agent bus messages - #531
Merged
Merged
Conversation
Preserve prose whitespace in bus Markdown and expose source Copy and Quote actions on received messages, including mobile long-press menus. Guard real adapter, gateway storage and delivery paths against whitespace loss across child messages and streamed token boundaries. The exercised transport paths preserve the text; the original screenshot payload is still needed to establish its source. Related: #476
This was referenced Nov 13, 2026
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.
Received agent-bus cards now preserve prose spaces, tabs and line breaks while rendering Markdown lists and code. Web cards also offer Copy message (the original Markdown source) and Quote message; mobile uses the same long-press actions as agent answers, for both turn inputs and steered messages.
Cause and scope
The reproduced rendering issue was normal CSS whitespace collapsing repeated ASCII spaces and tabs. Reports on web and received inputs on mobile also omitted the Markdown single-line-break option. Preserve whitespace on prose blocks only, so component layout whitespace does not introduce gaps around list markers or code panels. Folded one-line previews retain their existing whitespace normalization. The audited preview helpers do not feed the full bodies of user, bot or agent messages, or notice text; ordinary agent prose retains its Markdown soft-line behavior.
No tested Canopy transport layer loses whitespace. The regression exercises the real Codex app-server JSON-RPC dispatcher (dynamic
item/tool/call, nativemcpToolCallitem notifications) and Claude SDK MCP schema plustool_usemapping. Codex supplies complete argument objects; Claude supplies complete SDK input. Canopy does not concatenate partial tool-argument JSON. Claude partialinput_json_deltaenvelopes are covered and do not replace the complete input. Text streams include whitespace-only deltas and tokens with leading/trailing spaces, such as" 4"and" views, overflow".The gateway schema does not trim
prompt; storage, gRPC delivery, protobuf/JSON serialization, text reducers and client coalescing preserve the exercised text byte for byte. This includes a real child-to-parent bus message through both queue and steer delivery. The #476 sanitizer only replaces NUL and lone surrogates with U+FFFD; it is unchanged.The screenshot's missing separators are not reproduced by these paths. Upstream/model-provided text is the likely source if the affected run used the same paths, but the original payload/transcript is still needed to establish that. This change does not claim to repair already-glued stored text. Copy now makes that original source available for diagnosis.
Validation
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check, and the web production build.TMPDIR=/var/tmp bun run check:tmp --max-concurrency 1: 2,219 passed, 163 skipped, 0 failed across 407 files (26,991 assertions); temp-directory cleanup check passed. Opt-in live-model tests were skipped.bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive: unchanged iOS6ddec9ef559ee0095ac33e94ff9418a942053b17and Android5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Mobile changes are JS only; no device runtime verification was performed.Copy audit (§8): bus cards had no actions → Copy message and Quote message, both verb-first English labels with accessible names. Existing mobile menu and quote-comment copy are reused; no new error or empty-state text. Checked with short and long sender names at desktop and phone widths. No new terminology or confirmation flow.
Related: #476