Skip to content

feat(cli,gateway): /new accepts optional session name argument (salvage of #19555)#19637

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-e4d3b48d
May 4, 2026
Merged

feat(cli,gateway): /new accepts optional session name argument (salvage of #19555)#19637
teknium1 merged 2 commits into
mainfrom
hermes/hermes-e4d3b48d

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 4, 2026

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 module starts a new session named "Refactor auth module" — instead of /new then /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 bare except Exception: pass, silently swallowing the ValueError raised when a title is already in use by another session. A user typing /new Dup would get an untitled session with no feedback.

  • cli.py: catch ValueError from both sanitize_title() and set_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.
  • Added regression tests for the duplicate-title path on both surfaces.
  • scripts/release.py: map exx@example.com@exxmen for release notes.

Validation

scripts/run_tests.sh tests/cli/ tests/gateway/
5191 passed, 7 skipped, 1 pre-existing unrelated failure (tests/gateway/test_teams.py::test_send_typing)

E2E verified against a real SessionDB — duplicate titles correctly raise ValueError, sanitize strips zero-width/control chars to None, handler surfaces both paths.

Closes #19555.

Exx and others added 2 commits May 4, 2026 02:21
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.
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have labels May 4, 2026
@teknium1 teknium1 merged commit 5b6d413 into main May 4, 2026
9 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-e4d3b48d branch May 4, 2026 10:14
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 comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants