-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Windows — openclaw update 期间 Scheduled Task PT3M 重复触发器重新拉起 gateway 导致竞态 #87993
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
概述
在 Windows 上运行
openclaw update时,stopScheduledTask()调用schtasks /End停止了当前运行的 gateway 实例,但 没有 disable 计划任务本身。OpenClaw Gateway任务的LogonTrigger带有PT3M重复间隔,会在 npm install 进行中的 3 分钟内重新拉起 gateway,导致新旧代码混合运行的竞态条件。影响版本
v2026.5.22+(P1D → P9999D 修复后)。5.22 之前重复时长仅 1 天,登录超过 1 天后触发器已过期,问题被掩盖。
根因
stopScheduledTask()在dist/schtasks-B45z-tnx.js:840-876中:schtasks /End只停止当前运行实例。计划任务的 XML 定义中:PT3M重复触发器仍然活跃,任务调度器会在下一个 3 分钟窗口自动重新执行gateway.cmd。竞态窗口
为什么 macOS/Linux 不受影响
launchctl bootout完全卸载 agent,不会自动重启systemctl --user stop停止服务,不会自动重启schtasks /End只停止运行中实例,重复触发器保持活跃修复建议
stopScheduledTask()应在schtasks /End后 disable 任务:restartScheduledTask()或更新后的重启阶段重新 enable:如果出于保守考虑不想改动通用 stop/restart 语义,也可以在 update 流程中单独处理——在
maybeStopManagedServiceBeforePackageUpdate()之后 disable,在maybeRestartService()之前 enable。复现步骤
OpenClaw Gateway计划任务存在且 PT3M 重复触发openclaw update(确保 npm install 耗时 > 3 分钟,或在此期间观察任务调度器)实际观察
用户在多次 update 中观察到:更新流程输出 "Stopping managed gateway service before package update..." 并停止了 Scheduled Task,但看门狗(内置 PT3M 触发器)在升级过程中反复拉起 gateway。