Skip to content

Conversation

@marius-kilocode
Copy link
Collaborator

Provides instant visual feedback when pressing ESC or Ctrl+X to cancel tasks. This significantly improves the responsiveness of the CLI for the user when cancelling.

Changes:

  • Added optimistic UI state (isCancellingAtom) to show "Cancelling..." immediately
  • Reduced escapeCodeTimeout from 500ms to 0ms for instant ESC recognition
  • Added 10s safety timeout to prevent stuck state

@changeset-bot
Copy link

changeset-bot bot commented Dec 30, 2025

🦋 Changeset detected

Latest commit: 802de51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Dec 30, 2025

✅ No Issues Found

9 files reviewed | Confidence: 95% | Recommendation: Merge

Review Details

Files Reviewed:

  • .changeset/cli-esc-cancellation-feedback.md - Changeset entry
  • cli/src/state/atoms/__tests__/cancelling.test.ts - New test file
  • cli/src/state/atoms/actions.ts - Sets isCancellingAtom in cancelTaskAtom
  • cli/src/state/atoms/keyboard.ts - Adds cancelling state on ESC/Ctrl+X
  • cli/src/state/atoms/ui.ts - New isCancellingAtom definition
  • cli/src/ui/components/StatusIndicator.tsx - UI for cancelling state with safety timeout
  • cli/src/ui/components/__tests__/StatusIndicator.test.tsx - Component tests
  • cli/src/ui/providers/KeyboardProvider.tsx - escapeCodeTimeout reduced to 0ms
  • cli/vitest.config.ts - Added .test.tsx pattern

Checked: Security, bugs, performance, error handling, state management

Notes:

  • Clean implementation of optimistic UI pattern for cancellation feedback
  • Proper cleanup of timeouts to prevent memory leaks
  • Good test coverage for new functionality
  • The escapeCodeTimeout=0 change is well-justified in comments - Kitty protocol sequences are sent atomically
  • Minor redundancy: isCancellingAtom is set both in keyboard.ts handlers and in cancelTaskAtom, but this is harmless

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Dec 30, 2025

✅ No Issues Found

9 files reviewed | Confidence: 95% | Recommendation: Merge

Review Details

Files Reviewed:

  • .changeset/cli-esc-cancellation-feedback.md - Changeset for patch release
  • cli/src/state/atoms/__tests__/cancelling.test.ts - New tests for isCancellingAtom
  • cli/src/state/atoms/actions.ts - Sets isCancellingAtom in cancelTaskAtom
  • cli/src/state/atoms/keyboard.ts - ESC/Ctrl+X handlers set isCancellingAtom
  • cli/src/state/atoms/ui.ts - New isCancellingAtom definition
  • cli/src/ui/components/StatusIndicator.tsx - Shows "Cancelling..." with safety timeout
  • cli/src/ui/components/__tests__/StatusIndicator.test.tsx - Tests for cancelling UI
  • cli/src/ui/providers/KeyboardProvider.tsx - escapeCodeTimeout changed to 0ms
  • cli/vitest.config.ts - Added .test.tsx pattern

Checked: Security, bugs, performance, error handling

Notes:

  • The isCancellingAtom is set in both keyboard.ts handlers and cancelTaskAtom - this is redundant but harmless (idempotent)
  • The 10-second safety timeout is a good defensive measure to prevent stuck UI state
  • The escapeCodeTimeout=0 change is safe because Kitty protocol sequences are sent atomically by terminals
  • Good test coverage for the new functionality

@marius-kilocode marius-kilocode enabled auto-merge (squash) December 30, 2025 18:34
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.

3 participants