Skip to content

UX gap: Esc cancels agent but clears typed input buffer #2972

@indeherb

Description

@indeherb

Describe the feature or problem you'd like to solve

When the agent is thinking or executing, typing a follow-up message in the input box and then pressing Esc to interrupt causes the typed text to be lost. There is no way to interrupt the agent mid-run while preserving the input buffer.

Proposed solution

Preserve the input buffer when Esc is pressed to cancel a running agent. The typed text should remain in the input box after cancellation, ready to be sent. This matches the natural user workflow of composing a follow-up while the agent is thinking, then interrupting to course-correct. It reduces frustration and accidental message loss, making the CLI feel more responsive and user-friendly.

Example prompts or workflows

  1. User sends a prompt, agent starts a long task. User realizes mid-run they forgot to mention a constraint — they type it in and press Esc to interrupt. Currently the message is lost; with this fix they can immediately send the correction.

  2. Agent is running a build or test suite. User types a follow-up question while waiting. They press Esc to cancel when they notice a mistake — their queued message survives and can be sent straight away.

  3. User is in a back-and-forth debugging session. Agent starts going in the wrong direction. User has already typed a redirect — pressing Esc to stop should not punish them for being proactive.

  4. User presses Esc by accident while typing. Currently this wipes their input. Preserving the buffer makes accidental cancellations recoverable.

Additional context

Alternatives they might suggest — and why they're not enough:

  1. Use Ctrl+S to send while the agent is running
    Ctrl+S submits the message immediately rather than queuing it — it doesn't let you interrupt a runaway agent first, then send. You lose control of sequencing.

  2. Just wait for the agent to finish, then type
    This defeats the purpose of an interactive CLI. Users shouldn't have to context-switch back to the keyboard only after the agent stops — the whole point is fluid, overlapping interaction.

  3. Use Ctrl+C to cancel
    Same problem as Esc — clears the input buffer. Not a solution, just a different key with the same destructive behaviour.

  4. Copy your text before pressing Esc
    This is a manual workaround that requires the user to anticipate a UX failure. Good UX shouldn't rely on users defending themselves against the tool.

  5. Use /rewind to recover
    /rewind reverts file changes and conversation turns — it doesn't restore a lost input buffer, and it's a heavy operation for what should be a trivial problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions