fix(cli): replace misleading "Starting fresh" message on empty-session resume (#27168) - #27203
fix(cli): replace misleading "Starting fresh" message on empty-session resume (#27168)#27203briandevans wants to merge 2 commits into
Conversation
…n resume (NousResearch#27168) When `hermes --resume <id>` targets a session that exists in `sessions` but has zero rows in `messages`, both resume paths printed: Session <id> found but has no messages. Starting fresh. The "Starting fresh" claim is inaccurate — the empty session is reused (its `ended_at` is cleared and the user's next message becomes the first), no new session is created. Users reading the message reasonably expected a brand-new session, then saw the same orphan ID stick around. Rewords both call sites in `cli.py` to describe what actually happens ("resuming as an empty session") and surface the actionable remediation the reporter actually wanted ("`hermes sessions delete <id>` to remove it instead"). Behavior is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the "empty session resume" messaging to accurately reflect that the existing empty session is reused rather than replaced, and points users to the sessions delete command if they want removal instead.
Changes:
- Replaced the misleading "Starting fresh." wording in two CLI code paths with clearer messaging.
- Added a remediation hint pointing to
hermes sessions delete <session_id>. - Updated the corresponding regression test to assert the new wording.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cli.py | Updates two empty-session resume messages in _init_agent and _preload_resumed_session. |
| tests/cli/test_resume_display.py | Adjusts test assertions to match the new wording and adds a resolve_resume_session_id mock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| f"[{accent_color}]Session {self.session_id} has no prior " | ||
| f"messages — resuming as an empty session. " | ||
| f"[dim](To remove it instead, run " | ||
| f"`hermes sessions delete {self.session_id}`.)[/][/]" |
| assert "empty session" in output | ||
| assert "Starting fresh" not in output | ||
| assert "hermes sessions delete empty_session" in output | ||
|
|
| f"[bold {_accent_hex()}]Session {_escape(self.session_id)} has no prior messages — resuming as an empty session.[/] " | ||
| f"[dim](To remove it instead, run `hermes sessions delete {_escape(self.session_id)}`.)[/]" |
|
CI audit —
Reproduced locally with |
…ion test Addresses Copilot review on NousResearch#27203: - Apply `_escape(self.session_id)` in `_preload_resumed_session`'s empty-session branch so a session id containing Rich markup metacharacters (e.g. `[`) cannot misrender or raise MarkupError. Sibling branch in `_init_agent` already escaped; this keeps the two paths aligned. - Add a regression test asserting the `_init_agent` empty-session branch surfaces the same NousResearch#27168 wording (`no prior messages` / `empty session` / `hermes sessions delete <id>`, never `Starting fresh`), so the two copies cannot drift in opposite directions in future edits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@copilot All findings addressed in commit 1ef6d06:
CI audit — both job failures on this PR are pre-existing baselines on clean
Both reproduce on clean |
|
Closing to keep the queue clean — branch is several hundred commits behind |
Summary
Rewords both
--resumepaths incli.pyso the message printed when asession exists in
sessionsbut has zero rows inmessagesmatcheswhat the code actually does (reuse the empty session) and surfaces the
remediation the reporter wanted (
hermes sessions delete <id>).Behavior is unchanged — only the user-facing message.
Fixes the user-visible piece of #27168 (Bug 1). Bug 2 (the ~5 s
startup hang in
_check_compression_model_feasibility) is out ofscope here — the reporter notes they could not localize it, and
chasing it would be speculative without a clean repro.
The bug
Both
_init_agent(cli.py:4445) and_preload_resumed_session(cli.py:4711) printed:
The "Starting fresh" claim is inaccurate — the empty session is
reused: its
ended_atis cleared and the user's next messagebecomes the first one for that session ID. No new session is created.
Users reading the message reasonably expected a brand-new session,
then saw the same orphan ID stick around.
The fix
One-line wording change at each call site. Both now print:
ended_at = NULLreopen that follows).sessions deletecommand the reporter wanted as a remediation).Test plan
tests/cli/test_resume_display.py::TestPreloadResumedSession::test_returns_false_when_session_has_no_messagesupdated to assert the new wording (no prior messages,empty session,hermes sessions delete empty_session) and that the oldStarting freshtext is gone. Also fixes a pre-existing gap in the test whereresolve_resume_session_idwas not mocked, so the mock returned aMagicMockthat the production code then mistook for a redirected session ID.tests/cli/test_resume_display.py— all 37 tests pass underuv run --with pytest --with pytest-xdist --with pytest-asyncio python3 -m pytest."no prior messages" in output,"Starting fresh" not in output,"hermes sessions delete empty_session" in output) all fail against the old wording and pass against the new wording.Related
conversation_historyafter mid-loop compression). This PR addresses what users see when they encounter such a session (or any other empty session) on resume.