Skip to content

feat(chat): preserve single newlines for ZCode replies - #140

Open
Ni7e wants to merge 1 commit into
maddada:mainfrom
Ni7e:fix/zcode-preserve-line-breaks
Open

Ni7e wants to merge 1 commit into
maddada:mainfrom
Ni7e:fix/zcode-preserve-line-breaks

Conversation

@Ni7e

@Ni7e Ni7e commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Problem: ZCode replies render differently in the Ghostex chat view than in the ZCode terminal. The TUI paints every soft-break newline as its own row (glyph status lines, emoji lists, em-space indentation), but the chat view collapsed the same message into one flowing paragraph, scattering the indentation mid-sentence.

Root cause: sessionChatPreservesAgentLineBreaks is an opt-in allowlist per agent family. The feature landed in 6cf849b (2026-09-14) listing Pi, Hermes, and Antigravity; ZCode became a chat agent family one day later (94f62db) and was never added. remarkSessionChatHardBreaks therefore never fires for ZCode transcripts.

Fix: add zcode to the family check, and refresh the CDXC:SessionChat WHY/DECISION comments. The 2026-09-14 decision to leave Claude, Codex, Grok Build, and Cursor unchanged is untouched — ZCode simply was not covered by it.

Verification: root tsc --noEmit passes (the only errors are pre-existing @/apps/web/... resolutions from an uninitialized submodule in my worktree, reproducible without this change). Rendering behavior for ZCode now matches the existing Pi/Hermes/Antigravity treatment: one rendered row per source line, paragraph breaks on blank lines.

Note

Preserve single newlines for ZCode replies in sessionChatPreservesAgentLineBreaks

Extends the agent-family predicate in session-chat-presentation-provider.tsx to return true when the transcript family is zcode, so ZCode assistant replies keep single newlines. Updates the SessionChatAgentLineBreaksContext comment to document ZCode's one-row-per-line TUI behavior.

Macroscope summarized d3f8bdb.

Summary by CodeRabbit

  • Bug Fixes
    • ZCode assistant responses now preserve single line breaks instead of collapsing them into a single paragraph.
    • Existing terminal formatting behavior remains unchanged.

The preserve-line-breaks allowlist landed 2026-09-14, one day before
ZCode became a chat agent family, so ZCode was never added to it. The
ZCode TUI paints every soft-break newline as its own row, while the chat
collapsed those replies into one flowing paragraph with the glyph-list
indentation scattered mid-sentence.

Add the zcode family to sessionChatPreservesAgentLineBreaks and refresh
the CDXC comments (the Claude/Codex/Grok Build/Cursor exclusion from
2026-09-14 is unchanged).
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e339c67c-20da-4afd-b161-4ea1fa1ddcaf

📥 Commits

Reviewing files that changed from the base of the PR and between 9e308c3 and d3f8bdb.

📒 Files selected for processing (1)
  • packages/core-ui/chat/session-chat-presentation-provider.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The chat presentation provider now preserves single newlines in ZCode assistant replies. The related documentation identifies ZCode as a preserving agent family and records unchanged OMP terminal behavior.

Changes

ZCode line-break handling

Layer / File(s) Summary
Preserve ZCode line breaks
packages/core-ui/chat/session-chat-presentation-provider.tsx
sessionChatPreservesAgentLineBreaks now returns true for the zcode agent family. The documentation comment lists ZCode with the existing preserving terminals and notes unchanged behavior for other terminals.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: maddada

Merge Risk: ⚪ Minimal · up to d3f8b

No actionable correctness or availability risk is established for this focused rendering change.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving single newlines in ZCode chat replies.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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