Skip to content

fix: collapse newlines in permission prompt titles and render bash partial output via setExtra#271

Draft
michal-kopczynski wants to merge 1 commit into
masterfrom
LLM-1501-python-execution-snippets-mess-up-the-tui
Draft

fix: collapse newlines in permission prompt titles and render bash partial output via setExtra#271
michal-kopczynski wants to merge 1 commit into
masterfrom
LLM-1501-python-execution-snippets-mess-up-the-tui

Conversation

@michal-kopczynski
Copy link
Copy Markdown
Contributor

@michal-kopczynski michal-kopczynski commented May 16, 2026


Kimchi Summary

What changed

Fixes two TUI rendering bugs: partial bash tool output is now visible during streaming, and permission prompts no longer break layout when tool commands contain newlines.

Why

Partial bash results were being appended as children to a Container that ToolBlockView did not render, leaving the output invisible. Separately, raw newlines in bash commands and file paths were passed unmodified to ctx.ui.select, causing pi-tui to expand prompt rows and overlap surrounding UI elements.

Key changes

  • src/extensions/bash-collapse.ts: In renderResult(), replaced invisible Container child-addition with view.setExtra(...) on a ToolBlockView, rendering the last five lines of partial output while preserving the existing header.
  • src/extensions/permissions/prompts.ts: Added collapseNewlines() to replace line breaks with and applied it in describeCall() to input.command, input.path, and JSON.stringify(input) before display.
  • src/extensions/permissions/prompts.ts: Exported truncate() for direct unit testing.
  • src/extensions/permissions/prompts.test.ts: Added tests for truncate() and for newline sanitization in promptForApproval titles passed to ui.select.

@kimchi-review
Copy link
Copy Markdown

kimchi-review Bot commented May 16, 2026

Kimchi Code Review

Property Value
Commit 329aae6
Author @michal-kopczynski
Files changed 0
Review status Completed
Comments 0
Duration 39s

Summary

📊 Review Score: 92/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 2/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — New test file src/extensions/permissions/prompts.test.ts covers the truncate boundary logic and verifies newline sanitization for both bash and read-tool prompts. Tests are clear and directly exercise the changed behavior.

No significant issues found. LGTM! 🎉

What to expect

Kimchi will analyze the changes in this pull request and post:

  • A summary of the overall changes
  • Inline comments on specific lines with findings categorized by issue type

The review typically completes within a few minutes. This comment will be updated once the review is ready.

Interact with Kimchi
  • @kimchi review — re-trigger a full review on the latest commit
  • @kimchi summary — regenerate the PR summary
  • @kimchi ignore — skip this PR (no review will be posted)
  • Reply to any inline comment to ask follow-up questions or request clarification
Configuration

Reviews are configured by your organization admin.
Review instructions, excluded directories, and severity thresholds can be adjusted per repository in the Kimchi dashboard.


Powered by Kimchi — AI-powered code review by CAST AI

Copy link
Copy Markdown

@kimchi-review kimchi-review Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Review Score: 92/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 2/5 (1 = trivial, 5 = very complex)

🧪 Tests: yes — New test file src/extensions/permissions/prompts.test.ts covers the truncate boundary logic and verifies newline sanitization for both bash and read-tool prompts. Tests are clear and directly exercise the changed behavior.

No significant issues found. LGTM! 🎉

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