From d1241360c9b2b5fc57219c323409467eb8a47a8f Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Thu, 5 Feb 2026 15:48:54 +0530 Subject: [PATCH] fix: notify main agent on gateway update --- backend/app/api/gateways.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/app/api/gateways.py b/backend/app/api/gateways.py index 94d5dc2d..df7f779d 100644 --- a/backend/app/api/gateways.py +++ b/backend/app/api/gateways.py @@ -305,6 +305,19 @@ async def _ensure_main_agent( session.refresh(agent) try: await provision_main_agent(agent, gateway, raw_token, auth.user, action=action) + await ensure_session( + gateway.main_session_key, config=GatewayClientConfig(url=gateway.url, token=gateway.token), label=agent.name + ) + await send_message( + ( + f"Hello {agent.name}. Your gateway provisioning was updated.\n\n" + "Please re-read MAIN_AGENTS.md, MAIN_USER.md, MAIN_HEARTBEAT.md, and MAIN_TOOLS.md. " + "If BOOTSTRAP.md exists, run it once then delete it. Begin heartbeats after startup." + ), + session_key=gateway.main_session_key, + config=GatewayClientConfig(url=gateway.url, token=gateway.token), + deliver=True, + ) except OpenClawGatewayError: # Best-effort provisioning. pass