@@ -356,10 +356,12 @@ describe("findExtraGatewayServices (win32)", () => {
|
356 | 356 | }); |
357 | 357 | |
358 | 358 | it("collects only non-openclaw marker tasks from schtasks output", async () => { |
| 359 | +// Real schtasks /Query /FO LIST /V output prefixes root-folder task |
| 360 | +// names with a backslash (e.g. TaskName:\OpenClaw Gateway). |
359 | 361 | execSchtasksMock.mockResolvedValueOnce({ |
360 | 362 | code: 0, |
361 | 363 | stdout: [ |
362 | | -"TaskName: OpenClaw Gateway", |
| 364 | +"TaskName:\\OpenClaw Gateway", |
363 | 365 | "Task To Run: C:\\Program Files\\OpenClaw\\openclaw.exe gateway run", |
364 | 366 | "", |
365 | 367 | "TaskName: Clawdbot Legacy", |
@@ -373,6 +375,8 @@ describe("findExtraGatewayServices (win32)", () => {
|
373 | 375 | }); |
374 | 376 | |
375 | 377 | const result = await findExtraGatewayServices({}, { deep: true }); |
| 378 | +// The \OpenClaw Gateway task is the live launcher — it must be skipped. |
| 379 | +// Only the unrelated clawdbot task should be flagged. |
376 | 380 | expect(result).toEqual([ |
377 | 381 | { |
378 | 382 | platform: "win32", |
@@ -384,4 +388,35 @@ describe("findExtraGatewayServices (win32)", () => {
|
384 | 388 | }, |
385 | 389 | ]); |
386 | 390 | }); |
| 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 | +}); |
387 | 422 | }); |