From da1ae6b5d776e5ac032572cb06c4d533a0c8a425 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 27 May 2026 11:12:32 -0700 Subject: [PATCH 1/2] cli-29: finally fix interruption exception on acompletion --- cecli/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cecli/models.py b/cecli/models.py index 4148682b44b..b9ddccca402 100644 --- a/cecli/models.py +++ b/cecli/models.py @@ -1378,6 +1378,11 @@ async def simple_send_with_retries( continue except AttributeError: return None + except KeyboardInterrupt: + # An interrupt was not caught within the async run loop. + # We'll just pass to allow the thread to exit gracefully + # without a scary traceback. + pass def model_error_response(self): return litellm.ModelResponse( From 3cdd958b99110a6c3f68a7139ed6806d5b4a8493 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 27 May 2026 20:58:05 -0700 Subject: [PATCH 2/2] fix: Catch BaseException in worker thread to prevent tracebacks Co-authored-by: cecli (openai/gemini_cli_local/gemini-2.5-pro) --- cecli/tui/worker.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cecli/tui/worker.py b/cecli/tui/worker.py index 259ca0775eb..5a19e1567a4 100644 --- a/cecli/tui/worker.py +++ b/cecli/tui/worker.py @@ -49,10 +49,9 @@ def _run_thread(self): try: self.loop.run_until_complete(self._async_run()) - except asyncio.CancelledError: - pass - except RuntimeError: - # Event loop stopped - this is expected during shutdown + except BaseException: + # Catch anything that could bring down the thread, and just let it exit. + # This includes KeyboardInterrupt, SystemExit, etc. pass finally: self._cleanup_loop() @@ -188,11 +187,6 @@ def stop(self): # We'll just pass to allow the thread to exit gracefully # without a scary traceback. pass - except KeyboardInterrupt: - # An interrupt was not caught within the async run loop. - # We'll just pass to allow the thread to exit gracefully - # without a scary traceback. - pass self.interrupt() # Wait for thread to finish