fix: remove duplicate restart message on Windows (schtasks)#63651
fix: remove duplicate restart message on Windows (schtasks)#63651Chudwx wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR removes two direct Confidence Score: 5/5Safe to merge; the fix is minimal and correct, the only finding is a P2 style cleanup. The core schtasks fix is a clean two-line removal with a clear root cause. The bundled browser SSRF commits are well-tested. The single finding (unused stdout parameter in the private restartStartupEntry function) is P2 style and does not affect behavior. No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1b40c4701
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| import { inspectPortUsage } from "../infra/ports.js"; | ||
| import { getWindowsInstallRoots } from "../infra/windows-install-roots.js"; | ||
| import { killProcessTree } from "../process/kill-tree.js"; | ||
| import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js"; |
There was a problem hiding this comment.
Fix broken import of normalizeLowercaseStringOrEmpty
src/daemon/schtasks.ts now imports normalizeLowercaseStringOrEmpty from ../shared/string-coerce.js, but that module does not exist in the repo (src/shared/string-coerce.ts/js is missing). This causes module resolution to fail at load time, and because src/daemon/service.ts statically imports ./schtasks.js, daemon lifecycle commands can crash with ERR_MODULE_NOT_FOUND before any platform-specific branching.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changes: The PR removes Windows schtasks/startup-fallback restart stdout writes, factors scheduled-task run helpers/lowercase normalization, and adds browser profile CDP SSRF validation behavior and tests. Required change before merge: A narrow replacement PR is suitable because the observable Windows duplicate-output bug, affected files, and validation path are clear, while the source PR is mixed with unrelated security-sensitive browser changes and should not be repaired in place. Security review: Security review needs attention: The PR bundles unrelated browser CDP SSRF policy changes with a Windows gateway output fix, so that part needs to be split or explicitly security-reviewed before merge. Review findings:
Review detailsBest possible solution: Centralize Windows gateway restart success messaging so schtasks and startup-fallback completed restart flows print exactly one human success line after the final retry/check path, while keeping browser CDP SSRF policy work in a separate security-reviewed change. Do we have a high-confidence way to reproduce the issue? Yes. Current main has deterministic source evidence: schtasks/startup-fallback restart paths write to stdout, and stale-PID post-restart recovery can invoke the same restart implementation again. Is this the best way to solve the issue? No. Removing the service-layer writes alone is not the best fix because completed restarts are not centrally printed today, and the browser SSRF changes are outside the Windows restart-output scope. Full review comments:
Overall correctness: patch is incorrect Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a7a8c8121a67. |
Summary
Remove direct
stdout.write()calls fromrestartScheduledTask()andrestartStartupEntry()insrc/daemon/schtasks.tsthat caused "Restarted Scheduled Task" to print twice.Problem
When running
openclaw gateway restarton Windows with the Scheduled Task service manager, the output shows:Root Cause
Both
restartScheduledTask()andrestartStartupEntry()insrc/daemon/schtasks.tscallstdout.write()directly before returning. The callerrunServiceRestart()(inlifecycle-core.ts) also emits a structured message viaemitScheduledRestart(). WhenpostRestartCheckdetects stale pids and retries the restart, the second call also triggersemitScheduledRestart(), resulting in duplicate messages.Fix
Remove the direct
stdout.write()calls from both service restart functions. All restart messaging is already handled centrally byemitScheduledRestart().Changed files:
src/daemon/schtasks.ts: Remove 2 linesTesting
openclaw gateway restartand verify only one "Restarted" message appears