From ddac5c777b9d98d92a296e247854aaa12c3ff56f Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Thu, 5 Mar 2026 15:35:46 -0800 Subject: [PATCH] fix(cli): restart gateway after bundled plugin install Ensures newly installed or updated plugins are loaded without manual restart. --- src/cli/bootstrap-external.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cli/bootstrap-external.ts b/src/cli/bootstrap-external.ts index e05c2ecef13..f08f77c3d75 100644 --- a/src/cli/bootstrap-external.ts +++ b/src/cli/bootstrap-external.ts @@ -444,6 +444,21 @@ async function installBundledPlugins(params: { errorMessage: "Failed to set posthog-analytics API key.", }); } + + // Restart the gateway so it loads the new/updated plugin. + // On first bootstrap the gateway isn't running yet, so this + // is a harmless no-op caught by the outer try/catch. + try { + await runOpenClawOrThrow({ + openclawCommand: params.openclawCommand, + args: ["--profile", params.profile, "gateway", "restart"], + timeoutMs: 60_000, + errorMessage: "Failed to restart gateway after plugin install.", + }); + } catch { + // Gateway may not be running yet (first bootstrap) — ignore. + } + return true; } catch { return false;