fix(cli): restart gateway after bundled plugin install

Ensures newly installed or updated plugins are loaded without manual restart.
This commit is contained in:
kumarabhirup 2026-03-05 15:35:46 -08:00
parent 113b1ffb17
commit ddac5c777b
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -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;