Skip to content

fix(daemon): strip schtasks backslash prefix when matching gateway task name#91181

Merged
vincentkoc merged 6 commits into
openclaw:mainfrom
425072024:fix/win32-schtasks-backslash-false-positive-90494
Jun 13, 2026
Merged

fix(daemon): strip schtasks backslash prefix when matching gateway task name#91181
vincentkoc merged 6 commits into
openclaw:mainfrom
425072024:fix/win32-schtasks-backslash-false-positive-90494

Conversation

@425072024

@425072024 425072024 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: On Windows, the live \OpenClaw Gateway Scheduled Task is falsely flagged as an extra gateway-like service with a schtasks /Delete cleanup hint. Following the hint removes the user's auto-start mechanism. Issue doctor/status: false positive 'Other gateway-like services detected' for active Windows Scheduled Task #90494.
  • Root Cause: schtasks /Query /FO LIST /V returns task names with a leading \ (e.g. TaskName:\OpenClaw Gateway). isOpenClawGatewayTaskName() compares the raw name against startsWith("openclaw gateway") — fails because \ comes first.
  • Fix: Strip leading backslash before comparison: normalized.replace(/^\\+/, "").
  • What changed: src/daemon/inspect.ts (+6/-1) and src/daemon/inspect.test.ts (+4/-1).

Real behavior proof

  • Behavior addressed: \OpenClaw Gateway Scheduled Task falsely flagged as extra gateway service with schtasks /Delete cleanup recommendation.
  • Real environment tested: Windows 11 Home China x64 (10.0.22631), Node 24.16.0. Two real Scheduled Tasks (\OpenClaw Gateway canonical, \Clawdbot Legacy legacy) created via schtasks /Create. Full schtasks /Query /FO LIST /V captured (257 tasks).
  • Exact steps or command run after this patch: Parsed all 257 real tasks from schtasks /Query /FO LIST /V via PowerShell, applied before/after detection logic to each task. Console output captured below.
  • Evidence after fix: Real console output from parsing 257 Windows Scheduled Tasks with before/after detection logic:
Total tasks parsed: 257

Task name: "\Clawdbot Legacy"
  Normalized:   "\clawdbot legacy"
  Stripped :    "clawdbot legacy"
  BEFORE fix: NOT SKIPPED -> correctly flagged as legacy extra service
  AFTER fix : NOT SKIPPED -> correctly flagged as legacy extra service

Task name: "\OpenClaw Gateway"
  Normalized:   "\openclaw gateway"
  Stripped :    "openclaw gateway"
  BEFORE fix: NOT SKIPPED -> flagged as extra service -> schtasks /Delete hint shown
  AFTER fix : SKIPPED (recognized as canonical gateway launcher)
  • Observed result after fix: \OpenClaw Gateway is correctly identified as the canonical task and excluded from the extra-services warning. \Clawdbot Legacy is still correctly detected as a legacy extra service. No regression for the other 255 system tasks.
  • What was not tested: Running a full live gateway process launched by the Scheduled Task. The fix is a single string-sanitization in a 7-line identity matcher; the before/after contract is fully verifiable from the real schtasks parse output above.

Fixes #90494

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 7, 2026
@clawsweeper

clawsweeper Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 13, 2026, 7:28 PM ET / 23:28 UTC.

Summary
The PR strips leading backslashes before Windows gateway Scheduled Task name matching and updates daemon inspection tests to cover the real TaskName:\OpenClaw Gateway shape plus duplicate prefix-only tasks.

PR surface: Source +5, Tests +35. Total +40 across 2 files.

Reproducibility: yes. at source level: current main keeps the leading backslash on \OpenClaw Gateway, misses the managed-task skip, and can flow into the extra-service warning path. I did not run a live Windows gateway command in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The PR body proves the matcher against real Windows schtasks output, but it does not include a full openclaw gateway status --deep or openclaw doctor --deep transcript from a running gateway.

Maintainer options:

  1. Decide the mitigation before merge
    Land this narrow normalization fix after normal maintainer review and CI; keep broader launcher path or parent-process correlation as follow-up only if stale-task false positives remain.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No repair job is indicated; the PR is a narrow implementation candidate with no blocking finding, so normal maintainer review and CI should decide landing.

Security
Cleared: The diff only changes Windows task-name matching and adjacent tests; I found no dependency, CI, credential, permission, package, or supply-chain concern.

Review details

Best possible solution:

Land this narrow normalization fix after normal maintainer review and CI; keep broader launcher path or parent-process correlation as follow-up only if stale-task false positives remain.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: current main keeps the leading backslash on \OpenClaw Gateway, misses the managed-task skip, and can flow into the extra-service warning path. I did not run a live Windows gateway command in this read-only review.

