Skip to content

Commit 1d8a740

Browse files
committed
fix(daemon): keep duplicate Windows gateway tasks visible
1 parent e74ff1f commit 1d8a740

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/daemon/inspect.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,35 @@ describe("findExtraGatewayServices (win32)", () => {
388388
},
389389
]);
390390
});
391+
392+
it("reports duplicate root tasks that only share the gateway task prefix", async () => {
393+
execSchtasksMock.mockResolvedValueOnce({
394+
code: 0,
395+
stdout: [
396+
"TaskName:\\OpenClaw Gateway",
397+
"Task To Run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run",
398+
"",
399+
"TaskName:\\OpenClaw Gateway (dev)",
400+
"Task To Run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run --profile dev",
401+
"",
402+
"TaskName:\\OpenClaw Gateway Backup",
403+
"Task To Run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run",
404+
"",
405+
].join("\n"),
406+
stderr: "",
407+
});
408+
409+
const result = await findExtraGatewayServices({}, { deep: true });
410+
expect(result).toEqual([
411+
{
412+
platform: "win32",
413+
label: "\\OpenClaw Gateway Backup",
414+
detail:
415+
"task: \\OpenClaw Gateway Backup, run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run",
416+
scope: "system",
417+
marker: "openclaw",
418+
legacy: false,
419+
},
420+
]);
421+
});
391422
});

src/daemon/inspect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function isOpenClawGatewayTaskName(name: string): boolean {
209209
// gateway task is not misidentified as an extra gateway service.
210210
const stripped = normalized.replace(/^\\+/, "");
211211
const defaultName = normalizeLowercaseStringOrEmpty(resolveGatewayWindowsTaskName());
212-
return stripped === defaultName || stripped.startsWith("openclaw gateway");
212+
return stripped === defaultName || /^openclaw gateway \(.+\)$/.test(stripped);
213213
}
214214

215215
function tryExtractPlistLabel(contents: string): string | null {

0 commit comments

Comments
 (0)