Skip to content

The agent that grows with you

refactor(cli): reuse RESUME_REFUSALS for the bare -c breadcrumb fallback

kshitijk4poor65af2afb4c66
diff --git a/hermes_cli/gateway_chat.py b/hermes_cli/gateway_chat.py
index f06c7bec78c..93ae4013d17 100644
--- a/hermes_cli/gateway_chat.py
+++ b/hermes_cli/gateway_chat.py
@@ -10,6 +10,7 @@ import sys
import uuid
from hermes_cli.gateway_client import RESUME_KEY_MISMATCH, GatewayClientError, connect_gateway
+from hermes_cli.gateway_connection import RESUME_REFUSALS
# These options change execution or require frontend facilities not yet exposed by
# the authority. Reject them, rather than mutate process-wide gateway settings.
@@ -146,7 +147,7 @@ async def _resume_latest(client, args):
try:
return await _resume(client, args, session_id=crumb)
except GatewayClientError as exc:
- if str(exc) not in {"not_found", "permission_denied"}:
+ if str(exc) not in RESUME_REFUSALS:
raise
workspace = await asyncio.to_thread(_workspace_key, _caller_cwd(args))
try:
diff --git a/hermes_cli/gateway_connection.py b/hermes_cli/gateway_connection.py
index f52a9dede8d..3b397fff11c 100644
--- a/hermes_cli/gateway_connection.py
+++ b/hermes_cli/gateway_connection.py
@@ -25,7 +25,7 @@ DISCONNECTED = ("Gateway disconnected; turn outcome is unknown. Resume the print
# A request refused before it reached any socket: nothing is in doubt, so never the copy above.
NOT_SENT = "Gateway disconnected before the request was sent; nothing was sent."
# ``session.resume`` refusals that mean "this viewer may not open that session": the caller keeps the
-# session it is on instead of adopting the target (startup resume).
+# session it is on instead of adopting the target (startup resume, bare -c fallback).
RESUME_REFUSALS = frozenset({"not_found", "permission_denied"})
# Resume refusals meaning the session itself is gone for this viewer (gateway/session_controls): the
# above plus profile_mismatch, raised for another profile's session (reconnect, /resume switch).