Skip to content

The agent that grows with you

fix(gateway): shutdown notices parse named-profile keys directly

Teknium5fc784a8cff3
diff --git a/gateway/run_shutdown.py b/gateway/run_shutdown.py
index 53933399b94..78ed9bddd96 100644
--- a/gateway/run_shutdown.py
+++ b/gateway/run_shutdown.py
@@ -893,14 +893,10 @@ class GatewayShutdownMixin:
source = self._get_cached_session_source(session_key)
if source is not None:
return source, source.platform.value, str(source.chat_id), source.thread_id, getattr(source, "profile", None)
- parts = session_key.split(":")
- profile = parts[1] if len(parts) >= 5 and parts[0] == "agent" and parts[1] != "main" else None
- # _parse_session_key only understands the ``agent:main:`` lane; a secondary's key is parsed on
- # the same shape with its profile carried separately.
- _parsed = _parse_session_key(":".join(["agent", "main", *parts[2:]]) if profile else session_key)
+ _parsed = _parse_session_key(session_key)
if not _parsed:
return None
- return None, _parsed["platform"], _parsed["chat_id"], _parsed.get("thread_id"), profile
+ return None, _parsed["platform"], _parsed["chat_id"], _parsed.get("thread_id"), _parsed.get("profile")
async def _send_shutdown_notice(
self, adapter, chat_id: str, msg: str, kind: str, platform_str: str, **send_kwargs