Skip to content

fix(cli): resume the selected chat when a bare number follows /resume#34588

Closed
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/resume-numbered-selection-34584
Closed

fix(cli): resume the selected chat when a bare number follows /resume#34588
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/resume-numbered-selection-34584

Conversation

@Bartok9

@Bartok9 Bartok9 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • /resume (no args) now arms a one-shot prompt so typing just a number on the next line resumes that session.
  • Fixes the natural list-then-pick flow that previously sent the number to the agent as chat.

Motivation

Closes #34584.

Running bare /resume prints the recent-sessions list and tells the user to "Use /resume ". But it armed no selection state, so when the user typed just 3 on the next line, the digit was routed to the agent as a normal chat message and no session was resumed. (/resume 3 always worked — only the natural list-then-type-a-number flow was broken.)

The fix arms self._pending_resume_sessions when bare /resume shows the list, then consumes the next bare numeric input as the selection. It is one-shot: any other input (free text, another slash command, blank) disarms it so a later number the user means as chat is never hijacked. Out-of-range numbers are reported, not sent to the agent. Index resolution goes through the same _list_recent_sessions(limit=10) list used everywhere else, so the displayed numbers and the resolved sessions always match.

The single intercept lives in process_loop where _pending_input is consumed, which covers both the prompt_toolkit TUI path (idle input is queued to _pending_input) and the fallback input loop.

Verification

  • python3 -m pytest tests/cli/test_cli_resume_command.py — 12 passed (5 existing + 7 new)
  • New tests cover: arming on bare /resume, not arming when no sessions exist, numbered selection resuming, out-of-range handling, non-numeric fall-through + disarm, no-pending no-op, and disarm-on-other-command.
  • python3 -m pytest tests/cli/test_resume_quiet_stderr.py tests/hermes_cli/test_tui_resume_flow.py — pass.

Note for maintainers (pre-existing, unrelated)

tests/cli/test_resume_quiet_stderr.py::test_session_not_found_goes_to_stdout_in_full_mode fails when run after tests/cli/test_cli_init.py in the same process — on clean origin/main as well as on this branch (verified by git stash). It passes in isolation. This is pre-existing cross-test state pollution, independent of this change; flagging rather than absorbing it.

A bare `/resume` printed the recent-sessions list but armed no selection
state, so typing just `3` on the next line was sent to the agent as chat
instead of resuming session #3. `/resume 3` worked, but the natural
list-then-pick flow did not.

Arm a one-shot pending-resume prompt when bare `/resume` shows the list,
and consume the next bare numeric input as the selection (out-of-range is
reported, non-numeric/other commands disarm it). Resolves against the same
_list_recent_sessions(limit=10) list used everywhere else.

Closes NousResearch#34584.
@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 May 29, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #34834. Your commit was cherry-picked onto current main with your authorship preserved in git log (edfdc77). I added a small follow-up fix for an unrelated pre-existing CI flake (test_notification_poller_requeues_when_busy raced on the process-global completion_queue under parallel load). Thanks for the clean fix and the precise root-cause writeup.

@teknium1 teknium1 closed this May 29, 2026
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.

bug: /resume numbered selection does not resume chat

3 participants