Skip to content

fix(windows): repair legacy gateway fallback updates#101213

Merged
steipete merged 23 commits into
mainfrom
codex/pr-88311-replay
Jul 6, 2026
Merged

fix(windows): repair legacy gateway fallback updates#101213
steipete merged 23 commits into
mainfrom
codex/pr-88311-replay

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Windows gateways that fell back to a Startup-folder launcher can remain on that legacy path across openclaw update. When the configured gateway port or service command changes, the updater can leave the old process alive, rewrite the task around it, or remove the fallback before the replacement Scheduled Task is actually running.

Fixes #87156.
Supersedes #88311; this maintainer branch preserves and extends @vincentkoc's original work because that branch does not allow maintainer edits.

Why This Change Was Made

  • Capture the installed fallback command, environment, port, and runtime before rewriting the service.
  • Require exact process ownership before stopping or replacing a running fallback.
  • Preflight the replacement port before any mutation.
  • Preserve legacy gateway auth before reinstalling the service.
  • Bound the Scheduled Task evidence poll and roll back to the captured fallback if replacement startup cannot be proven.
  • Accept the exact persisted replacement process as running evidence while its listener is still starting; full argv matching prevents an unrelated same-port gateway from being attributed to the task.
  • Restart repaired gateways after git-driven updates and thread repair results through CLI, gateway, and doctor update paths.

User Impact

On Windows, doctor-driven updates migrate owned Startup-folder gateway fallbacks to Task Scheduler without losing auth or leaving the old gateway on a stale port. Fallback launchers are removed only after the replacement task has concrete running evidence; failed takeover restores the prior fallback.

Evidence

Current head: 8c685fdcd1fe69b3d8b7200edcd2d8e4f65d9f4f

  • Testbox: 584 relevant tests passed across update CLI, doctor, daemon, gateway, and update-runner surfaces.
  • pnpm check:changed: passed core production/test typechecks, full core lint, changelog checks, import-cycle and repository guards.
  • Blacksmith Testbox run: https://github.com/openclaw/openclaw/actions/runs/28828168676
  • Native Windows 11 Parallels proof built runtime head 01020960a7cdd3b4345f2c36afe7ca4c1647a12b and exercised a live legacy Startup fallback through doctor --fix. The current head differs only by removing a release-owned changelog line; runtime and tests are byte-identical:
    • pre_doctor_fallback_running=ok
    • native_windows_doctor_update_repair=ok
    • token_preserved_without_disclosure=ok
    • old_fallback_port_released=ok
    • fallback_removed_after_scheduler_evidence=ok
    • replacement gateway status: running; read probe: ok
  • Fresh structured autoreview: clean, no actionable findings (0.93 confidence).

vincentkoc and others added 22 commits July 6, 2026 23:39
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes commands Command implementations size: XL maintainer Maintainer-authored PR labels Jul 6, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for current head 8c685fdcd1fe69b3d8b7200edcd2d8e4f65d9f4f:

  • corepack pnpm test src/cli/update-cli.test.ts src/cli/update-cli/update-command.test.ts src/commands/doctor-gateway-services.test.ts src/commands/doctor-update.test.ts src/daemon/schtasks.startup-fallback.test.ts src/daemon/schtasks.stop.test.ts src/daemon/service-layout.test.ts src/flows/doctor-health-contributions.test.ts src/gateway/server-methods/update.test.ts src/infra/update-post-core-finalize.test.ts src/infra/update-runner.test.ts — 584 tests passed on Blacksmith Testbox.
  • corepack pnpm check:changed — passed core and core-test typechecks, full core lint, changelog validation, import-cycle check, and repository guards.
  • Testbox run: https://github.com/openclaw/openclaw/actions/runs/28828168676
  • Native Windows 11 Parallels: built runtime head 01020960a7cdd3b4345f2c36afe7ca4c1647a12b, started a real legacy Startup-folder gateway, changed the configured port, and ran doctor --fix. The current head differs only by removing a release-owned changelog line; runtime and tests are byte-identical. Proof markers: pre_doctor_fallback_running=ok, native_windows_doctor_update_repair=ok, token_preserved_without_disclosure=ok, old_fallback_port_released=ok, fallback_removed_after_scheduler_evidence=ok. The replacement Scheduled Task reported running and its live gateway read probe passed.
  • Fresh structured autoreview: clean; no accepted/actionable findings.

Known proof gaps: none for the changed Windows/update surfaces.

@steipete
steipete merged commit bb44c23 into main Jul 6, 2026
104 checks passed
@steipete
steipete deleted the codex/pr-88311-replay branch July 6, 2026 23:09
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
* fix(windows): repair doctor update fallback migration

* fix(windows): remove hidden startup fallback launchers

* fix(windows): preserve recovered gateway tokens

* fix(windows): harden update fallback migration

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): capture fallback runtime before task rewrite

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): complete legacy update restart handoff

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): verify fallback ownership during migration

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): honor update restart policy during repair

* fix(windows): wait for task takeover evidence

* fix(windows): preserve fallback after direct task launch

* fix(windows): preserve repaired task identity

* fix(windows): snapshot gateway before repair

* fix: scope update service repair ownership

* style: satisfy update lint checks

* fix: restart gateways stopped during updates

* fix(windows): enforce fallback process takeover

* fix(windows): prove fallback ownership during takeover

* fix(windows): verify process exit during takeover

* fix(windows): wait through fallback reloads

* fix(windows): harden fallback takeover ownership

* fix(windows): type takeover preflight inputs

* fix(windows): recognize booting replacement task

Co-authored-by: Vincent Koc <[email protected]>

* chore: leave changelog release-owned

---------

Co-authored-by: Vincent Koc <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
* fix(windows): repair doctor update fallback migration

* fix(windows): remove hidden startup fallback launchers

* fix(windows): preserve recovered gateway tokens

* fix(windows): harden update fallback migration

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): capture fallback runtime before task rewrite

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): complete legacy update restart handoff

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): verify fallback ownership during migration

Co-authored-by: Vincent Koc <[email protected]>

* fix(windows): honor update restart policy during repair

* fix(windows): wait for task takeover evidence

* fix(windows): preserve fallback after direct task launch

* fix(windows): preserve repaired task identity

* fix(windows): snapshot gateway before repair

* fix: scope update service repair ownership

* style: satisfy update lint checks

* fix: restart gateways stopped during updates

* fix(windows): enforce fallback process takeover

* fix(windows): prove fallback ownership during takeover

* fix(windows): verify process exit during takeover

* fix(windows): wait through fallback reloads

* fix(windows): harden fallback takeover ownership

* fix(windows): type takeover preflight inputs

* fix(windows): recognize booting replacement task

Co-authored-by: Vincent Koc <[email protected]>

* chore: leave changelog release-owned

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows doctor update leaves Startup-folder gateway fallback stale and does not install Scheduled Task

2 participants