Skip to content

Fix Windows gateway scheduled task normalization#90502

Open
baskduf wants to merge 1 commit into
openclaw:mainfrom
baskduf:codex/fix-windows-schtasks-gateway-name
Open

Fix Windows gateway scheduled task normalization#90502
baskduf wants to merge 1 commit into
openclaw:mainfrom
baskduf:codex/fix-windows-schtasks-gateway-name

Conversation

@baskduf

@baskduf baskduf commented Jun 5, 2026

Copy link
Copy Markdown

Fixes #90494

Summary

  • Normalize Windows Scheduled Task names from schtasks before comparing them to managed OpenClaw Gateway task names.
  • Keep managed default/profile gateway tasks ignored, including \OpenClaw Gateway and \OpenClaw Gateway (work).
  • Preserve extra-service warnings for copy-style OpenClaw gateway tasks and legacy clawdbot tasks.

Root cause

schtasks /Query /FO LIST /V can report root-folder task names with a leading backslash, for example \OpenClaw Gateway. The inspector compared that raw name against the durable OpenClaw task name OpenClaw Gateway, so the managed gateway task could be reported as an extra service.

Real behavior proof

Behavior addressed: Windows schtasks root-folder task names like \OpenClaw Gateway are treated as the managed OpenClaw Gateway task instead of an extra service, while copy-style tasks like \OpenClaw Gateway Copy still report as extra gateway jobs.

Real environment tested: Local macOS checkout on latest origin/main (126ebfc99710) using the repo Vitest wrapper with mocked process.platform = "win32" and mocked schtasks output for the Windows inspection path.

Exact steps or command run after this patch: node scripts/run-vitest.mjs src/daemon/inspect.test.ts; git diff --check; .agents/skills/autoreview/scripts/autoreview --mode local.

Evidence after fix: src/daemon/inspect.test.ts now feeds TaskName: \OpenClaw Gateway, TaskName: \OpenClaw Gateway (work), TaskName: \OpenClaw Gateway Copy, TaskName: Clawdbot Legacy, and TaskName: Other Task through findExtraGatewayServices(..., { deep: true }).

Observed result after fix: Vitest reported Test Files 1 passed (1) and Tests 13 passed | 5 skipped (18). The expected result includes only \OpenClaw Gateway Copy and Clawdbot Legacy; managed default/profile gateway tasks and unrelated tasks are not reported. Final autoreview was clean with no accepted/actionable findings.

What was not tested: Native Windows Task Scheduler execution was not run; this PR covers the source-level detection path with mocked schtasks output.

Verification

  • node scripts/run-vitest.mjs src/daemon/inspect.test.ts
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode local

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 5, 2026
@baskduf baskduf changed the title [codex] Normalize Windows gateway task names Fix Windows gateway scheduled task normalization Jun 5, 2026
@clawsweeper

clawsweeper Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 10:21 PM ET / 02:21 UTC.

Summary
The PR normalizes Windows schtasks task names before daemon extra-service classification and updates the Windows inspection regression test for managed, profile, copy-style, and legacy tasks.

PR surface: Source +14, Tests +14. Total +28 across 2 files.

Reproducibility: yes. for a source-level reproduction: current main preserves the leading backslash, so \OpenClaw Gateway can miss the managed-task skip and flow into the extra-service warning path. I did not establish a live Windows reproduction in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted native Windows Task Scheduler proof showing the managed default/profile task is skipped and copy-style or legacy tasks still warn.
  • [P1] Coordinate with fix: ignore canonical Windows gateway task names #90512 so maintainers land only one fix path for the linked issue.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The supplied proof is mocked Windows-path Vitest output from macOS, and the PR explicitly says native Windows Task Scheduler execution was not tested; add redacted native schtasks, openclaw gateway status --deep, or openclaw doctor --deep output after this patch, then update the PR body so ClawSweeper can re-review automatically or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] External-PR proof is still mocked only; no native Windows Task Scheduler run after this patch shows schtasks, openclaw gateway status --deep, or openclaw doctor --deep behaving correctly on the real user path.
  • [P1] There is a competing unmerged PR for the same linked issue, so maintainers should choose one fix path before landing to avoid duplicate or conflicting changes.

Maintainer options:

  1. Decide the mitigation before merge
    Land one focused Windows Scheduled Task normalization fix, preferably with this PR's profile and copy-style coverage, after redacted native Windows proof confirms managed tasks are skipped and extra tasks still warn.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Human maintainer action is needed for native Windows proof and duplicate-PR selection; there is no narrow code repair for automation to apply on this branch right now.

