…ssion exit
A Ctrl+C during a slow slash command (e.g. /skills browse on a large
skill tree, /sessions list against a multi-GB SQLite DB) used to unwind
past self.process_command() to the outer prompt_toolkit event loop,
which killed the entire session — losing all conversation state.
Fix: wrap the slash-command dispatch in try/except KeyboardInterrupt
so Ctrl+C aborts the command but the prompt loop continues. Other
exceptions still propagate so real bugs aren't silently swallowed.
Surgical reapply of PR #5189. Original branch was many months stale
(3764 files / 1M+ LOC of unrelated reverts); the substantive ~6 LOC
change in cli.py was reapplied by hand onto current main with the
contributor's authorship preserved via --author.
Summary
Ctrl+C during a slow slash command (
/skills browse,/sessions listagainst a large SQLite DB,/historyon long conversations) no longer kills the session. Previously the KeyboardInterrupt unwound pastself.process_command()to the outer prompt_toolkit event loop, losing all conversation state.Fix
Wrap the slash-command dispatch in
try / except KeyboardInterruptso Ctrl+C aborts the command and returns to the prompt without taking the session with it. Other exceptions still propagate normally so real bugs aren't silently swallowed.Changes
cli.py— 6 lines of try/except KeyboardInterrupt aroundself.process_command(user_input)in the dispatch shape at line ~14236.tests/cli/test_slash_command_interrupt.py— 4 tests covering: KBI during slash command leaves_should_exitFalse; truthy return keeps session alive; falsy return still sets exit (the legit/exitpath); non-KBI exceptions propagate normally.Validation
/skills browse+ Ctrl+C/sessions list+ Ctrl+C/exit(returns False)Targeted tests:
tests/cli/test_slash_command_interrupt.py— 4/4 passing.Salvage notes
Surgical reapply of PR #5189 by @ygd58 (commit
9437a46f9,buraysandro9@gmail.com). The original branch was many months stale against currentmainand a direct cherry-pick would have reverted 3,764 unrelated files (−1,084,940 LOC), including the entire kanban tutorial, image assets, dozens of skill files, and hundreds of test files. The substantive ~6 LOC change incli.pyplus a new 113-line test file were reapplied by hand onto currentmainwith the contributor's authorship preserved viagit commit --author=.Original PR #5189 will be closed pointing to this one.
Infographic
https://v3b.fal.media/files/b/0a9b9dd5/f7dMP6Uh5eFm7_U0El0KC_ZPtXi4CE.png