Skip to content

fix(tui): prevent whitespace-only prompt from being submitted #32631

Closed as not planned

Description

@Makochaaan

Summary

The TUI prompt can be submitted when it contains only whitespace (spaces, tabs, newlines), which sends an effectively empty message to the session.

Root Cause

In packages/tui/src/component/prompt/index.tsx, the submit guard checks:

if (!store.prompt.input) return false

This only blocks a completely empty string. A string of whitespace characters (" ", "\t", etc.) is truthy and passes the check, resulting in a blank user message being sent.

Fix

Change the guard to trim whitespace before checking:

if (!store.prompt.input.trim()) return false

The trimmed value is already computed two lines below for command detection, so this is a minimal, safe change.

Steps to Reproduce

  1. Open the TUI.
  2. Type one or more spaces in the prompt.
  3. Press Enter.
  4. Observe that a blank user message bubble appears and the session receives an empty prompt.

Expected Behavior

Pressing Enter on a whitespace-only prompt should do nothing (same behavior as an empty prompt).

Activity

  1. github-actions commented on Jun 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. added a commit that references this issue on Jun 17, 2026
    c27a50e
  3. github-actions commented on Aug 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions