fix(cli): return bool (not None) when a destructive-slash confirmation is cancelled (#40583)

process_command() is typed -> bool, but the /clear, /new, and /undo
cancel paths did a bare `return` (None) when _confirm_destructive_slash
was declined, leaking None through the bool contract. Return True
(command handled, keep the REPL alive) on cancel.

Co-authored-by: yubingz <yubingz@users.noreply.github.com>
This commit is contained in:
Teknium 2026-06-07 02:49:28 -07:00 committed by GitHub
parent 0507e4630d
commit 136dae779e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

6
cli.py
View file

@ -8850,7 +8850,7 @@ class HermesCLI:
"The current conversation history will be discarded.",
cmd_original=cmd_original,
) is None:
return
return True # confirmation cancelled — command handled, keep REPL alive
self.new_session(silent=True)
_clear_output_history()
# Clear terminal screen. Inside the TUI, Rich's console.clear()
@ -8984,7 +8984,7 @@ class HermesCLI:
"The current conversation history will be discarded.",
cmd_original=cmd_original,
) is None:
return
return True # confirmation cancelled — command handled, keep REPL alive
self.new_session(title=title)
elif canonical == "resume":
self._handle_resume_command(cmd_original)
@ -9027,7 +9027,7 @@ class HermesCLI:
_undo_desc,
cmd_original=cmd_original,
) is None:
return
return True # confirmation cancelled — command handled, keep REPL alive
self.undo_last(_undo_n)
elif canonical == "branch":
self._handle_branch_command(cmd_original)