The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(state): recognize every persisted session-id shape in salvage
kshitijk4poord7732ca75e4c
diff --git a/hermes_state_ids.py b/hermes_state_ids.pyindex de96cfdfc36..e3633d2423b 100644--- a/hermes_state_ids.py+++ b/hermes_state_ids.py@@ -32,10 +32,19 @@ SESSION_ID_RECOGNIZERS = (# cron/scheduler.py: f"cron_{job_id}_{now:%Y%m%d_%H%M%S}". job_id is uuid4().hex[:12] for jobs# minted by cron/jobs.py, but user/legacy job ids ("job-1") are real and still in live stores.re.compile(r"^cron_[A-Za-z0-9][A-Za-z0-9._-]*_\d{8}_\d{6}$"),- # hermes_cli/cli_commands_mixin.py (/bg): f"bg_{now:%H%M%S}_{uuid4().hex[:6]}" -- time only, no date.- re.compile(r"^bg_\d{6}_[0-9a-f]{6}$"),+ # /bg: CLI + gateway mint f"bg_{now:%H%M%S}_{hex6}" (time only, no date); the TUI/Desktop+ # (tui_gateway/methods_prompt.py _side_agent_args) mints f"bg_{uuid4().hex[:6]}".+ re.compile(r"^bg_(?:\d{6}_)?[0-9a-f]{6}$"),# gateway/platforms/api_server_room_dispatch.py: f"room_{sha256(seed)[:32]}".re.compile(r"^room_[0-9a-f]{32}$"),+ # gateway/platforms/api_server.py: POST /api/sessions + fork f"api_{int(time())}_{hex8}",+ # chat-completions _derive_chat_session_id f"api-{sha256[:16]}".+ re.compile(r"^api_\d{9,}_[0-9a-f]{8}$"),+ re.compile(r"^api-[0-9a-f]{16}$"),+ # gateway/platforms/api_server_runs.py: /v1/runs falls back to its f"run_{uuid4().hex}".+ re.compile(r"^run_[0-9a-f]{32}$"),+ # acp_adapter/session.py and /v1/responses: str(uuid4()).+ re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"),)diff --git a/tests/hermes_state/test_session_id_recognition_recovery.py b/tests/hermes_state/test_session_id_recognition_recovery.pyindex a8101c3e73f..4bccb5a0edf 100644--- a/tests/hermes_state/test_session_id_recognition_recovery.py+++ b/tests/hermes_state/test_session_id_recognition_recovery.py@@ -59,7 +59,13 @@ CRON_SLUG_ID = "cron_job-1_20260707_195958" # legacy/user job id, real in lBG_ID = "bg_124526_be5bed"ROOM_ID = "room_" + "0123456789abcdef" * 2-DERIVED_IDS = [CRON_ID, CRON_SLUG_ID, BG_ID, ROOM_ID]+TUI_BG_ID = "bg_be5bed"+API_ID = "api_1790000000_0123abcd"+API_CHAT_ID = "api-0123456789abcdef"+RUN_ID = "run_" + "0123456789abcdef" * 2+UUID_ID = "0b36145a-e5c7-4d2a-9f00-0123456789ab"++DERIVED_IDS = [CRON_ID, CRON_SLUG_ID, BG_ID, ROOM_ID, TUI_BG_ID, API_ID, API_CHAT_ID, RUN_ID, UUID_ID]# Near-misses and arbitrary cell values. These sit at the id position of a candidate# layout, so accepting any of them costs real wrong-column-mapping safety.@@ -74,6 +80,8 @@ NOT_SESSION_IDS = ["/Users/adam/some/path", "https://example.com", "hello world",'{"json": true}', "claude-opus-5", "assistant","20260101_100500",+ "bg_abcde", "api_123_0123abcd", "api-0123", "run_" + "a" * 31,+ "0b36145a-e5c7-1d2a-9f00-0123456789ab",]