Skip to content

fix(node): hide Windows node task launcher#81267

Merged
giodl73-repo merged 6 commits into
openclaw:mainfrom
giodl73-repo:fix-windows-node-task-hidden
May 17, 2026
Merged

fix(node): hide Windows node task launcher#81267
giodl73-repo merged 6 commits into
openclaw:mainfrom
giodl73-repo:fix-windows-node-task-hidden

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #81254.

openclaw node install currently writes the Windows node login task as a direct node.cmd target, which can leave a persistent command window open after login. The node host is expected to behave like a background service, so this PR opts node installs into a hidden Windows launcher while leaving the generated node.cmd script available for status/restart/script inspection.

This PR:

  • adds a node-only hidden launcher opt-in through the service environment;
  • stages the normal node.cmd script plus a sibling node.vbs launcher;
  • points Windows scheduled-task and Startup-folder fallback entries at the hidden launcher when the opt-in is set;
  • keeps the gateway scheduled-task path on the existing .cmd target unless it explicitly opts in.

Validation

  • node scripts/test-projects.mjs src/daemon/schtasks.install.test.ts src/daemon/schtasks.startup-fallback.test.ts src/commands/node-daemon-install-helpers.test.ts src/cli/node-cli/register.test.ts src/daemon/service-env.test.ts --reporter=verbose
  • node scripts/check-changed.mjs
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
  • ./node_modules/.bin/oxfmt.CMD --check --threads=1 CHANGELOG.md src/daemon/schtasks.ts src/daemon/schtasks.install.test.ts src/daemon/schtasks.startup-fallback.test.ts src/daemon/node-service.ts src/daemon/service-env.ts src/daemon/service-env.test.ts
  • git diff --check

Real behavior proof

  • Behavior or issue addressed: openclaw node install should opt the node service into a hidden Windows launcher, staging node.cmd plus node.vbs so the command host starts hidden instead of leaving a visible command window at login.
  • Real environment tested: WSL Ubuntu-24.04 source worktrees created from upstream/main and PR head 1fa6b3aefbed39082252600bb862759e3b2d0de7, using OpenClaw's real node service environment builder and scheduled-task staging code.
  • Exact steps or command run after this patch: created clean detached worktrees for upstream/main and fork/fix-windows-node-task-hidden; in each worktree ran node --import ./node_modules/tsx/dist/loader.mjs ./probe-hidden-node-task.mjs. The probe called buildNodeServiceEnvironment({ platform: "win32" }) and stageScheduledTask() with a temp state dir, then checked whether staging produced the hidden node.vbs launcher and whether it runs the generated node.cmd via WScript.Shell.Run(..., 0, False).
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):

PR #81267 hidden Windows node task launcher before/after proof

Fresh proof artifact: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81267-fresh/pr-81267/pr-81267-hidden-windows-node-task-launcher-before-after-proof.png
Proof summary: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81267-fresh/pr-81267/summary.txt

BEFORE upstream/main:
ref=d533a65f56ad
nodeHiddenFlag=<missing>
taskScriptName=node.cmd
scriptExists=true
launcherExists=false
launcherUsesWscriptShell=false
launcherRunsHidden=false
ok=false

AFTER PR #81267 head:
ref=1fa6b3aefbed
nodeHiddenFlag=1
taskScriptName=node.cmd
scriptExists=true
launcherExists=true
launcherUsesWscriptShell=true
launcherRunsHidden=true
ok=true
  • Observed result after fix: upstream/main stages only node.cmd and has no node hidden-launcher opt-in. PR head marks node installs with OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER=1, stages node.cmd plus node.vbs, and the generated launcher invokes node.cmd hidden with WScript.Shell.Run(..., 0, False).
  • Additional local Windows proof: in a Windows source checkout where schtasks /Create /SC ONLOGON was denied, the Startup-folder fallback installed node.vbs; a directly registered Windows Task Scheduler proof also ran the generated node.vbs action successfully and completed without leaving matching cmd, conhost, wscript, or cscript processes behind.
  • What was not tested: no actual sign-out/sign-in cycle was captured from this shell. The fresh proof covers OpenClaw's node service environment and scheduled-task staging boundary; the regression tests cover scheduled-task /TR node.vbs behavior.

Root cause

The shared Windows scheduled-task installer wrote direct .cmd task targets, and the node service reused that default even though node is expected to behave like a background service. There was no node-specific test requiring a hidden Windows launcher.

User-visible / Behavior changes

On Windows, openclaw node install launches the node host through a hidden launcher. Users should no longer see a persistent command window from the node login task.

Security impact

No new permissions, network access, secret handling, or data access. The generated launcher only invokes the existing generated task script in hidden mode.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

/review

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels May 13, 2026
@clawsweeper

clawsweeper Bot commented May 13, 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.

@clawsweeper

clawsweeper Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
The PR adds a node-only Windows hidden-launcher opt-in, stages node.cmd plus a sibling node.vbs, and routes scheduled-task and Startup-folder launcher entries to the hidden launcher when requested.

Reproducibility: yes. source-reproducible. Current main routes the Windows node login task to node.cmd directly, and the linked issue plus PR proof show that the PR changes the real staging path to a hidden launcher.

Real behavior proof
Sufficient (linked_artifact): The PR body links after-fix proof artifacts and copied output showing the real staging path now emits node.vbs with hidden WScript.Shell.Run, plus additional Windows Task Scheduler proof context.

Next step before merge
A narrow automated repair can restore or remove the corrupted changelog diff while leaving the daemon implementation intact.

Security
Cleared: The diff adds a hidden launcher around the already-generated task script and does not add permissions, dependency sources, secret handling, or network access.

Review findings

  • [P2] Restore CHANGELOG.md encoding — CHANGELOG.md:1
Review details

Best possible solution:

Keep the hidden-launcher implementation and focused tests, remove the corrupted CHANGELOG.md diff, and let maintainers handle any release-note entry during landing.

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

Yes, source-reproducible. Current main routes the Windows node login task to node.cmd directly, and the linked issue plus PR proof show that the PR changes the real staging path to a hidden launcher.

Is this the best way to solve the issue?

Mostly yes. The node-scoped node.vbs launcher preserves the inspectable node.cmd script and keeps gateway behavior opt-in, but the changelog encoding regression must be fixed before merge.

Full review comments:

  • [P2] Restore CHANGELOG.md encoding — CHANGELOG.md:1
    The patch re-encodes the changelog: line 1 gains a UTF-8 BOM and existing Unicode entries are converted to mojibake such as queued → thinking. That would publish broken release notes and unrelated churn; please restore this file to the main version and leave release-note handling to maintainers at landing.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.88

Acceptance criteria:

  • git diff --check
  • oxfmt --check CHANGELOG.md
  • node scripts/test-projects.mjs src/daemon/schtasks.install.test.ts src/daemon/schtasks.startup-fallback.test.ts src/commands/node-daemon-install-helpers.test.ts src/cli/node-cli/register.test.ts src/daemon/service-env.test.ts --reporter=verbose

What I checked:

  • protected label: Live issue-label data lists maintainer on this open PR, so this cleanup workflow must not close it.
  • current-main node task target: Current main sets OPENCLAW_WINDOWS_TASK_NAME and OPENCLAW_TASK_SCRIPT_NAME=node.cmd for node service installs, with no hidden-launcher opt-in. (src/daemon/node-service.ts:19, 6a8a6551fc4e)
  • current-main scheduler staging: Current main writes only the task script and returns scriptPath; it has no companion launcher path or VBS generation branch. (src/daemon/schtasks.ts:600, 6a8a6551fc4e)
  • documented service expectation: The node CLI docs describe openclaw node install as installing a headless node host as a background user service, supporting the bug expectation. Public docs: docs/cli/node.md. (docs/cli/node.md:86, 6a8a6551fc4e)
  • PR hidden-launcher implementation: The PR diff adds OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER=1, selects a .vbs launcher path when requested, writes a WScript.Shell.Run(..., 0, False) launcher, and adds focused scheduled-task/startup fallback tests. (src/daemon/schtasks.ts:118, 90cb3b13a88c)
  • blocking changelog encoding regression: The PR diff adds a UTF-8 BOM at the start of CHANGELOG.md and converts existing Unicode entries into mojibake such as queued → thinking, which would ship corrupted public release notes. (CHANGELOG.md:1, 90cb3b13a88c)

