fix: bare return in /new /clear /undo cancel causes CLI to exit#40314
Closed
yubingz wants to merge 1 commit into
Closed
fix: bare return in /new /clear /undo cancel causes CLI to exit#40314yubingz wants to merge 1 commit into
yubingz wants to merge 1 commit into
Conversation
process_command() is declared -> bool. The main loop treats any
falsy return as an exit signal:
if not self.process_command(user_input):
self._should_exit = True
When the user cancels the destructive confirmation for /new, /clear,
or /undo, _confirm_destructive_slash() returns None and the bare
return leaks that None through process_command() — which the caller
interprets as "exit the CLI".
Change all three cancellation returns to return True so canceling
keeps the session alive.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
process_command()is declared-> bool. The main loop treats any falsy return as an exit signal:When the user cancels the destructive confirmation for
/new,/clear, or/undo,_confirm_destructive_slash()returnsNoneand the barereturnleaks thatNonethroughprocess_command()— which the caller interprets as "exit the CLI", closing the terminal window.Fix
Change all three cancellation
return→return Trueso canceling keeps the session alive:Affected lines: cli.py:8600 (
/clear), 8734 (/new), 8777 (/undo).Steps to Reproduce
/newin the interactive CLI