Skip to content

fix(cli): handle Windows upgrades and lifecycle ACK failures - #488

Merged
lodystage[bot] merged 3 commits into
mainfrom
fix/windows-daemon-upgrade
Sep 8, 2026
Merged

fix(cli): handle Windows upgrades and lifecycle ACK failures#488
lodystage[bot] merged 3 commits into
mainfrom
fix/windows-daemon-upgrade

Conversation

@lodystage

@lodystage lodystage Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related issue

Same-repository bug fix; no linked issue.

Problem / pressure

Remote daemon updates fail on Windows because native Node spawn cannot directly
execute npm.cmd. Separately, an accepted restart or upgrade remains pending
forever when its RPC acknowledgement fails to append, blocking subsequent attempts.

Summary

Use the existing cross-spawn dependency for npm installation. For accepted
restart/upgrade requests, attempt ACK delivery with a five-second total budget,
then invoke the existing CLI lifecycle callback on success, failure, or timeout.
ACK errors remain diagnostic and do not produce a contradictory operation-failed
response. Rejected requests never invoke the callback.

Retain the existing process exit guard and upgrade preparation. Add synthetic npm
shim tests and fake-clock ACK delivery tests. Document the acceptance semantics
in a draft Spec and record both fixes in Agent Notes.

Before / after

Before After
Native spawn attempts to execute npm.cmd directly. cross-spawn handles the Windows command shim.
An ACK failure leaves accepted work pending indefinitely. Accepted work proceeds after ACK success, failure, or the five-second deadline.
A stalled ACK prevents the lifecycle callback. A late ACK completion cannot trigger the callback again.

Test plan

  • Lifecycle installation tests: 10 passed on macOS using isolated temporary npm shims.
  • RPC package tests: 110 passed, 3 optional integration tests skipped. New coverage includes both actions with success, exhausted retries, timeout followed by late success/failure, and rejected requests with successful/failed delivery.
  • pnpm check: passed, including typecheck, lint, full tests, i18n, and boundary checks. Existing local IPC tests ran outside the sandbox to allow socket creation.
  • pnpm format and pnpm run docs check: passed; unrelated formatter output excluded.
  • No real daemon restart, global installation, or Windows deployment was exercised locally.

Context handoff

Instructions for reviewing agents

  • Review focus: Inspect the accepted/rejected branch and ensure ACK failure never strands accepted work or emits an operation-failed response.
  • Decisions to challenge: The five-second ACK waiting budget and continuing accepted work when the client cannot receive confirmation.
  • Plausible failures / evidence gaps: Windows execution is unverified locally; the underlying append is not cancelled by the deadline, and cross-restart deduplication is outside this patch.

Authoring context

  • User goal / directives: Fix Windows npm launching and apply the minimal ACK-failure fix in this same PR; no Issue association is requested.
  • Constraints / non-goals: Keep process-wide preparation serialization, cross-restart deduplication, and completion UI separate.
  • Risk-bearing decisions: Accepted work continues despite ACK failure; a client timeout does not imply cancellation. The existing one-time process exit guard remains authoritative.
  • Destructive or irreversible behavior: Existing explicit upgrades still install globally and lifecycle requests still exit the worker; no additional migration or installation target is introduced.
  • Deliberately not done or tested: No real remote operation, Windows process-tree cancellation, or registry installation was tested.
  • Unknowns / confidence: Synthetic tests cover delivery failures and late completion; deployed transport and Windows installation behavior still need real-environment validation.

@lodystage lodystage Bot changed the title fix(cli): launch Windows daemon upgrades through npm shim fix(cli): handle Windows upgrades and lifecycle ACK failures Sep 8, 2026
@lodystage
lodystage Bot marked this pull request as ready for review September 8, 2026 05:59
@lodystage
lodystage Bot merged commit a07eeba into main Sep 8, 2026
8 checks passed
@lodystage
lodystage Bot deleted the fix/windows-daemon-upgrade branch September 8, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant