GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — fix(server): preserve historical service health probes by kitlangton · Pull Request #50824 · anomalyco/opencode Conversation
|
| Server state | Historical probe receives |
|---|---|
| Starting | 503 with PID/version and Retry-After: 1 |
| Ready | 200 with PID/version |
| Failed boot | 500 with PID/version; diagnostics owner remains alive |
| Stopping, while the listener is available | 503 with PID/version and Retry-After: 1 |
| Missing or incorrect password | 401 authentication challenge |
sequenceDiagram
participant Old as Already-running old TUI
participant Server as New background server
participant New as New client
New->>Server: GET /api/info
Server-->>New: 200; endpoint resolved
Old->>Server: GET /api/status
alt Before
Server-->>Old: 404
Old->>Server: SIGTERM after incompatibility detection
Note over New,Server: New client's next request loses its server
else After
Server-->>Old: 200 with current PID/version
Note over Old,Server: Reconnect resolves; no signal is sent
end
Committed regression: two isolated subprocess cases boot the actual ServerProcess. A lifecycle barrier holds the server in starting state; each case then either becomes ready or fails real SQLite initialization. Both health paths must return the correct identity/status and reject missing/wrong passwords. The test also checks orderly teardown. No installed service or personal configuration is used.
d56ce74373, both positive cases fail: /api/status returns the generic starting response without the required identity.Supplemental historical-client audit: a separate local verification harness extracted all client source files verbatim from b642c1d9ea5e5100d40405705371b77d7464cbad (the parent of rename commit ab3566ab82), with a SHA256 manifest. It ran the actual historical Effect ensure({ version: undefined }), including its generated Promise transport and persistent-terminal handoff, against an isolated real CLI/server. Transparent child-local audit wrappers forwarded real HTTP calls and signals, restricting signal targets to the owned server.
| Same positive historical reconnect assertion | Observed result |
|---|---|
| Base server | Fails: /api/status 404, successful handoff request, actual SIGTERM, server exits |
| Candidate server | Passes: /api/status 200, client resolves, no signal, same live PID/registration |
All 9 supplemental cross-version cases passed after the fix: historical/current ready reconnect, wrong-password rejection, explicit version replacement, explicit stop, and historical/current clients observing real starting→ready and failed-boot states. That broader audit harness is being prepared as separate verification work; the permanent regression in this PR runs without historical Git objects.
The strengthened supplemental run also exercises stopping after real Status.beginStopping, using a child-local scheduling shim to delay continuation before listener closure. Both endpoints return 503, Retry-After: 1, PID/version, and empty-body 401 for incorrect authentication. Historical/current starting and failed-state cases also check empty-body 401. The combined historical/lifecycle run passes 10 tests, 89 assertions on this candidate.
The same strengthened positive suite was also run against a clean detached checkout of this PR's exact parent, d56ce743737005b0b75c693e6a45589f75dedd2b: 6 controls passed, 4 failed. The failures were historical ready reconnect sending SIGTERM, starting/stopping responses missing PID/version, and the historical failed-boot case timing out while waiting for the required 500 response. That last test currently reports its response-wait timeout, rather than recording the unexpected response; the base dispatcher routes failed-state /api/status to generic 503. The unchanged suite then passed 10/10 against e640afe7cdeac7c5a3a0e76cde63233531dbd8c8.
Two supplemental real crash controls also pass (16 assertions): kill after bind/before registration, or after registration/before boot, then a fresh actual CLI rebinds the same fixed port with a distinct healthy PID. These establish fresh-contender recovery, not retries by an already-failed contender or durable Session recovery.
The audit establishes the caller and signal sender in the controlled reproduction. It does not identify a sender from the original incident's HTTP logs. The committed tests directly exercise starting, ready, and failed states; the stopping/crash schedules remain supplemental pending publication of the separate verification harness.
This repairs the historical health probe for process-hosted servers. It does not promise full API compatibility with old clients. #50825 covers current-client protocol-only reconnect; #50840 covers TUI bootstrap recovery. #50042, #50782, and #50784 address other independently reproduced lifecycle failures.
cd packages/server bun run test test/process-health.test.ts --rerun-each 3 bun run test test/process-health.test.ts test/process.test.ts test/service-status.test.ts bun typecheck cd ../.. bun run check bunx prettier --check packages/server/src/process.ts packages/server/test/process-health.test.ts packages/server/test/fixture/process-health.ts git diff --check
v2 00738c5b2d. Upstream one-time-link pairing (feat(server): pair with one-time connect links #50970/feat(app): replace password pairing with one-time links #50972) changed every 401 body from empty to {"_tag":"UnauthorizedError","message":"Authentication required"}; the committed fixture now asserts that body. Status 401 and the WWW-Authenticate challenge are unchanged. The pinned historical client decodes 401 bodies and finds no version/pid either way, so its classification is unchanged. On the rebased head: regression red against unmodified v2 process.ts (2 failed), green with this change (6/6 across three runs); combined suites 7/7, 148 assertions; root lint/typecheck passes. The supplemental "empty-body 401" results above predate the rebase.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e640afe to
18d8416
Compare
|
Closing this. Only v2.0.4 and v2.0.5 clients kill a server when The lasting fix is #50825, which stops clients from killing a server over a health protocol mismatch at all. Separately, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.