Skip to content

[BUG] [cortex] TUI welcome card says Esc cancels, but idle Esc silently arms quit with no visible warning #53295

@haha12-ai

Description

@haha12-ai

Project

cortex

Description

In the native interactive Cortex TUI, the startup welcome card tells the user:

Use Tab for autocomplete. Press Esc to cancel.
But on that same idle welcome screen, pressing Esc does not show any visible cancel action.

Instead, the first idle Esc press silently arms the double-Esc quit path, and the user-visible warning that should explain that state is never rendered.

Visible result:

launch the native Cortex TUI,
reach the normal welcome/input screen,
do not open autocomplete and do not start streaming,
press Esc once,
nothing visible changes,
press Esc again quickly,
the TUI can exit even though no visible Press ESC again to quit warning was shown after the first keypress.
So the welcome screen advertises Esc as a cancel key, while the real idle behavior silently primes quit without surfacing the warning that would make that behavior understandable.

Root Cause
The welcome card hardcodes a broad keyboard tip:

src/cortex-tui/src/views/minimal_session/rendering.rs
Use Tab for autocomplete. Press Esc to cancel.
The idle Esc handler actually routes to the double-tap quit path:

src/cortex-tui/src/runner/event_loop/input.rs
when no subagent view, streaming, queued messages, pending approval, or autocomplete is active,
handle_esc() calls self.app_state.handle_esc()
on the first press it queues self.app_state.toasts.info("Press ESC again to quit")
And the quit timer is real:

src/cortex-tui/src/app/methods.rs
handle_esc() stores last_esc
a second Esc within 500ms calls self.quit()
But toast rendering is currently disabled:

src/cortex-tui/src/runner/event_loop/rendering.rs
the toast widget render block is commented out under // Toast notifications disabled
So the first idle Esc press does not show the warning that the code intends to surface, leaving the user with:

a welcome tip that says Esc cancels
an internal quit timer
and no visible explanation in between

Error Message

Debug Logs

System Information

- Cortex `v0.0.7`
- Platform: Linux terminal

Screenshots

570927968-beaca63b-f11a-4fe6-b479-da16ca913763.mov

Steps to Reproduce

cd /opt/177/cortex
cargo build -p cortex-cli --no-default-features --features cortex-tui --bin Cortex
export CORTEX_API_KEY=dummy
./target/debug/Cortex

Then:

  1. approve the trust screen if it appears,
  2. wait for the normal welcome/input screen,
  3. without opening autocomplete, press Esc once,
  4. observe that no visible warning appears,
  5. press Esc again quickly.

Expected Behavior

If the welcome screen says Press Esc to cancel, then idle Esc should either:

perform a visible cancel action,
do nothing,
or clearly show that it has switched into a quit-confirmation flow.
The first idle Esc press should not silently arm quit state with no visible feedback.

Actual Behavior

The first idle Esc press can arm the quit timer, but no visible Press ESC again to quit warning is shown.

That makes the second Esc capable of exiting the TUI without the user ever seeing the expected warning.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions