refactor: update gateway agent prefix and maintain backwards compatibility for session keys

This commit is contained in:
Abhimanyu Saharan
2026-02-11 02:47:08 +05:30
parent 563e4d5c26
commit c09116b8f0
2 changed files with 7 additions and 2 deletions

View File

@@ -7,9 +7,9 @@ import re
from datetime import timedelta from datetime import timedelta
from typing import Any from typing import Any
_GATEWAY_AGENT_PREFIX = "agent:gateway-"
_GATEWAY_AGENT_SUFFIX = ":main"
_GATEWAY_OPENCLAW_AGENT_PREFIX = "mc-gateway-" _GATEWAY_OPENCLAW_AGENT_PREFIX = "mc-gateway-"
_GATEWAY_AGENT_PREFIX = f"agent:{_GATEWAY_OPENCLAW_AGENT_PREFIX}"
_GATEWAY_AGENT_SUFFIX = ":main"
DEFAULT_HEARTBEAT_CONFIG: dict[str, Any] = { DEFAULT_HEARTBEAT_CONFIG: dict[str, Any] = {
"every": "10m", "every": "10m",

View File

@@ -132,6 +132,11 @@ def _workspace_path(agent: Agent, workspace_root: str) -> str:
# lead agents (session key includes board id) even if multiple boards share the same # lead agents (session key includes board id) even if multiple boards share the same
# display name (e.g. "Lead Agent"). # display name (e.g. "Lead Agent").
key = _agent_key(agent) key = _agent_key(agent)
# Backwards-compat: gateway-main agents historically used session keys that encoded
# "gateway-<id>" while the gateway agent id is "mc-gateway-<id>".
# Keep the on-disk workspace path stable so existing provisioned files aren't moved.
if key.startswith("mc-gateway-"):
key = key.removeprefix("mc-")
return f"{root}/workspace-{slugify(key)}" return f"{root}/workspace-{slugify(key)}"