Likely related people:

  • steipete: Git history ties the node daemon introduction and later Windows startup gateway work to Peter Steinberger, whose GitHub handle appears in the PR timeline context. (role: introduced behavior and recent area contributor; confidence: high; commits: ae0b4c49903d, fccb2b8ace6c; files: src/daemon/node-service.ts, src/daemon/schtasks.ts, src/daemon/service-env.ts)
  • yfge: The PR discussion records their review that the code path and focused checks looked fine pending stronger Windows Scheduled Task proof, and nearby history includes localized schtasks fallback work. (role: recent Windows scheduled-task reviewer; confidence: medium; commits: 03e6a029ab12; files: src/daemon/schtasks.ts, src/daemon/schtasks.startup-fallback.test.ts)
  • tmimmanuel: Git history shows prior work preserving Windows scheduled-task restart/install behavior in the same daemon scheduler surface. (role: adjacent scheduled-task behavior contributor; confidence: medium; commits: 0fef95b17d72; files: src/daemon/schtasks.ts, src/daemon/schtasks.install.test.ts, src/daemon/schtasks.startup-fallback.test.ts)

Remaining risk / open question:

  • CHANGELOG.md is currently re-encoded with a BOM and mojibake, so the branch would publish corrupted release notes unless that diff is removed or restored to valid UTF-8.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 3fad770510e9.

@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch from 0638ef2 to b1b18ff Compare May 13, 2026 03:47
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

/review

@clawsweeper

clawsweeper Bot commented May 13, 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:

@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch from b1b18ff to 13aede8 Compare May 13, 2026 04:54
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Rebased on current origin/main and reran focused verification.\n\nChecks:\n- oxfmt --check changed files\n- node scripts/test-projects.mjs src/daemon/schtasks.install.test.ts src/daemon/schtasks.startup-fallback.test.ts src/daemon/service-env.test.ts --reporter=verbose\n- node scripts/check-changed.mjs\n- git diff --check\n\nStill draft pending the requested real Windows Scheduled Task proof.\n\n@clawsweeper re-review

@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch 2 times, most recently from 3614240 to 4a5fbfa Compare May 13, 2026 06:06
@yfge

This comment was marked as spam.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Updated the PR body with stronger Windows scheduled-task proof. I still cannot create the task through local schtasks /Create /SC ONLOGON from this shell, but I registered the generated hidden node.vbs launcher as a real Windows At logon task through Task Scheduler, verified it with schtasks /Query, ran it with Start-ScheduledTask, and captured Last Result: 0 plus the marker written by the generated node.cmd.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 13, 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:

@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch from 4a5fbfa to 36276ba Compare May 13, 2026 10:22
@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch 3 times, most recently from f11e76f to 46779ed Compare May 14, 2026 13:58
@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch 2 times, most recently from 66583d9 to 5ae6492 Compare May 16, 2026 06:04
@giodl73-repo
giodl73-repo marked this pull request as ready for review May 16, 2026 06:09
@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch 3 times, most recently from d5c4fb4 to 553da78 Compare May 16, 2026 13:27
@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch from 553da78 to 02fc79d Compare May 16, 2026 14:11
@giodl73-repo
giodl73-repo force-pushed the fix-windows-node-task-hidden branch from 02fc79d to 1fa6b3a Compare May 16, 2026 14:16
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Updated #81267 with a fresh deterministic proof image and a cleaner gate-friendly proof section.

The proof compares upstream/main against PR head 1fa6b3aefbed39082252600bb862759e3b2d0de7 in clean source worktrees. It exercises OpenClaw's real node service environment builder and scheduled-task staging path:

  • Before: node installs stage node.cmd, but OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER is missing and no node.vbs hidden launcher is generated.
  • After: node installs set the hidden-launcher opt-in, stage node.cmd plus node.vbs, and the generated VBS uses WScript.Shell.Run(..., 0, False).

Fresh artifact: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81267-fresh/pr-81267/pr-81267-hidden-windows-node-task-launcher-before-after-proof.png
Summary: https://raw.githubusercontent.com/giodl73-repo/openclaw/proof-artifacts/pr-81267-fresh/pr-81267/summary.txt

@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label May 17, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 17, 2026
@giodl73-repo
giodl73-repo merged commit 9ac7773 into openclaw:main May 17, 2026
113 checks passed
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 20, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows node Scheduled Task opens persistent cmd window at login

2 participants