Repository navigation
fix(cli): the ready banner prints API: and MCP: addresses only when an HTTP server is composed - #23741
Conversation
…er is composed With no `http.server` service registered (a `--no-server` boot whose config mounts no transport of its own), the banner printed `API:` and an MCP connect URL for a port nothing listened on. It now prints none of the address rows and one line saying no HTTP server is served, naming `--no-server` only when that flag is what left the boot without one. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLwgbTSmGMrqsXkBDsiwfG
The banner's two shapes (composed: the address rows as before; not composed: none of them and one line, naming --no-server only when that flag is the cause), every row that names no address unchanged between them, and resolveHttpServerComposition reading the kernel rather than the flag. Every existing banner pin now states httpServer: 'composed', the field being required. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLwgbTSmGMrqsXkBDsiwfG
Four boots of the built CLI: production --no-server and --dev --no-server print no address row and one line naming --no-server; a default boot still prints API: and MCP: (control); a config that mounts its own HonoServerPlugin under --no-server still prints API: (control: the read is off the kernel). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLwgbTSmGMrqsXkBDsiwfG
…re the budget; add the changeset The integration pin's matcher now anchors on the banner's own row, since the boot diagnostics carry plugins' "No HTTP server available" lines; the controls probe the port before the child is stopped; the file declares its measured budget. The changeset describes the banner's two shapes. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLwgbTSmGMrqsXkBDsiwfG
📓 Docs Drift CheckThis PR changes 1 package(s): 13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 28 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin bd7c34c0bd5f8cf60de86816d60795f4081fec2a && git checkout bd7c34c0bd5f8cf60de86816d60795f4081fec2a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3b46855fb97365902e1e81a6484cd41bd363e575 30b5c246e0f60f809411d5a5c821936775379321 && git checkout -B drift-repro 3b46855fb97365902e1e81a6484cd41bd363e575 && git merge --no-ff 30b5c246e0f60f809411d5a5c821936775379321
node scripts/docs-audit/affected-docs.mjs --json 3b46855fb97365902e1e81a6484cd41bd363e575
|
✅ ACCEPT: PR #23741 at
|
Fixes #23623
Clause-②: no
What this changes
os serve's ready banner printedAPI:and an MCP connect URL on every boot. That included--no-server, where no HTTP server is composed and nothing listens on the port. Triage's scope, verbatim: "Scope: the API and MCP lines appear only when an HTTP server is composed. Otherwise the banner says none is served, once. Pin both shapes."packages/cli/src/utils/format.ts. Adds a required field toServerReadyOptions:httpServer: HttpServerComposition, one of'composed' | 'skipped-by-no-server' | 'not-composed'.printServerReadyprints the address rows only for'composed'. The address rows areAPI:,Console:,MCP:with its connect hint, and the paths-only note. Otherwise it prints none of them, and one line:➜ No HTTP server: --no-server was given and no plugin composed one, so no API or MCP address is served. For'not-composed', the--no-server was given andclause is left out. The ready line and every row that names no address do not change.packages/cli/src/commands/serve.ts. AddsreadComposedHttpServer(kernel), which is thehttp.serverreadresolveBoundPortalready did, moved into its own function.resolveBoundPortand the newresolveHttpServerComposition(kernel, flags.server)both call it, and the banner thunk getshttpServerfrom it. The answer comes from the booted kernel, not fromflags.server. A config that mounts its ownHonoServerPluginunder--no-serverhas a registeredhttp.server, so its address rows still print.flags.serveronly decides whether the line names--no-server. Two comments said the banner'sAPI:row always names the bound address; they now say when it does.objectstack:listeningIPC message,runtime.ENV.PROJECT.json(publishBoundPort), flags, exit codes, exports andpackages/spec.utils/format.tsis not a published export of@objectstack/cli..changeset/23623-no-server-banner-urls.md. An@objectstack/clipatch describing the banner's two shapes.One departure from the dispatch's suggested route
The dispatch suggested an optional field whose default keeps today's output. This PR makes the field required instead. The defect is that a missing fact is read as "a server is listening". An optional field that defaults to
'composed'would bring that back for the next caller that leaves it out. The same interface already does this forexternalBaseOrigin: "Required on purpose: an absent field must not be able to meanhttp://localhost:PORTagain by omission." The cost is onehttpServer: 'composed'line in the base literal of 13 existing banner pins.tscnamed 11 of them; the other two cast withas ServerReadyOptionsand were found by reading. None of their assertions changed.Measured shapes
Each boot ran
node packages/cli/bin/run.js serve objectstack.config.ts --port PORT ARGSon the built CLI, spawned with an IPC channel.NODE_ENVwas unset except under--dev, andOS_CLOUD_URL=off. The fixture is a throwaway host config with one object and one plugin instance. Before is base9bb93706f; after is30b5c246e. The port probe is aGETsent right after the banner, before the child is stopped.--no-server --preset minimal(the card's command)API: http://localhost:PORT/,MCP: http://localhost:PORT/api/v1/mcpand the connect hint➜ No HTTP server: --no-server was given and no plugin composed one, so no API or MCP address is servedECONNREFUSEDon/,/api/v1/health,/api/v1/mcp--dev --no-serverAPI:,MCP:and the hintECONNREFUSEDon all threeOS_DATABASE_URLand an auth secret (control)API:,MCP:and the hint/302,/api/v1/health200,/api/v1/mcp401--no-server --preset minimalwith a config that mounts its ownHonoServerPlugin(control)API:,MCP:and the hint/404,/api/v1/health404,/api/v1/mcp404,/api/v1/data/fx_task401Tests
Everything below ran on
30b5c246e(HEAD), afterpnpm turbo run build --filter=@objectstack/cli(61 tasks, exit 0).src/utils/format.server-ready-no-http-server.test.ts(new, unit):skipped-by-no-serverwithmcpEnabled: true,uiEnabledandconsolePath: no address row, nohttp://anywhere, exactly one line, and it names--no-server;not-composed: one line, and it does not name--no-server;src/commands/serve-http-server-composition.test.ts(new, unit):http.serverregistered givescomposed, whatever the flag;--no-servergivesskipped-by-no-server;not-composed;resolveBoundPortasks for;http-serveralias registered givesnot-composed.src/commands/serve-no-server-banner.integration.test.ts(new).vitest-tiers.ts's predicate puts it in the integration tier. It boots the built CLI four times, once per shape in the table:--no-serverand--dev --no-server: noAPI:,Console:orMCP:row, no connect hint, and one line naming--no-server;MCP:row, and theAPI:port answers health with 200;API:port answers HTTP.It declares
// test-budget: 30: two local runs took 16.1 s and 16.5 s on a shared container, times 1.25, rounded up. It lives undersrc/because the dispatch's file surface ispackages/cli/src/**.src/cannot importtest/helpers/serve-process.ts, so its env strip and port probe are local, as insrc/commands/migrate/*.integration.test.ts.New and touched banner pins:
vitest runover the 17 files:Test Files 17 passed (17),Tests 202 passed (202).Unit layer:
pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 --shard=K/4, for K = 1 to 4. It is sharded because one unsharded run ran past the container's 10-minute foreground cap. Files: 75 + 74 + 74 + 74. Tests: 1369 + 1079 + 886 + 1043 = 4377, all passed.Integration, scoped. The diff adds an integration-tier file and edits
serve.ts; the rest of that tier is CI's. I ran the new pin plus four existing.integrationfiles:test/serve-no-storage-boot-guard,serve-host-config-metadata-door,serve-view-container-readandserve-migrate-exit-schema-parity. Result:Test Files 5 passed (5),Tests 22 passed (22).Typecheck:
pnpm --filter @objectstack/cli typecheck, exit 0 (tsc --noEmit, thencheck:test-typecheck: OK).--listFilesOnlycounts the three new files in thetscprogram.Ablation, run after the fix was committed, through
node scripts/ablation-replace.mjsin wrap mode (it restores on exit):API:row moved back aboveif (opts.httpServer === 'composed'), so it prints unconditionally again, with a marker comment. Anchor x1 to x0; blobbe095f8d3d42tof3a63ad76d42.node scripts/ablation-dist-preflight.mjs @objectstack/cli 'ablation-23623'found the marker in 1 built file.Tests 9 failed | 4 passed (13). All 7 no-server unit cases and both no-server boots failed withan address row printed; the composed cases and both boot controls passed.be095f8d3d42, which is HEAD;git diff HEADandgit status --porcelainboth empty. After a rebuild, preflight--absentfound the marker in none of the 636 built files, and the pins passed:Tests 13 passed (13).Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon30b5c246ederives 66 commands. Each exit code was recorded before any pipe, and all 66 exited 0.pnpm check:dual-build-cjs-loadsandpnpm check:i18n-coveragefirst exited 3 (PREREQUISITE NOT MET: packages outside the CLI's closure had nodist/); after those were built, both exited 0.--ranreports66 derived famil(ies) accounted for — 66 run, 0 NOT-MEASURED.pnpm exec eslint packages/cli --no-inline-configexited 0 with no output.--format jsonover the five changed code files reports 0 messages, and--print-configshows active rules for them. Repo-widepnpm lintis CI's.Acceptance notes
--no-serverboot were read, not changed. Theobjectstack:listeningIPC message is still sent as{ type: 'objectstack:listening', port: PORT, url: 'http://localhost:PORT' }, for a port nothing listens on.content/docs/deployment/cli.mdxdocuments that message as "The HTTP server is bound."runtime.env_local.PROJECT.jsonis written with the sameportandurl. The message's only in-repo consumer is theos devparent, and it never spawns a--no-serverchild (os devhas noserverflag). Reported to the seat in theos-dev-report.HonoServerPluginunder--no-server. Per the ruling, this shape printsAPI:andMCP:, and theAPI:row is pinned. Measured: theAPI:port answers (a REST data route returns 401), but/api/v1/mcpreturns 404, because the dispatcher that mounts it is composed only under--server. So in this shape theMCP:row names a route that is not mounted. It is not changed here, since the ruling keeps the row, and it is not pinned: the integration control checks only theAPI:row. Reported to the seat.--no-server --preset minimalexits on its own. Measured on both base and after, with and without an IPC channel: the banner's last line,Press Ctrl+C to stop, printed 3134 ms after spawn, and the process exited 0 at 3175 ms.--dev --no-server(default preset) stays up. That last line is outside this card's scope; reported to the seat.start.tssaysprintServerReady"prints theAPI:row always". That is still true foros start, which never passes--no-server, so it is left as is.Generated by Claude Code