Skip to content

fix(tui): keep permission prompt buttons visible for long commands - #41216

Open
KDB-Wind wants to merge 2 commits into
anomalyco:devfrom
KDB-Wind:permission-scroll
Open

fix(tui): keep permission prompt buttons visible for long commands#41216
KDB-Wind wants to merge 2 commits into
anomalyco:devfrom
KDB-Wind:permission-scroll

Conversation

@KDB-Wind

@KDB-Wind KDB-Wind commented Aug 8, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #40793

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI permission prompt rendered command text as a plain <text> node with no wrapping and no height limit. A long shell command pushed the Allow/Reject buttons off-screen, so the request could not be answered. The desktop app has the same bug (#40968).

All text-based permission bodies (bash, task, webfetch, websearch, read, glob, grep, list) now render in a bounded scrollbox with wrapMode="word". The buttons stay visible; long content scrolls instead of overflowing.

How did you verify your code works?

  • Added packages/tui/test/cli/tui/permission-prompt.test.tsx. It mounts PermissionPrompt, injects a permission request via message.part.updated, and checks that:
    • a 2000+ char command keeps all three buttons visible and its tail outside the viewport
    • a command with a single unbroken 2000+ char token does the same
    • a long read path keeps the buttons visible
    • a short command renders fully
  • The long-command test fails with the old plain <text> rendering and passes with the fix (verified both ways).
  • bun run typecheck in packages/tui: clean.
  • Full packages/tui suite: 196 pass. One pre-existing Windows-only failure in runtime.test.tsx, unrelated.

Screenshots / recordings

Rendered with the TUI renderer test harness (15-row terminal, long heredoc commit command).

Before (dev): command text is clipped with no scrollbar, the tail is unreachable.

┃
┃  △ Permission required
┃    # Shell command
┃
┃  $ git commit -m "$(cat <<'EOF'
┃  fix: long description line fix: long description line fix: long description line fix: long
┃  description line fix: long description line fix: long description line fix: long description
┃  line fix: long description line fix: long description line fix: long description line fix:
┃  long description line fix: long description line fix: long description line fix: long
┃  description line fix: long description line fix: long description line fix: long description
┃  line fix: long description line fix: long description line fix: long description line fix:
┃
┃
┃   Allow once   Allow always   Reject                 ctrl+f fullscreen  ⇆ select  enter confirm
┃

After (this PR): the body is a bounded scroll area with a scrollbar; the full command is reachable and the buttons stay visible.

┃
┃  △ Permission required
┃    # Shell command
┃
┃  $ git commit -m "$(cat <<'EOF'                                                               █
┃  fix: long description line fix: long description line fix: long description line fix: long   █
┃  description line fix: long description line fix: long description line fix: long description █
┃  line fix: long description line fix: long description line fix: long description line fix:   ▀
┃  long description line fix: long description line fix: long description line fix: long
┃  description line fix: long description line fix: long description line fix: long description
┃  line fix: long description line fix: long description line fix: long description line fix:
┃
┃
┃   Allow once   Allow always   Reject                 ctrl+f fullscreen  ⇆ select  enter confirm
┃

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Permission prompt buttons unreachable for very long shell commands

1 participant