Repository navigation
[Air #1999] Tower: cheap GET /api/liveness route; CLI probe and afx send use it - #2000
Closed
waleedkadous wants to merge 9 commits into
Closed
waleedkadous wants to merge 9 commits into
waleedkadous wants to merge 9 commits into
Conversation
…nd older-Tower check use it
…ute docs name the keyless probes
waleedkadous
marked this pull request as draft
November 26, 2026 23:12
waleedkadous
marked this pull request as ready for review
November 27, 2026 00:03
Contributor
Author
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.
Implements #1999 (a cheap liveness route, so the CLI's "is Tower up?" probe stops running a process census under load).
Summary
GET /api/livenessreturns{ status: 'alive', version, schemaVersion, startedAt }(wire typeTowerLivenessincodev-types). It does no work: no instance list, no process census, no database read. Every field is fixed at boot, andschemaVersionis theGLOBAL_CURRENT_VERSIONconstant. The route is public like/healthand sits behind the boot readiness gate like every route.probeHealthasks/api/liveness. It asks/healthonly when the liveness route gets the catch-all 404 a Tower gives a route it does not have. A 401 also triggers it: that is what an older Tower gives a client without the key, because the route is not public there (a VS Code client with no key, for example). A probe that goes unanswered (timeout, reset) or is refused never falls back, so a starved Tower is not handed the heavy route.TowerHealthProbe'srunningvariant now carriesliveness: TowerLiveness | null, where null means an older Tower. Nothing read the old.healthfield./healthis unchanged forafx statusand the dashboard.afx send's older-Tower check (explainNotFound) calls the newgetLiveness()in place of the address-book probe. If the route answers, the Tower knows the<workspace>:architect:<name>form and its not-found stands. The catch-all 404 means an older Tower. No HTTP answer at all means busy, and the message says so./healthis no longer what was asked (tower-check.ts,send.ts,tower.ts).arch.mdgets a liveness-probe bullet and an updated public-allowlist entry, and theisPublicRoutecomment names the keyless probes.Why a new route and not
/api/version/api/version(#983) already does no work, but it predates Spec 1940, so whether it exists says nothing about the address form. The issue asks for a route whose 404 is itself the answer./api/versionis left exactly as the VS Code preflight reads it.Testing
air-1999-liveness-route.test.tsspies ongetInstances,listProcessCensus,getGlobalDb,getDb,db.prepareandgetShellperManager. A control test asks/healthfirst and requires all of them to fire, so a spy that isn't wired to what the routes really call fails the control rather than passing the liveness test by accident. The liveness request then calls none of them. The file also pins the body and the public, GET-only route.tower-client.test.tscovers the probe against the new route: running, not-running and unresponsive (timeout, a 200 that isn't a liveness body, a partial body, a 404 that carries a code). An unanswered probe makes exactly one request and never asks/health. Against an older Tower it covers the fallback on the catch-all 404 and on a 401, plus/healthclassified as before (healthy, timeout, 503, degraded, refused). It also coversgetLiveness()'s classification.spec-1940-older-tower-send.test.tsandbugfix-1901-send-unresponsive.test.tsdrive the real command over a fake transport. An older Tower makes the requestsGET /api/liveness,GET /health,POST /api/send,GET /api/liveness, followed by the restart message. The address book is never asked. Against a current Tower,/healthis never asked.afx tower startuses this probe): https://github.com/cluesmith/codev/actions/runs/45909504370 passed. Install verification, CLI tests, unit tests and both probes (x64 and ARM) succeeded; install guard and targeted tests were skipped.packages/codevunit suite 10003 passed, 116 skipped (460 files), and porch build/tests checks green, SDK 455 passed, VS Code 1981 passed (1 skipped), and the build passes.Review (AIR: in place of a review file)
Consultation: codex returned COMMENT and claude returned APPROVE, both HIGH confidence. Gemini isn't in this repo's porch consultation config.
isTowerLivenesschecked onlystatusandversion, but narrowed to a type whoseschemaVersionandstartedAtare required. It now checks all four fields, and a test pins the partial-body case. Claude noted that the public-route docs said every entry exists for a browser navigation, which/api/livenessdoesn't. The wording is fixed inserver-utils.tsandarch.md. Codex flagged a stale test header comment, which is fixed.mainafter Spec 1940 but before this PR would be called "older" by mistake. No release is affected: v3.3.8 has neither change, and both ship in the next release. If a release were cut between the two, that would stop being true./healthis today, so "running" still means "can serve". Exempting it would make the probe a pure event-loop signal, but it is a behaviour change outside this issue.Lessons
/healthfor any path. Two such afx: 'Tower is not running' reported under high load while Tower is up; the real probe error is discarded #1901 test files only showed up in the full-suite run. For a change like this, grep the fixtures for the route, not just the assertions.Possible follow-ups (left alone, other call sites):
db/tower-owner.tsprobeTowerHealthstill sends a raw/healthrequest, though only on the owner-lock conflict path.connection-managercallsgetHealth()on connect, for uptime only.Flaky Tests
None seen.