feat(cli,gateway): /new accepts optional session name argument (salvage of #19555)#19637
Merged
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.
The contributor's PR silently swallowed ValueError from SessionDB.set_session_title() with bare except Exception: pass. Users typing /new <title> with an already-in-use title got an untitled session and no feedback. Changes: - cli.py: catch ValueError from both sanitize_title() and set_session_title(); print the error and mark the session untitled in the banner (never echo the rejected title back). - gateway/run.py: append a warning note to the reset reply on title rejection; reflect the accepted title in the header. - Add regression tests for the duplicate-title path in CLI and gateway. Also map exx@example.com -> @exxmen in scripts/release.py.
5 tasks
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.
Salvages #19555 by @exxmen:
/new <name>starts a fresh session and titles it in one step.Original PR cherry-picked with authorship preserved; follow-up commit tightens error handling.
What it does
/new Refactor auth modulestarts a new session named "Refactor auth module" — instead of/newthen/title <name>. Works in both CLI and gateway.Follow-up fixes on top of the contributor's commit
The original PR wrapped
set_session_title()in bareexcept Exception: pass, silently swallowing theValueErrorraised when a title is already in use by another session. A user typing/new Dupwould get an untitled session with no feedback.cli.py: catchValueErrorfrom bothsanitize_title()andset_session_title(); print the error and never echo the rejected title in the success banner.gateway/run.py: append a warning note to the reset reply on title rejection; reflect the accepted title in the header.scripts/release.py: mapexx@example.com→ @exxmen for release notes.Validation
E2E verified against a real
SessionDB— duplicate titles correctly raiseValueError, sanitize strips zero-width/control chars toNone, handler surfaces both paths.Closes #19555.