fix: include -p profile flag in exit resume hint

Session IDs are profile-constrained, so the resume hint needs to
include the active profile for multi-profile users. Without this,
copying the hint from a non-default profile fails to resume the
correct session.

Before:  hermes --resume 20260414_063228_c1240e
After:   hermes --resume 20260414_063228_c1240e -p dev

Also includes -p on the resume-by-title hint. Skipped for
'default' and 'custom' profiles (no -p needed).

Surgical reapply of PR #9652. Original branch was stale against
current main (~6 months); reapplied onto current cli.py by hand
with original authorship preserved.
This commit is contained in:
CK iRonin.IT 2026-05-25 00:52:23 -07:00 committed by Teknium
parent d3ffbc6409
commit 2a2cef4ac7

17
cli.py
View file

@ -11954,9 +11954,22 @@ class HermesCLI:
pass
print("Resume this session with:")
print(f" hermes --resume {self.session_id}")
# Session IDs are profile-constrained, so the resume hint must
# include `-p <profile>` for non-default profiles. Without this,
# copying the hint from a non-default profile fails to find the
# session on the next invocation. The "default" and "custom"
# profile names use the standard HERMES_HOME, so no -p needed.
try:
from hermes_cli.profiles import get_active_profile_name
_active_profile = get_active_profile_name()
except Exception:
_active_profile = "default"
profile_flag = (
"" if _active_profile in ("default", "custom") else f" -p {_active_profile}"
)
print(f" hermes --resume {self.session_id}{profile_flag}")
if session_title:
print(f" hermes -c \"{session_title}\"")
print(f" hermes -c \"{session_title}\"{profile_flag}")
print()
print(f"Session: {self.session_id}")
if session_title: