Skip to content

fix(threads): keep spaces and line breaks in agent bus messages - #531

Merged
nixuuu merged 1 commit into
devfrom
fix/bus-message-whitespace
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/bus-message-whitespace

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

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, native mcpToolCall item notifications) and Claude SDK MCP schema plus tool_use mapping. Codex supplies complete argument objects; Claude supplies complete SDK input. Canopy does not concatenate partial tool-argument JSON. Claude partial input_json_delta envelopes 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.
  • Four gateway–worker whitespace cases: Codex/Claude × queued/steered child messages; PostgreSQL arguments and receiver input, delivery, UI snapshot, and live coalesced replay. NBSP, narrow NBSP, thin/figure spaces, ASCII spaces, tabs, LF, CRLF, lists and code are included.
  • 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.
  • Real browser: light/dark, 1280 px desktop and 390 px phone; additional 320 px overflow and quote-dialog check. Expanded/folded cards, short/long text, lists, code, original-source Copy handler, whole-message/selection Quote, save/cancel, and focus restoration. Clipboard reads are denied by the browser harness; the Copy handler's exact argument was captured instead. Temporary fixture and server removed; screenshots kept outside the repository.
  • bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive: unchanged iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17 and Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. 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

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
@nixuuu
nixuuu merged commit a7480af into dev Nov 10, 2026
10 checks passed
@nixuuu
nixuuu deleted the fix/bus-message-whitespace branch November 10, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant