Skip to content

fix(v2): stop lease checks and failed setups from destabilizing the host - #83

Merged
william-ricchiuti merged 2 commits into
mainfrom
wr/81-windows-service-crash
Oct 19, 2026
Merged

william-ricchiuti merged 2 commits into
mainfrom
wr/81-windows-service-crash

Conversation

@william-ricchiuti

Copy link
Copy Markdown
Owner

Refs #81

The reporter's OpenCode service died silently on Windows with 0.11.0 installed. There's no deterministic repro, so these are defensive fixes for the likeliest causes found in review. They are not a confirmed root-cause fix.

Changes

  • Lease liveness check never signals the host's own PID (src/persistence-lease.js). The lease check probes owners with process.kill(pid, 0). If Bun on Windows maps signal 0 to a real termination, a check against the service's own claim kills it with no log, which matches the report. Behavior on POSIX is unchanged (the own PID already counted as alive).
  • Partial OpenCode 2 setup failures are torn down (src/v2-bridge.js). A setup that threw partway used to leak its event subscription, timers, hook registrations and the core's persistence lease on each location boot. Teardown now lives in disposeInstance and also runs on failure. The next boot of the same location still starts cleanly.
  • Windows location keys unify / and \, so a reload with a differently spelled path retires the previous instance instead of running next to it.

Verification

  • 3 new tests; each fails on main and passes here.
  • npm run release:check: exit 0 (493 tests, mutation 90/90, type/packed contracts, smoke, audit 0 vulns).
  • Live smoke:v2-host against OpenCode 2.0.16: passes, same as main.

Not verified

  • Bun's signal-0 behavior on Windows. Windows CI runs Node, so it can't prove it. Confirming needs a Windows machine with Bun: spawn a dummy process, call process.kill(pid, 0) on it, and see whether it survives.
  • On 2.0.26, the live smoke fails for an unrelated reason that already exists on main (completion audit). That's fixed separately in the wr/v2-2.0.26-audit-verdict PR.

🤖 Generated with Claude Code

Skip the kill(pid, 0) liveness probe for the host's own pid, dispose
everything a partially failed OpenCode 2 setup started, and unify
Windows path separators when keying same-location instances.

Refs #81

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@william-ricchiuti
william-ricchiuti merged commit 8739f99 into main Oct 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant