Skip to content

Feature Request: Escape key to interrupt a running agent turn #3196

@amazd

Description

@amazd

Summary

Currently, the only way to stop the harness mid-run is Ctrl+C, which kills the entire process.
Claude Code supports pressing Escape to gracefully interrupt an in-progress agent turn
without exiting the session.

Current behavior

  • input.rs binds Ctrl+C → ReadOutcome::Cancel / ReadOutcome::Exit
  • No KeyCode::Esc binding exists during an active turn
  • No in-flight request cancellation is wired up

Desired behavior

Press Escape while the agent is running to:

  1. Cancel the active API request
  2. Transition the worker state from RunningInterrupted
  3. Return control to the REPL prompt without exiting the session

Implementation sketch

  • Detect KeyCode::Esc in rusty-claude-cli/src/input.rs during an active turn
  • Add an Interrupted state to the worker lifecycle in runtime/
  • Cancel the in-flight HTTP request (e.g., via a CancellationToken)
  • Emit a cancellation event for observability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions