Repository navigation
fix(server): tell a CodeWork server runs from its URL, not its pid - #134
Merged
Merged
Conversation
A home's service.json counted only while its pid was alive here. A server in WSL registers a Linux pid the Windows app cannot see, so it always read as stopped. The app now opens the registration's URL instead: a server that answers runs, whatever OS it is on, and a registration left behind with nothing listening is stopped rather than unreachable. The default server still checks that the pid it reports is the registration's. The health test runs the real CLI and covers a pid from another OS and a server killed outright. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The app read a server as running only while the pid in its
service.jsonwas alive on the app's machine. A CodeWork server in WSL registers a Linux pid the Windows app can't see, so Settings always said "Stopped", even with Home pointed at\\wsl.localhost\<distro>\home\<you>\.codework.Status now comes from the registration's URL:
Codework.reachable(url): opens a WebSocket to the URL (2-second open timeout) and closes it, with no RPC call.liveAt: a home's server is live while its URL answers. This drives status for every server and the health poll's 5-second check of the default.server.infoand checks that the pid it reports is the registration's. That works across OSes, since both come from the same server, so another server on that port still reads "Unreachable".alive(pid)moves intoserver.ts, its only remaining user: the app server's own parent check.Home stays the way the app finds a local server: read
<home>/service.json, take the URL, connect.Testing
apps/server/test/health.test.tsnow runs the real CLI (codework serve --port 0from source) and covers:expected 'Stopped' to be 'Running'.readyline, as the desktop app does. It used to parse every stdout line, which broke once the app server logged.vp checkandvp run typecheckpass.🤖 Generated with Claude Code