Skip to content

fix(daemon): default Windows tasks to hidden launcher#89380

Closed
wyf027 wants to merge 1 commit into
openclaw:mainfrom
wyf027:leno23/fix-windows-task-hidden-launcher-89231
Closed

fix(daemon): default Windows tasks to hidden launcher#89380
wyf027 wants to merge 1 commit into
openclaw:mainfrom
wyf027:leno23/fix-windows-task-hidden-launcher-89231

Conversation

@wyf027

@wyf027 wyf027 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Default Windows Scheduled Task installs and upgrades to the existing gateway.vbs hidden launcher instead of running gateway.cmd directly.
  • Keep the existing internal escape hatch for explicit falsey OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER values.
  • Update daemon install coverage so fresh and existing tasks prove the default action points at the hidden launcher.

Fixes #89231.

Verification

  • node scripts/run-vitest.mjs src/daemon/schtasks.install.test.ts
  • node scripts/run-vitest.mjs src/daemon/schtasks.startup-fallback.test.ts src/daemon/schtasks.test.ts src/daemon/schtasks.stop.test.ts src/daemon/schtasks-exec.test.ts
  • node scripts/run-oxlint.mjs src/daemon/schtasks.ts src/daemon/schtasks.install.test.ts
  • git diff --check

pnpm tsgo:core was attempted after installing/linking dependencies, but this checkout reports existing unrelated type errors in src/agents/sessions/auth-storage.ts, src/agents/utils/image-resize.ts, src/gateway/managed-image-attachments.ts, src/media/image-ops.ts, and src/media/web-media.ts.

Duplicate check

  • gh pr list --repo openclaw/openclaw --state open --search '89231 Windows scheduled task visible console gateway.cmd windowless launcher gateway.vbs' --json number,title,url,headRefName,author --limit 20 -> []
  • gh pr list --repo openclaw/openclaw --state open --head leno23:leno23/fix-windows-task-hidden-launcher-89231 --json number,title,url --limit 10 -> []

Real behavior proof

Behavior addressed: Windows Scheduled Task creation/update now defaults the task action to the existing hidden .vbs launcher instead of gateway.cmd, preventing the cmd console from being the default launch target.

Real environment tested: macOS 26.3.2 local checkout running the real OpenClaw daemon installer code path with a local schtasks command shim to capture the Scheduled Task action arguments.

Exact steps or command run after this patch: node --import tsx /tmp/openclaw-hidden-launcher-proof.mjs

Evidence after fix: terminal output from the after-patch OpenClaw daemon installer run:

scriptPath=/var/folders/hy/bphml7v52zxdq_8_273nn9ph0000gn/T/openclaw-hidden-launcher-proof-bucDks/.openclaw/gateway.cmd
launcherPath=/var/folders/hy/bphml7v52zxdq_8_273nn9ph0000gn/T/openclaw-hidden-launcher-proof-bucDks/.openclaw/gateway.vbs
launcherContainsWScript=true
launcherRunsCmd=true
taskActionUsesVbs=true
schtasksArgs=
/Query
/Query /TN OpenClaw Gateway
/Change /TN OpenClaw Gateway /TR /var/folders/hy/bphml7v52zxdq_8_273nn9ph0000gn/T/openclaw-hidden-launcher-proof-bucDks/.openclaw/gateway.vbs
/Create /F /TN OpenClaw Gateway /XML /var/folders/hy/bphml7v52zxdq_8_273nn9ph0000gn/T/openclaw-task-xml-qLNiCK/task.xml
/Run /TN OpenClaw Gateway
/Query
/Query /TN OpenClaw Gateway /V /FO LIST

Observed result after fix: The generated launcher file is gateway.vbs, it contains WScript.Shell, it runs the generated gateway.cmd, and the captured Scheduled Task /TR action uses gateway.vbs by default.

What was not tested: A live Windows 11 desktop Scheduled Task launch with visual confirmation that no cmd.exe window appears.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels Jun 2, 2026
@clawsweeper

clawsweeper Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 6:55 AM ET / 10:55 UTC.

Summary
The branch makes Windows gateway Scheduled Task and Startup-folder fallback installs use the generated gateway.vbs launcher by default, keeps explicit falsey env values as an opt-out, and updates focused daemon tests.

PR surface: Source +1, Tests +33. Total +34 across 3 files.

Reproducibility: yes. at source level: current main and v2026.6.6 leave the gateway Scheduled Task on gateway.cmd when the hidden-launcher env is unset, and the linked issue gives Windows 11 reproduction steps. I did not reproduce the desktop window live in this read-only review.

Review metrics: 1 noteworthy metric.

  • Windows launcher defaults: 2 defaults changed; 1 opt-out semantic changed. Scheduled Task and Startup-folder fallback both move from direct command launchers to VBS when the env is unset, so upgrade behavior matters before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof 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 proof showing the Scheduled Task action points at gateway.vbs and launching it does not show a cmd.exe window.
  • Update the Windows gateway/install docs for the new launcher and cleanup shape.
  • [P1] Cover or fix falsey opt-out cleanup so generated task launchers are not left behind.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body has terminal proof from a macOS schtasks shim, not native Windows Scheduled Task/no-console proof; add redacted Windows terminal, log, screenshot, video, or linked artifact evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
Native Windows visual proof would materially test the user-visible console-window claim that unit tests and a shim cannot prove. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify on native Windows that openclaw gateway install creates or updates the Scheduled Task action to gateway.vbs and launching it shows no cmd window.

Risk before merge

  • [P2] Changing the unset default moves existing Windows task refreshes and fallback installs onto WSH/VBS; hosts where Windows Script Host is disabled or constrained need maintainer acceptance or clearer opt-out proof.
  • [P1] The supplied proof shows argument generation through a macOS schtasks shim, not a native Windows Scheduled Task launch or the absence of the visible cmd.exe window.
  • [P2] User-facing Windows gateway and uninstall docs still describe the old gateway.cmd fallback and cleanup shape.
  • [P1] The explicit falsey opt-out path can leave a generated gateway.vbs task launcher file behind on uninstall because task-launcher cleanup still follows the current predicate.

Maintainer options:

  1. Prove and finish the default switch (recommended)
    Add native Windows proof for the Scheduled Task action/no-console behavior, update the Windows docs, and cover task-launcher opt-out cleanup before merge.
  2. Accept the VBS tradeoff explicitly
    Maintainers can intentionally accept WSH/VBS as the default because explicit falsey env values still opt out, but that compatibility decision should be visible before landing.
  3. Coordinate with fallback-only work
    If maintainers want Scheduled Task and Startup-folder fallback changes separated, pause this PR and align it with fix(windows): hide startup fallback launcher with VBS #91249.

Next step before merge

  • [P1] Manual review is needed because automation cannot supply contributor-side native Windows/no-console proof or decide the compatibility-sensitive VBS default.

Security
Cleared: The diff reuses the existing local VBS launcher path and adds no dependencies, workflow changes, secret handling, or new external code source beyond the intended Windows launcher default.

Review findings

  • [P3] Update Windows launcher docs — src/daemon/schtasks.ts:231
  • [P3] Remove task launchers when opting out — src/daemon/schtasks.ts:231
Review details

Best possible solution:

Land the VBS default after native Windows proof or explicit maintainer acceptance is recorded, Windows launcher docs are aligned, and cleanup removes both task and Startup-folder launcher variants.

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

Yes, at source level: current main and v2026.6.6 leave the gateway Scheduled Task on gateway.cmd when the hidden-launcher env is unset, and the linked issue gives Windows 11 reproduction steps. I did not reproduce the desktop window live in this read-only review.

Is this the best way to solve the issue?

Yes, reusing the existing VBS launcher is the narrow fix for the reported launcher bug. It is not merge-ready until native proof, docs alignment, task-launcher cleanup, and compatibility acceptance are handled.

Full review comments:

  • [P3] Update Windows launcher docs — src/daemon/schtasks.ts:231
    This predicate now makes the Scheduled Task and Startup-folder fallback use VBS by default, but docs/gateway/index.md still describes a gateway.cmd fallback and docs/install/uninstall.md only removes gateway.cmd. Please update the user-facing Windows service docs so troubleshooting and cleanup match the new default.
    Confidence: 0.88
  • [P3] Remove task launchers when opting out — src/daemon/schtasks.ts:231
    After a default install writes gateway.vbs, setting OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER=0 makes resolveTaskLauncherScriptPath() return gateway.cmd; uninstallScheduledTask() then skips the sibling .vbs task launcher. Remove both task launcher variants on cleanup, matching the Startup-folder variant cleanup added here.
    Confidence: 0.8

Overall correctness: patch is correct
Overall confidence: 0.82

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority Windows daemon usability and availability fix with platform-limited blast radius.
  • merge-risk: 🚨 compatibility: Existing Windows installs can switch to a VBS launch path on refresh, which may fail on hosts where Windows Script Host is disabled or constrained.
  • 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 stronger real behavior proof before merge: The PR body has terminal proof from a macOS schtasks shim, not native Windows Scheduled Task/no-console proof; add redacted Windows terminal, log, screenshot, video, or linked artifact evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1, Tests +33. Total +34 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 4 +1
Tests 2 48 15 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 53 19 +34

What I checked:

  • Repository policy applied: Root policy was read fully and applies because Windows startup/fallback defaults are compatibility-sensitive and PR proof must cover user-visible behavior before merge. (AGENTS.md:21, e7ee1c55b433)
  • Current main still uses opt-in hidden launcher: Current main only returns true for 1, true, or yes, so unset gateway installs still use gateway.cmd. (src/daemon/schtasks.ts:228, e7ee1c55b433)
  • Latest release has the same shipped behavior: The latest release tag v2026.6.6 still has the truthy-only hidden-launcher predicate and the same task-launcher uninstall predicate. (src/daemon/schtasks.ts:228, 8c802aa68351)
  • PR flips the shared launcher default: At PR head, unset env now selects the VBS launcher and only 0, false, or no opt out. (src/daemon/schtasks.ts:229, 0bf82185e430)
  • PR adds focused default coverage: The PR updates tests so fresh and existing Scheduled Task installs assert gateway.vbs is the default action path, and fallback tests assert VBS Startup-folder entries and cleanup paths. (src/daemon/schtasks.install.test.ts:214, 0bf82185e430)
  • Task launcher cleanup gap remains: Uninstall still computes the task launcher through the current predicate, so after a default VBS install an explicit falsey opt-out makes cleanup skip the sibling gateway.vbs task launcher. (src/daemon/schtasks.ts:1269, 0bf82185e430)

Likely related people:

  • giodl73-repo: Merged PR history shows this contributor added the VBS hidden launcher path, the OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER env contract, and related daemon coverage. (role: introduced hidden-launcher behavior; confidence: high; commits: 9ac7773b7f07; files: src/daemon/schtasks.ts, src/daemon/node-service.ts, src/daemon/service-env.ts)
  • MoerAI: Recent history reworked the Scheduled Task XML/create/update path that this PR now points at gateway.vbs by default. (role: recent scheduled-task installer contributor; confidence: medium; commits: d92a33306e57; files: src/daemon/schtasks.ts, src/daemon/schtasks.install.test.ts)
  • Peter Steinberger: Git history shows repeated Windows daemon fallback, stop, cleanup, and service lifecycle work around the same module and tests. (role: fallback lifecycle contributor; confidence: medium; commits: 433e65711f78, 32d8ec948262, 5189ba851c2d; files: src/daemon/schtasks.ts, src/daemon/schtasks.startup-fallback.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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels Jun 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49516660b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/daemon/schtasks.ts
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 2, 2026
@wyf027
wyf027 force-pushed the leno23/fix-windows-task-hidden-launcher-89231 branch from 4951666 to d998514 Compare June 2, 2026 08:06
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 2, 2026
@wyf027
wyf027 marked this pull request as draft June 2, 2026 13:24
@wyf027
wyf027 marked this pull request as ready for review June 5, 2026 09:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d998514e23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/daemon/schtasks.ts
@wyf027
wyf027 marked this pull request as draft June 12, 2026 13:17
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. 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 12, 2026
Rebase PR #89380 onto current upstream/main and preserve cleanup of stale startup launcher variants.
@wyf027
wyf027 force-pushed the leno23/fix-windows-task-hidden-launcher-89231 branch from 9535ce2 to 0bf8218 Compare June 13, 2026 15:10
@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. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 13, 2026
@wyf027

wyf027 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Closing this stale draft PR because it has been open for a long time without merge. I can reopen or resubmit if needed.

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

Labels

gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: S 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.

[Bug]: Windows installer-created scheduled task launches gateway.cmd with visible console — should use windowless launcher

1 participant