fix(cli): resume selected chat when a bare number follows /resume#34834
Merged
Conversation
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 #34584.
test_notification_poller_requeues_when_busy drained and reused the process-global process_registry.completion_queue, so a concurrent test in the same xdist worker could put/get on the shared singleton mid-run and empty the event the poller requeues — flaking 'assert not completion_queue.empty()' under parallel CI load only. Monkeypatch a fresh Queue onto the singleton for the test's duration so nothing external can interleave. The poller reads completion_queue by attribute at runtime, so the isolated queue is what it operates on. monkeypatch restores the original on teardown. Verified immune: 50/50 passes under a background thread hammering the global queue.
Contributor
🔎 Lint report:
|
Collaborator
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.
Summary
Bare
/resumenow arms a one-shot prompt so typing just a number on the next line resumes that session — the natural list-then-pick flow.Salvage of #34588 by @Bartok9, cherry-picked onto current
mainwith authorship preserved.Root cause
Running
/resume(no args) printed the recent-sessions list and said "Use /resume ", but armed no selection state. When the user typed bare3on the next line, the digit fell through to the agent as a normal chat message and nothing resumed. (/resume 3always worked — only list-then-type-a-number was broken.)Changes
cli.py: bare/resumestashes_pending_resume_sessions;process_loopintercepts the next bare number before chat routing via_consume_pending_resume_selection. One-shot — any other input (free text, another command, blank) disarms it, so a later number meant as chat is never hijacked. Index resolution reuses_list_recent_sessions(limit=10), so displayed numbers always match resolved sessions. Out-of-range numbers are reported, not sent to the agent.tests/cli/test_cli_resume_command.py: +7 tests (arm on bare/resume, no-arm when no sessions, numbered resume, out-of-range, non-numeric fall-through + disarm, no-pending no-op, disarm-on-other-command).Validation
/resumethen bare3/resume 33with no armed promptscripts/run_tests.sh tests/cli/test_cli_resume_command.py— 12 passed.SessionDB+ realHermesCLImethods: bare/resumearms the list, bare3switchessession_idto the Architecture planning #3 session, loads its history, disarms; bare3with no armed prompt returns False (falls through to chat).Closes #34584.
Infographic