fix(windows): verify scheduled task launch source#91486
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 9, 2026, 1:48 AM ET / 05:48 UTC. Summary PR surface: Source -2, Tests +84. Total +82 across 4 files. Reproducibility: yes. at source level: the current and PR-head launch evidence paths can still count an existing foreground gateway process on the task port instead of proving the Scheduled Task or generated script started. Native Windows proof is still needed for the full Task Scheduler handoff. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Make launch proof require the managed Scheduled Task/generated script or a baseline-new process, ensure the fallback owns or reaches the configured port, and add redacted native Windows proof for the install/restart handoff. Do we have a high-confidence way to reproduce the issue? Yes at source level: the current and PR-head launch evidence paths can still count an existing foreground gateway process on the task port instead of proving the Scheduled Task or generated script started. Native Windows proof is still needed for the full Task Scheduler handoff. Is this the best way to solve the issue? No. Querying raw schtasks state is the right layer, but this is not the best fix until foreground process evidence is filtered/baselined, fallback port ownership is proven, and native Windows proof is supplied. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against e1978cf73cbd. Label changesLabel justifications:
Evidence reviewedPR surface: Source -2, Tests +84. Total +82 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
|
Thanks for the review. This PR requires real Windows Task Scheduler validation, but I don't currently have access to a suitable Windows environment to provide the requested real-behavior proof. To avoid keeping an unmergeable PR open, I'm closing this for now. I'm happy to reopen or submit a refreshed PR if I can get access to a real Windows setup later. |
Summary
Fix Windows Scheduled Task launch verification so an unrelated foreground gateway listener on the same port no longer counts as evidence that the managed Scheduled Task started.
Changes
schtasks /Query /TN ... /V /FO LISTstate inside the launch fallback decision instead of reusing listener-backed runtime status.not-yet-run, while still respecting real Last Run Time/status changes as launch progress./Runis accepted, task never starts, fallback launcher still runs.Real behavior proof
Behavior or issue addressed: After the fix, Windows gateway install/start/restart launch verification distinguishes Scheduled Task/script evidence from an unrelated foreground gateway listener, so an already-running foreground
openclaw gatewaylistener cannot suppress the fallback launcher whenschtasks /Runaccepts but the task never starts.Real environment tested: Repository
openclaw/openclaw, worktree/datad/github/openclaw-issue91144, branchfix/windows-scheduled-task-launch-proof, commitd184b5c38b66, on Linux host running the project's daemon test suite with mocked Windowsschtasks/process APIs.Exact steps or command run after this patch:
git diff --check pnpm exec oxlint src/daemon/schtasks.ts src/daemon/schtasks.startup-fallback.test.ts OPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs src/daemon/schtasks.startup-fallback.test.ts OPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs src/daemon/schtasks.test.ts pnpm tsgo:core:test OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm check:changed pnpm deadcode:ciEvidence after fix: Terminal output from the verification:
Observed result after fix: The new regression test passes: when
findVerifiedGatewayListenerPidsOnPortSyncreports an existing gateway listener and mockedschtasks /Runnever advances the Scheduled Task beyond never-run state,installScheduledTaskstill launches the Startup-style fallback instead of treating that listener as task launch evidence.What was not tested: A native Windows live run with real Task Scheduler was not available in this environment; the PR includes source-level Windows lifecycle coverage using the repository's existing Windows schtasks mocks.
Test Plan
git diff --checkpnpm exec oxlint src/daemon/schtasks.ts src/daemon/schtasks.startup-fallback.test.tsOPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs src/daemon/schtasks.startup-fallback.test.tsOPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs src/daemon/schtasks.test.tspnpm tsgo:core:testOPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm check:changedpnpm deadcode:ciNote: plain
pnpm check:changeddelegated to Blacksmith Testbox on this machine but crabbox failed its local binary sanity check before running project checks, so I ran the project check in the same remote-child mode locally and it exited 0.Risk
Low. The change is limited to the post-
schtasks /Runlaunch-proof path. Listener-backed status reporting remains available for installed Startup fallback runtime status; only the launch fallback decision stops accepting an unrelated listener as task-start evidence.Fixes #91144