fix: honor gateway service override labels

This commit is contained in:
Peter Steinberger
2026-01-13 05:58:46 +00:00
parent 42ff634a9d
commit 5918def440
16 changed files with 128 additions and 35 deletions

View File

@@ -473,6 +473,7 @@ async function maybeInstallDaemon(params: {
}) {
const service = resolveGatewayService();
const loaded = await service.isLoaded({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
});
let shouldCheckLinger = false;
@@ -492,6 +493,7 @@ async function maybeInstallDaemon(params: {
);
if (action === "restart") {
await service.restart({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
stdout: process.stdout,
});

View File

@@ -100,6 +100,7 @@ export async function maybeMigrateLegacyGatewayService(
const service = resolveGatewayService();
const loaded = await service.isLoaded({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
});
if (loaded) {

View File

@@ -450,6 +450,7 @@ export async function doctorCommand(
let loaded = false;
try {
loaded = await service.isLoaded({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
});
} catch {
@@ -575,6 +576,7 @@ export async function doctorCommand(
if (!healthOk) {
const service = resolveGatewayService();
const loaded = await service.isLoaded({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
});
let serviceRuntime:
@@ -676,6 +678,7 @@ export async function doctorCommand(
});
if (start) {
await service.restart({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
stdout: process.stdout,
});
@@ -698,6 +701,7 @@ export async function doctorCommand(
});
if (restart) {
await service.restart({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
stdout: process.stdout,
});

View File

@@ -47,14 +47,14 @@ async function stopGatewayIfRunning(runtime: RuntimeEnv) {
const profile = process.env.CLAWDBOT_PROFILE;
let loaded = false;
try {
loaded = await service.isLoaded({ profile });
loaded = await service.isLoaded({ env: process.env, profile });
} catch (err) {
runtime.error(`Gateway service check failed: ${String(err)}`);
return;
}
if (!loaded) return;
try {
await service.stop({ profile, stdout: process.stdout });
await service.stop({ env: process.env, profile, stdout: process.stdout });
} catch (err) {
runtime.error(`Gateway stop failed: ${String(err)}`);
}

View File

@@ -167,7 +167,10 @@ export async function statusAllCommand(
const service = resolveGatewayService();
const [loaded, runtimeInfo, command] = await Promise.all([
service
.isLoaded({ profile: process.env.CLAWDBOT_PROFILE })
.isLoaded({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
})
.catch(() => false),
service.readRuntime(process.env).catch(() => undefined),
service.readCommand(process.env).catch(() => null),

View File

@@ -336,7 +336,10 @@ async function getDaemonStatusSummary(): Promise<{
const service = resolveGatewayService();
const [loaded, runtime, command] = await Promise.all([
service
.isLoaded({ profile: process.env.CLAWDBOT_PROFILE })
.isLoaded({
env: process.env,
profile: process.env.CLAWDBOT_PROFILE,
})
.catch(() => false),
service.readRuntime(process.env).catch(() => undefined),
service.readCommand(process.env).catch(() => null),

View File

@@ -70,7 +70,7 @@ async function stopAndUninstallService(runtime: RuntimeEnv): Promise<boolean> {
const profile = process.env.CLAWDBOT_PROFILE;
let loaded = false;
try {
loaded = await service.isLoaded({ profile });
loaded = await service.isLoaded({ env: process.env, profile });
} catch (err) {
runtime.error(`Gateway service check failed: ${String(err)}`);
return false;
@@ -80,7 +80,7 @@ async function stopAndUninstallService(runtime: RuntimeEnv): Promise<boolean> {
return true;
}
try {
await service.stop({ profile, stdout: process.stdout });
await service.stop({ env: process.env, profile, stdout: process.stdout });
} catch (err) {
runtime.error(`Gateway stop failed: ${String(err)}`);
}