fix(update): harden root selection

This commit is contained in:
Peter Steinberger
2026-01-10 20:32:15 +01:00
parent 777fb6b7bb
commit 4c4c167416
7 changed files with 209 additions and 46 deletions

View File

@@ -1,3 +1,4 @@
import { resolveClawdbotPackageRoot } from "../../infra/clawdbot-root.js";
import { scheduleGatewaySigusr1Restart } from "../../infra/restart.js";
import {
type RestartSentinelPayload,
@@ -48,9 +49,15 @@ export const updateHandlers: GatewayRequestHandlers = {
let result: Awaited<ReturnType<typeof runGatewayUpdate>>;
try {
const root =
(await resolveClawdbotPackageRoot({
moduleUrl: import.meta.url,
argv1: process.argv[1],
cwd: process.cwd(),
})) ?? process.cwd();
result = await runGatewayUpdate({
timeoutMs,
cwd: process.cwd(),
cwd: root,
argv1: process.argv[1],
});
} catch (err) {