Skip to content

CLI-6: Fix Keyboard Interruption Handling#485

Merged
dwash96 merged 1 commit intocecli-dev:v0.99.2from
szmania:cli-6-interruption-fix
Apr 15, 2026
Merged

CLI-6: Fix Keyboard Interruption Handling#485
dwash96 merged 1 commit intocecli-dev:v0.99.2from
szmania:cli-6-interruption-fix

Conversation

@szmania
Copy link
Copy Markdown

@szmania szmania commented Apr 14, 2026

Summary

This PR implements proper keyboard interruption handling for LLM completions and IO operations.

Changes Made

1. Interruptible LLM Completion (cecli/coders/base_coder.py)

  • Added interrupt_event asyncio.Event() to track interruptions
  • Implemented proper cancellation of LLM completion tasks when interrupted using asyncio.wait() with FIRST_COMPLETED
  • Added proper cleanup for cancelled tasks to prevent resource leaks
  • Ensures clean KeyboardInterrupt handling without partial responses or garbage errors

2. IO Interruption Propagation (cecli/io.py)

  • Added mechanism to propagate interruption events to the coder
  • Ensures that keyboard interrupts are properly handled at the IO level
  • Maintains prompt session state during interruptions

Problem Solved

Before this change, keyboard interrupts could leave the system in an inconsistent state, potentially causing:

  • Partial LLM responses being processed
  • Resource leaks from incomplete async operations
  • Garbage error messages
  • Inconsistent prompt session state

Testing

The changes have been tested with:

  • Manual keyboard interruption during LLM completions
  • Verification of clean state after interruption
  • Confirmation that prompt sessions maintain consistency

Related Issue

Fixes CLI-6: Improve interruption handling to prevent garbage errors and partial responses.

@dwash96 dwash96 changed the base branch from main to v0.99.2 April 15, 2026 11:46
@dwash96 dwash96 merged commit 9688876 into cecli-dev:v0.99.2 Apr 15, 2026
12 checks passed
@dwash96 dwash96 mentioned this pull request Apr 15, 2026
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.

2 participants