fix(cli): restore session cwd on mid-chat /resume (transplant to mixin)

Dusk1e's fix wired _restore_session_cwd into _handle_resume_command, but that
handler was extracted from cli.py into hermes_cli/cli_commands_mixin.py
(094aa85c3) after the PR's base, so the original cli.py hunk no longer applied
(a naive cherry-pick fuzzily misplaced it inside new_session(), where
session_meta is undefined). Transplanted the call to the end of the handler in
its current home; /sessions <id> delegates here so both command forms are
covered. Dusk1e's regression tests carry over unchanged.

Co-authored-by: Dusk1e <yusufalweshdemir@gmail.com>
This commit is contained in:
Brooklyn Nicholson 2026-07-18 23:20:32 -04:00
parent 228d8de19c
commit 3700ca4a54

View file

@ -834,6 +834,14 @@ class CLICommandsMixin:
else:
_cprint(f" ↻ Resumed session {target_id}{title_part} — no messages, starting fresh.")
# Retarget the process + tool cwd to where the session was started, so a
# mid-chat /resume (and /sessions <id>, which delegates here) lands in the
# same directory as a startup `hermes -c`/`--resume`. The startup resume
# paths already call this; without it, the terminal/code-exec tools and
# relative-path resolution keep operating in the wrong repo. Idempotent
# and a no-op when the session recorded no cwd. See #38562.
self._restore_session_cwd(session_meta)
def _handle_sessions_command(self, cmd_original: str) -> None:
"""Handle /sessions [list|<id_or_title>] — browse or resume previous sessions.