Is this the best way to solve the issue?

Yes. Stripping the scheduler root backslash in the Windows task-name matcher, then matching only exact default/profile task names, is the narrowest maintainable fix for the proven false positive while preserving duplicate-task detection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 47759c35063c.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal-style Windows 11 proof from real schtasks data showing the after-fix matcher skips the canonical task while legacy detection remains intact.

Label justifications:

  • P2: This is a focused Windows gateway status/doctor false positive that can lead users to delete their intended gateway autostart task, with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal-style Windows 11 proof from real schtasks data showing the after-fix matcher skips the canonical task while legacy detection remains intact.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal-style Windows 11 proof from real schtasks data showing the after-fix matcher skips the canonical task while legacy detection remains intact.
Evidence reviewed

PR surface:

Source +5, Tests +35. Total +40 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 1 36 1 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 42 2 +40

What I checked:

  • Repository policy read: Root AGENTS.md was read fully and applied; no scoped AGENTS.md owns src/daemon, so the root PR review, proof, history, and cleanup rules govern this review. (AGENTS.md:1, 47759c35063c)
  • Current-main root cause: Current main normalizes the raw task name and compares it before stripping a leading backslash, so \OpenClaw Gateway can miss the managed-task skip. (src/daemon/inspect.ts:201, 47759c35063c)
  • PR head matcher: At PR head, the matcher strips leading backslashes and ignores only the exact default task or profile-shaped OpenClaw Gateway (<profile>) names. (src/daemon/inspect.ts:210, 1d8a74021df8)
  • PR head regression tests: The updated tests cover TaskName:\OpenClaw Gateway being skipped while \OpenClaw Gateway Backup remains reported as an extra OpenClaw task. (src/daemon/inspect.test.ts:358, 1d8a74021df8)
  • User-visible status path: gateway status --deep loads findExtraGatewayServices; nonempty results are printed as Other gateway-like services detected with cleanup hints. (src/cli/daemon-cli/status.gather.ts:599, 47759c35063c)
  • Doctor warning path: Doctor passes the scanner output into the extra-service note path, so Windows false positives can surface in openclaw doctor --deep too. (src/commands/doctor-gateway-services.ts:661, 47759c35063c)

Likely related people:

  • vincentkoc: git blame attributes the current Windows task-name matcher and adjacent daemon inspection fixture to Vincent Koc, and the latest PR repair commit that tightens duplicate-task handling is also by Vincent Koc. (role: recent area contributor; confidence: high; commits: eb1b640854bb, 1d8a74021df8; files: src/daemon/inspect.ts, src/daemon/inspect.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 7, 2026
@425072024

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed proof: supplied External PR includes structured after-fix real behavior proof. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 7, 2026
@425072024

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 7, 2026
@vincentkoc vincentkoc self-assigned this Jun 13, 2026
425072024 and others added 6 commits June 14, 2026 06:55
…sk name

Windows schtasks /Query /FO LIST /V returns task names with a leading
backslash prefix (e.g. \OpenClaw Gateway for root-folder tasks).
isOpenClawGatewayTaskName() compared the raw normalized name against
the configured task name, so \openclaw gateway never matched
openclaw gateway, causing the live gateway task to be flagged as an
extra gateway-like service and recommending schtasks /Delete cleanup.

Strip the leading backslash before comparison so the live launcher
task is correctly recognized and excluded from the warning.

Fixes openclaw#90494
@vincentkoc
vincentkoc force-pushed the fix/win32-schtasks-backslash-false-positive-90494 branch from 4e5457d to 1d8a740 Compare June 13, 2026 23:22
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 13, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 13, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer verification for current head 1d8a74021df86b746ee64787d3afab568ce157c0:

  • Rebased on current origin/main before review.
  • Verified Windows schtasks names with a leading backslash no longer hide duplicate OpenClaw gateway tasks, while similarly-prefixed non-default task names stay visible.
  • Focused proof: node scripts/run-vitest.mjs src/daemon/inspect.test.ts — passed, 14 tests / 5 skipped.
  • Type proof: OPENCLAW_LOCAL_CHECK_MODE=throttled node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test-local-debug.tsbuildinfo — passed; OPENCLAW_LOCAL_CHECK_MODE=throttled node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test-local-debug.tsbuildinfo — passed.
  • Autoreview: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --thinking high — clean after narrowing the duplicate-task match.
  • GitHub checks: current head is clean after rerunning the transient check-test-types failure.

Merging by squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor/status: false positive 'Other gateway-like services detected' for active Windows Scheduled Task

2 participants