From c09116b8f00fbdcfec2e7522db74245c40b2c056 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Wed, 11 Feb 2026 02:47:08 +0530 Subject: [PATCH] refactor: update gateway agent prefix and maintain backwards compatibility for session keys --- backend/app/services/openclaw/constants.py | 4 ++-- backend/app/services/openclaw/provisioning.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/app/services/openclaw/constants.py b/backend/app/services/openclaw/constants.py index 345f3eff..5c667d29 100644 --- a/backend/app/services/openclaw/constants.py +++ b/backend/app/services/openclaw/constants.py @@ -7,9 +7,9 @@ import re from datetime import timedelta from typing import Any -_GATEWAY_AGENT_PREFIX = "agent:gateway-" -_GATEWAY_AGENT_SUFFIX = ":main" _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] = { "every": "10m", diff --git a/backend/app/services/openclaw/provisioning.py b/backend/app/services/openclaw/provisioning.py index 6c71ef38..96becad5 100644 --- a/backend/app/services/openclaw/provisioning.py +++ b/backend/app/services/openclaw/provisioning.py @@ -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 # display name (e.g. "Lead Agent"). key = _agent_key(agent) + # Backwards-compat: gateway-main agents historically used session keys that encoded + # "gateway-" while the gateway agent id is "mc-gateway-". + # 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)}"