Skip to content

The agent that grows with you

refactor(sessions): accurate scope wording for tip-only resume rejections

kshitija8ccd521236b
diff --git a/hermes_cli/cli_agent_setup_mixin.py b/hermes_cli/cli_agent_setup_mixin.py
index 97a45768525..25ec7804b92 100644
--- a/hermes_cli/cli_agent_setup_mixin.py
+++ b/hermes_cli/cli_agent_setup_mixin.py
@@ -617,7 +617,9 @@ class CLIAgentSetupMixin:
try:
tip_check(self.session_id, max_messages=limit)
except SessionExportTooLargeError as exc:
- raise SessionResumeTooLargeError(exc.message_count, limit) from exc
+ raise SessionResumeTooLargeError(
+ exc.message_count, limit, scope="in its tip segment"
+ ) from exc
else:
safety_check = getattr(self._session_db, "assert_resume_safe", None)
if not callable(safety_check):
diff --git a/hermes_state.py b/hermes_state.py
index 3fc57c6defa..91727084035 100644
--- a/hermes_state.py
+++ b/hermes_state.py
@@ -126,11 +126,16 @@ def resolved_max_export_messages() -> int:
class SessionResumeTooLargeError(ValueError):
- def __init__(self, message_count: int, limit: int = MAX_SAFE_RESUME_MESSAGES):
+ def __init__(
+ self,
+ message_count: int,
+ limit: int = MAX_SAFE_RESUME_MESSAGES,
+ scope: str = "across its lineage",
+ ):
self.message_count = message_count
self.limit = limit
super().__init__(
- f"session has at least {message_count} active messages across its lineage; "
+ f"session has at least {message_count} active messages {scope}; "
f"safe resume limit is {limit}. Export the session instead, or set "
"sessions.max_resume_messages: 0 in config.yaml to disable the guard."
)