Skip to content

fix: bare return in /new /clear /undo cancel causes CLI to exit#40314

Closed
yubingz wants to merge 1 commit into
NousResearch:mainfrom
yubingz:fix/new-cancel-exit
Closed

fix: bare return in /new /clear /undo cancel causes CLI to exit#40314
yubingz wants to merge 1 commit into
NousResearch:mainfrom
yubingz:fix/new-cancel-exit

Conversation

@yubingz

@yubingz yubingz commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

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", closing the terminal window.

Fix

Change all three cancellation returnreturn True so canceling keeps the session alive:

-                return
+                return True

Affected lines: cli.py:8600 (/clear), 8734 (/new), 8777 (/undo).

Steps to Reproduce

  1. Type /new in the interactive CLI
  2. Choose "Cancel" when asked to confirm
  3. CLI exits (terminal window closes)

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.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jun 6, 2026
@teknium1

teknium1 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Salvaged into #40583 with credit. Confirmed all three cancel sites (/clear, /new, /undo) and fixed them to return True. Thanks!

#40583

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants