feat(cli,gateway): /new accepts optional session name argument#19555
Closed
exxmen wants to merge 1 commit into
Closed
feat(cli,gateway): /new accepts optional session name argument#19555exxmen wants to merge 1 commit into
exxmen wants to merge 1 commit into
Conversation
Allow users to start a fresh session and immediately set its title by
passing a name to /new (or /reset):
/new Refactor auth module
Changes:
- hermes_cli/commands.py: add args_hint='[name]' to /new command
- cli.py: parse title argument in process_command(), pass to new_session()
- cli.py: new_session() accepts title=None, sets title via SessionDB
- gateway/run.py: _handle_reset_command() parses title, sets on new entry
- gateway/session.py: reset_session() accepts optional display_name
- tests: add test_new_session_with_title, test_reset_command_with_title,
test_new_command_in_help_output
All 36 affected tests pass.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional naming to fresh-session commands so users can start/reset a session and set its title in a single step (/new <name> / /reset <name>), aligning CLI + gateway behavior with existing session title infrastructure.
Changes:
- Expose an optional
[name]arg hint for/newin the shared slash-command registry. - Parse
/new <name>in CLI and gateway reset handler, sanitize, and attempt to persist viaSessionDB.set_session_title(...). - Add regression tests covering CLI
/newtitle setting and gateway/newhelp output + title setting.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
hermes_cli/commands.py |
Advertises optional [name] argument for /new in help/autocomplete outputs. |
cli.py |
Parses /new <name> and threads an optional title into new_session(...), attempting to sanitize + persist it. |
gateway/run.py |
Parses /new <title> args in _handle_reset_command and attempts to sanitize + persist the title for the new session. |
gateway/session.py |
Extends SessionStore.reset_session() to accept an optional display_name for the new SessionEntry. |
tests/cli/test_cli_new_session.py |
Adds a test asserting new_session(title=...) calls set_session_title and prints the title. |
tests/gateway/test_title_command.py |
Adds tests for /new <title> behavior and /new [name] help output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+4986
to
+4994
| if title and self._session_db: | ||
| try: | ||
| from hermes_state import SessionDB | ||
| sanitized = SessionDB.sanitize_title(title) | ||
| if sanitized: | ||
| self._session_db.set_session_title(self.session_id, sanitized) | ||
| self._pending_title = None | ||
| except Exception: | ||
| pass |
Comment on lines
+5014
to
+5017
| if title: | ||
| print(f"(^_^)v New session started: {title}") | ||
| else: | ||
| print("(^_^)v New session started!") |
Comment on lines
+6879
to
+6886
| if _title_arg and self._session_db and new_entry: | ||
| try: | ||
| from hermes_state import SessionDB | ||
| sanitized = SessionDB.sanitize_title(_title_arg) | ||
| if sanitized: | ||
| self._session_db.set_session_title(new_entry.session_id, sanitized) | ||
| except Exception: | ||
| pass |
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.
What
Allow
/new <name>and/reset <name>to start a fresh session and immediately set its title, collapsing a two-step dance into one command.Why
Right now users who start a session with a specific purpose must run
/newfollowed by/title <name>. This is friction that other tools (e.g., Claude Code's/rename) already eliminate. Hermes already has robust title handling \u2014 we just need to expose it at session creation time.Changes
hermes_cli/commands.pyargs_hint="[name]"to/newcli.pyprocess_command()parses title, passes tonew_session(title=...);new_session()sanitizes and sets viaSessionDB.set_session_title()gateway/run.py_handle_reset_command()parses title and sets on new sessiongateway/session.pyreset_session()accepts optionaldisplay_nametests/cli/test_cli_new_session.pytest_new_session_with_titletests/gateway/test_title_command.pytest_reset_command_with_title,test_new_command_in_help_outputEdge cases handled
SessionDB.sanitize_title()_session_db\u2192 skips gracefully/resetalias works, all existing tests passTesting
Result: 36 passed, 0 failed
Checklist
feat/description)origin/main