fix(cli): wire /sessions slash command in the classic CLI - #25231
fix(cli): wire /sessions slash command in the classic CLI#25231explainanalyze wants to merge 1 commit into
Conversation
The 'sessions' command has been registered in the central command registry since NousResearch#20805 (May 2025) and surfaces in /help and tab-completion, but the classic CLI's process_command() never had an elif branch for it. The canonical name fell through and printed 'Unknown command: sessions'. The TUI side was wired up correctly via the SessionPicker overlay; only the legacy CLI was missing the dispatch. Adds _handle_sessions_command() which mirrors /resume's no-arg behavior inline (the CLI has no overlay primitive equivalent to the TUI picker): - /sessions and /sessions list → print the recent-sessions table - /sessions <id_or_title> → delegates to _handle_resume_command Includes regression tests covering the dispatcher wiring (the original bug) plus the three handler branches.
|
Surfacing the
If the design intent is for Happy to close this if you'd like to consolidate around one of the others - just say which. |
|
Salvaged into main as #25986 (#25986). Cherry-picked cleanly onto current main — your authorship preserved (git log shows phil.thomas@gametime.co). Also added you to scripts/release.py AUTHOR_MAP. Thanks for the fix — and the regression tests that lock the dispatcher wiring in place. |
|
Salvaged via #25987 (merged commit d6c488f). Your commit was cherry-picked onto current main with your authorship preserved in git log — thanks for the clean fix and thorough regression tests. Both Discord users in #help (one on Windows, one in WSL) had hit |
What does this PR do?
Wires
/sessionsinto the classic CLI'sprocess_command()dispatcher.The
sessionscommand has been in the centralCOMMAND_REGISTRYsince #20805 (May 2025) and surfaces in/help, tab-completion, and the gateway's known-commands list — but the legacy CLI never grew anelif canonical == "sessions"branch. The canonical name fell through and printedUnknown command: sessionseven though it was a registered, documented command. The TUI was wired up correctly via theSessionPickeroverlay (ui-tui/src/app/slash/commands/session.ts) and the gateway handlessessions browse(tui_gateway/server.py); onlycli.pywas missing.Adds
_handle_sessions_command()and an elif branch that routes to it. The classic CLI has no equivalent of the TUI's overlay primitive, so the no-arg behavior prints the same recent-sessions table that/resumealready shows when called with no target./sessions <id_or_title>delegates to_handle_resume_command()for behavioral parity with/resume.Related Issue
No existing issue — discovered while users hit
Unknown command: /sessionsin the running CLI in v0.13.0.Fixes the classic-CLI half of #20805 — that PR shipped the registry entry and TUI overlay but didn't wire the legacy
process_command()dispatcher.Type of Change
Changes Made
cli.py: add_handle_sessions_command(cmd_original)method right after_handle_resume_command(lines 5921-5951)cli.py: addelif canonical == "sessions"branch inprocess_command()next to the existingresumebranch (line 7486-7487)tests/cli/test_cli_init.py: four new regression tests inTestHistoryDisplay:test_sessions_command_no_args_lists_recent_sessions— no-arg branch prints recent table viaprocess_command()(locks in the dispatcher wiring)test_sessions_list_subcommand_lists_recent_sessions—/sessions listaliastest_sessions_with_target_delegates_to_resume—/sessions <id>→/resume <id>test_sessions_command_is_dispatched— direct dispatcher-wiring assertion (catches the original regression even if all the inner handler logic is mocked out)How to Test
git checkoutthis branch, install editable, runhermes(classic CLI, not--tui)./sessions— should print the recent-sessions table, notUnknown command./sessions list— same output as/sessions./sessions <some-session-title-or-id>— should resume that session (same as/resume <…>).pytest tests/cli/test_cli_init.py -k sessions -q— six tests pass (the five new ones plus the existingtest_resume_without_target_lists_recent_sessionswhich still passes unchanged).Checklist
Code
fix(cli):)pytest tests/cli/ tests/hermes_cli/test_session_browse.py tests/gateway/test_unknown_command.py -q→ 718 passedDocumentation & Housekeeping
cli-config.yaml.exampleCONTRIBUTING.md/AGENTS.mdScreenshots / Logs
Before (v0.13.0, classic CLI):
After (this PR):