Repository navigation
[Air #1977] feat: cheap /health/live liveness route with Tower's version - #2001
Merged
Merged
Conversation
GET /health/live answers {status, version, startedAt, schemaVersion} from what the
process already holds: no instance list, no process census, no database read. The
SDK's probeHealth asks it first and falls back to /health only when an older Tower
answers 404 (keyed) or 401 (keyless). afx send's older-Tower check asks the liveness
route instead of the whole address book. Unresponsive messages now name the route
that went unanswered. /health keeps its census for status and the dashboard.
- getLiveness: a keyless client's 401 from an older Tower is an unknown route when the public /health answers healthy (codex) - VS Code terminal give-up probe uses isRunning (liveness route), not getHealth - route test positively asserts every heavy spy on the /health side - document schemaVersion as a constant of the running code
waleedkadous
marked this pull request as draft
November 26, 2026 23:20
The /tmp residue check (Spec 1658) failed CI: the test's dashboard path and socket dir are opaque strings that never reach the disk, so they need no /tmp at all.
- SDK validates the whole liveness body (status, version, startedAt, schemaVersion) before returning it as TowerLiveness; a malformed 200 is unresponsive from probeHealth and a flagless failure from getLiveness, with tests for each field - arch.md: afx send's older-Tower check is getLiveness() on /health/live, not the address-book route or failedForAnOlderTower - public-route rationale (server-utils.ts, arch.md) names both kinds: browser navigation paths and keyless SDK/CLI probes - VS Code terminal-adapter comments and tests say liveness probe, not /health
waleedkadous
marked this pull request as ready for review
November 27, 2026 07:04
waleedkadous
added a commit
that referenced
this pull request
Nov 27, 2026
waleedkadous
added a commit
that referenced
this pull request
Nov 27, 2026
This was referenced Nov 27, 2026
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
Every CLI command probes Tower before it talks to it (#1901), and that probe hit
GET /health, Tower's heaviest read: instance list, process census, global.db read. This addsGET /health/live, which does none of that and reports Tower's version. The probe andafx send's older-Tower check now use it.Closes #1977
What Changed
GET /health/live(tower-routes.ts). It answers{ status: 'healthy', version, startedAt, schemaVersion }fromRouteContextplus theGLOBAL_CURRENT_VERSIONconstant. It has no instance list, no census and no DB read. It is public like/health(isPublicRoute)./healthis unchanged, for status, the dashboard and doctor.codev-types):TOWER_LIVENESS_ROUTEandTowerLiveness. The SDK mirrors the route literal the way it mirrorsCOMMAND_ROUTE, because its zero-runtime-deps boundary test forbids a runtime import from codev-types. A route test pins the two strings equal.probeHealthasks/health/livefirst. It falls back to/healthonly when the Tower answers that it has no such route. Therunningprobe now carrieslivenessinstead ofhealth, which nothing read.unresponsivecarries theroutethat went unanswered.TowerLiveness. A 200 with a malformed body isunresponsivefromprobeHealth, with no fallback, and a failure with neither flag fromgetLiveness().getLiveness(): it reportsunknownRoutefor an older Tower, with or without the key, andunansweredwhen nothing answered. On a 401 it asks the public/health: a healthy answer there means an older Tower. A refused Host header, the only 401 a current Tower gives this route, refuses/healthtoo.afx send's older-Tower check (Spec 1940) asksgetLiveness()instead of fetching the whole address book. The now-unusedcallerparameter ofexplainNotFoundis gone.checkTower, in send's retry line and inafx tower start. After a fallback against an older Tower they say/health.terminal-manager.probeTowerHealth) usesisRunning()(the liveness route) instead ofgetHealth().codev/resources/arch.md: the new route is in the Tower API table and the public-allowlist note.Key Decisions
/api/version./api/versionis already cheap, but every Tower since vscode + tower: detect installed-vs-running Tower version divergence; preflight needs an in-memory version probe, not justcodev --version#983 has it, v3.3.8 included. The send check has to tell "predates the three-part address form" from "knows it", and only a route newer than Spec 1940 can say that by being missing. Spec 1940 merged after the v3.3.8 tag, so it ships in the same release as this change./health/livegets 404 with the key and 401 without, because the route isn't on that Tower's public list. VS Code'stower-startercallsisRunning()with a key that can be missing. Without the 401 case, it would read an older Tower as unresponsive.tower < cliwould wrongly say "older" in that case.schemaVersionisGLOBAL_CURRENT_VERSION, the global.db schema this Tower's code migrates to at boot. It is a constant, so it costs nothing.Test Plan
air-1977-liveness-route.test.ts): a real HTTP server around the realhandleRequestand the real auth gate, and the real SDK client with no key.getInstances,listProcessCensus,getGlobalDb,computeRegisteredShellperPidsandisStartupReconcileSettledare spies. None of them is called for/health/live./healthon the same Tower does call them, which proves the spies are wired.tower-client.test.ts):probeHealthagainst the new route: running (one request, never/health), not-running, unresponsive on timeout and on 503, all without falling back./healthnames/health, and a refusal between the two requests reads as not-running.getLiveness: ok,unknownRouteon a 404,unknownRouteon a keyless 401 when/healthanswers, no flag when/healthalso refuses,unanswered, and any other status marked as neither.afx send(spec-1940-older-tower-send,bugfix-1901-send-unresponsive), updated to the new request sequence:isPublicRoute.probeHealthreads it as running through the fallback, keyed and keyless, andgetLiveness()givesunknownRoutekeyed and keyless.probeHealthmakes a single request./health/livetook 0.2–1 ms. The live Tower's/healthtook 350–460 ms per call (45 workspaces, 13 active, load ~5–8).npm run buildpasses. The full codev suite passes (460 files, 10,005 tests), as does the SDK suite (452 after the review fixes). Porch's build and test checks passed.tsc --noEmitand eslint pass, andterminal-managerandterminal-adaptertests pass (67).{status:'healthy'}, non-healthy status, empty version, unparseable startedAt, string or fractional schemaVersion, array, null. Each isunresponsivefromprobeHealth(naming the field, no fallback) and a flagless failure fromgetLiveness.suites=true) one3ed77c9b: green (unit tests, CLI tests, install verification,windows-latestandwindows-11-armprobes).e3ed77c9b. The first run failed the/tmpresidue check (Spec 1658) because the new route test had two fake paths containing/tmp. Nothing is written to them, so they now use/nonexistent/...; no allowlist entry was needed.Review Notes
mainbetween the Spec 1940 merge and this one knows the address form but lacks the route. On that Tower, a typo'd<ws>:architect:<name>gets "older Tower, restart" instead of the not-found. Restarting fixes it, and no released Tower is in that state./api/versiondoc comment had drifted aboveisLoopbackAddress. It is back onhandleVersion.db/tower-owner.tsstill probes/healthfor the startup ownership guard. It is notprobeHealth, and the issue scopes item 2 to the SDK probe. It could move to the route later; that needs the same fallback.doctorkeeps/healthforinsideCodevSession.connection-manager.connect()keepsgetHealth(). It runs once per connect attempt, with backoff, and logs the payload'suptime.Integration-review round
After the owner's ruling, one round of fixes from the integration reviews (
e3ed77c9b):arch.md'safx sendsection describesgetLiveness()on/health/live. It no longer mentions the address-book route or the oldfailedForAnOlderTowerhelper.server-utils.tsandarch.mdnames both kinds of public route: browser-navigation paths, and keyless SDK/CLI probes (/health,/health/live,/api/version).terminal-adaptercomments and test names say "liveness probe", not/health.CMAP
getLiveness()read only a 404 asunknownRoute, so a keyless client against an older Tower (401) got no flag. Fixed with the/healthconfirmation above and two tests, then re-measured against the live v3.3.8 Tower./healthside, so none of the negative assertions is vacuous.schemaVersionis documented as a constant of the running code, not a value read from the database.getLivenessandprobeHealthdisagreed about 401 is resolved by the codex fix.