refactor(sessions): accurate scope wording for tip-only resume rejections
SessionResumeTooLargeError said 'across its lineage' even when the CLI mid-setup path counted only the tip segment; the exception now takes a scope phrase.
This commit is contained in:
@@ -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):
|
||||
|
||||
+7
-2
@@ -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."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user