Skip to content

fix(runtime): mount GET /ready so the readiness probe is reachable over HTTP - #2227

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/ready-route-registration
Jun 23, 2026
Merged

fix(runtime): mount GET /ready so the readiness probe is reachable over HTTP#2227
xuyushun441-sys merged 1 commit into
mainfrom
fix/ready-route-registration

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

Seam #2 (PR #2217) added a GET /ready readiness handler inside the dispatcher's dispatch() (next to /health) plus a passing unit test. But in a real running server/ready returned 404 ({"error":"Not found"}) and was unreachable, while /api/v1/health returned 200.

Root cause: the dispatcher mounts routes on the HTTP server explicitly — there is no catch-all. ${prefix}/health is registered in dispatcher-plugin.ts; ${prefix}/ready never was. So GET /api/v1/ready matched no route and fell through to HonoServerPlugin's notFound handler before reaching dispatch(). This is the exact class of bug that shipped /mcp and /keys broken — the unit test passed because it called dispatch() directly.

Fix

Mount ${prefix}/ready next to ${prefix}/health, routing to dispatch('GET', '/ready', …). The 200 (running) / 503 (booting or draining) handler logic was already correct and is untouched. This is the contract the EE multi-node rolling-restart drain gate polls (cloud ADR-0018) so a load balancer stops routing to a replica before it closes.

Tests

  • dispatcher-plugin.routes.test.ts — assert both /health and /ready are mounted (registration-level guard that would have caught this gap).
  • dispatcher-plugin.ready.integration.test.ts (new) — boot a real HonoServerPlugin + dispatcher on a socket and use fetch (not dispatch()):
    • /api/v1/ready → 200 {state:"running"}
    • /api/v1/ready → 503 while draining (kernel.getState()stopping)
    • a bogus path → the prod {"error":"Not found"} 404, proving the harness reproduces the pre-fix failure (not a vacuous pass)
    • adds a test-only devDependency on @objectstack/plugin-hono-server (no cycle; not in the build/publish graph).

Verification

  • pnpm --filter @objectstack/runtime build → strict DTS success
  • Full runtime suite → 29 files / 420 tests pass
  • CLI boot + curl: /api/v1/ready 404 → 200{"success":true,"data":{"status":"ready","state":"running"}}

🤖 Generated with Claude Code

…er HTTP
Seam #2 added the dispatcher's `/ready` handler (200 running / 503 booting or
draining) but never mounted a route for it. The dispatcher mounts routes
EXPLICITLY (no catch-all), so `GET /api/v1/ready` matched nothing and returned
the Hono not-found 404 before reaching dispatch() — the exact failure mode that
shipped `/mcp` and `/keys` broken, hidden because the unit test called
dispatch() directly.
Mount `${prefix}/ready` next to `${prefix}/health`. This is the contract the EE
multi-node rolling-restart drain gate polls (cloud ADR-0018) so a load balancer
stops routing to a replica before it closes.
Tests:
- dispatcher-plugin.routes.test.ts: assert both /health and /ready are mounted
(registration-level guard that would have caught this).
- dispatcher-plugin.ready.integration.test.ts (new): boot a real HonoServerPlugin
+ dispatcher on a socket, fetch /ready -> 200 (running) and 503 (draining via
getState), and confirm a bogus path returns the prod {"error":"Not found"} 404
so the test reproduces the pre-fix failure rather than passing vacuously.
Adds a test-only devDependency on @objectstack/plugin-hono-server.
Verified: pnpm --filter @objectstack/runtime build (strict DTS), full runtime
suite (420 tests), and a CLI boot+curl (/api/v1/ready 404 -> 200).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 23, 2026 2:03am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file tests tooling size/m labels Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime.

17 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/cloud-artifact-api.mdx(via packages/runtime)
  • content/docs/concepts/implementation-status.mdx(via @objectstack/runtime)
  • content/docs/concepts/north-star.mdx(via packages/runtime)
  • content/docs/concepts/packages.mdx(via @objectstack/runtime)
  • content/docs/guides/api-reference.mdx(via @objectstack/runtime)
  • content/docs/guides/authentication.mdx(via @objectstack/runtime)
  • content/docs/guides/cloud-deployment.mdx(via @objectstack/runtime)
  • content/docs/guides/deployment-vercel.mdx(via @objectstack/runtime)
  • content/docs/guides/driver-configuration.mdx(via @objectstack/runtime)
  • content/docs/guides/hook-bodies.mdx(via @objectstack/runtime)
  • content/docs/guides/packages.mdx(via @objectstack/runtime)
  • content/docs/guides/plugin-chatbot-integration.mdx(via @objectstack/runtime)
  • content/docs/guides/production-readiness.mdx(via @objectstack/runtime)
  • content/docs/guides/single-project-mode.mdx(via @objectstack/runtime)
  • content/docs/protocol/objectos/http-protocol.mdx(via @objectstack/runtime)
  • content/docs/protocol/objectos/index.mdx(via @objectstack/runtime)
  • content/docs/protocol/objectos/lifecycle.mdx(via @objectstack/runtime)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@xuyushun441-sys
xuyushun441-sys merged commit 8cf4f7c into mainJun 23, 2026
17 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/ready-route-registration branch June 23, 2026 02:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependenciesPull requests that update a dependency filedocumentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xuyushun441-sys@os-zhuang