Security
Cleared: The diff only changes daemon inspection logic and a colocated test; no concrete security or supply-chain concern was found.

Review details

Best possible solution:

Land one focused Windows Scheduled Task normalization fix, preferably with this PR's profile and copy-style coverage, after redacted native Windows proof confirms managed tasks are skipped and extra tasks still warn.

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

Yes for a source-level reproduction: current main preserves the leading backslash, so \OpenClaw Gateway can miss the managed-task skip and flow into the extra-service warning path. I did not establish a live Windows reproduction in this read-only review.

Is this the best way to solve the issue?

Yes for the code shape: normalizing at the Windows task-name classifier keeps the fix local and preserves default/profile task handling while restoring warnings for copy-style tasks. It is not merge-ready until native Windows proof and duplicate-PR coordination are resolved.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 5d350e785a91.

Label changes

Label justifications:

  • P2: This is a focused gateway status/doctor false-positive fix with limited blast radius, but it can affect Windows users following cleanup guidance.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The supplied proof is mocked Windows-path Vitest output from macOS, and the PR explicitly says native Windows Task Scheduler execution was not tested; add redacted native schtasks, openclaw gateway status --deep, or openclaw doctor --deep output after this patch, then update the PR body so ClawSweeper can re-review automatically or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +14, Tests +14. Total +28 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 16 2 +14
Tests 1 15 1 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 31 3 +28

What I checked:

  • Repository policy read: Root AGENTS.md was read fully and applied; no scoped AGENTS.md owns src/daemon, and the only maintainer note present is Telegram-specific. (AGENTS.md:1, 5d350e785a91)
  • Current main source reproduction: On current main, isOpenClawGatewayTaskName lowercases the raw task name but does not strip a leading \, so \OpenClaw Gateway misses the durable OpenClaw Gateway comparison. (src/daemon/inspect.ts:201, 5d350e785a91)
  • Windows scan entry point: The Windows deep scan parses schtasks /Query /FO LIST /V, checks isOpenClawGatewayTaskName, then reports remaining OpenClaw or legacy-looking tasks as extra services. (src/daemon/inspect.ts:509, 5d350e785a91)
  • User-visible warning path: Daemon status prints nonempty extraServices as Other gateway-like services detected and emits the Windows cleanup hint from renderGatewayServiceCleanupHints. (src/cli/daemon-cli/status.print.ts:447, 5d350e785a91)
  • Scheduled task naming contract: The durable Windows gateway task name is OpenClaw Gateway for the default profile and OpenClaw Gateway (<profile>) for named profiles. (src/daemon/constants.ts:54, 5d350e785a91)
  • PR implementation evidence: The PR strips leading slashes before comparing task names and narrows managed-task recognition to the default or parenthesized profile naming shape, leaving copy-style tasks reportable. (src/daemon/inspect.ts:201, b913bb377f73)

Likely related people:

  • steipete: Recent GitHub path history shows multiple daemon duplicate-service and schtasks-adjacent commits touching src/daemon/inspect.ts, src/daemon/inspect.test.ts, and src/daemon/schtasks.ts, including companion service false-positive work near this classifier. (role: recent area contributor; confidence: high; commits: dd0f5937d2b5, 3536c927dade, f348284fa9eb; files: src/daemon/inspect.ts, src/daemon/inspect.test.ts, src/daemon/schtasks.ts)
  • Linux2010: Authored a recent Windows schtasks fallback fix in the daemon service area, which is adjacent to this PR's Windows Task Scheduler behavior even though not the exact classifier line. (role: adjacent Windows schtasks contributor; confidence: medium; commits: 501e74ddf34f; files: src/daemon/schtasks.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 5, 2026
@baskduf

baskduf commented Jun 5, 2026

Copy link
Copy Markdown
Author

I cannot access the OpenClaw Blacksmith org from this account, so I cannot produce the requested native Windows Testbox proof myself.

The mocked regression covers the classifier behavior, including the additional \OpenClaw Gateway Copy case that can be hidden by the competing PR. If native Windows proof is required before merge, could a maintainer with Blacksmith/OpenClaw org access run the Windows schtasks + openclaw gateway status --deep proof, or advise whether source-level proof is sufficient for this narrow classifier fix?

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: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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

1 participant