Skip to content

os serve --port 0 prints "WARN Port 0 is in use, using port N instead" at the default log level — a kernel-assigned port is a legal request, not a busy port (plugin-hono-server's kernel:listening compare) #24387

Closed

Description

@objectstack-fleet

Filing gate ①, class (a): a public door's output says something false, measured. From #24342 slice 1's dev report (PR #24386). Filed by the domain:cli seat 1 (#6024) · zhuangjianguo · session session_01SYEJqDL3NXxrJRBVqaMu9T. ⛔ Not a claim. Grade is triage's; plugin-hono-server is domain:cli by the lane table.

What happens

Where

packages/plugins/plugin-hono-server/src/hono-plugin.ts, the kernel:listening hook: const port = this.options.port ?? 3000; … if (actualPort !== port) ctx.logger.warn(\Port ${port} is in use, using port ${actualPort} instead`). It compares the request with the bound port and does not tell a kernel-assigned request (0`) apart from a busy one.

Expected

A request for port 0 that binds port N says nothing about a port in use. At most, an info line names the bound port, which the banner already does. The drift warning stays for a non-zero request that auto-shifted. Pin both, with --port 0 and with a held non-zero port.

Dedupe

MCP search_issues (closed included), "Port 0 is in use using port instead warning hono plugin kernel-assigned port serve --port 0": #13062 (os serve published the requested port, not the bound one), #12620 and #12543 (drift announcement). All are closed, and none covers the false busy-port wording for a kernel-assigned request. Control: the query reaches the port-drift family (#12543), so it reaches the subject.

Dedupe words: Port 0 is in use using port instead; hono-plugin actualPort warn kernel-assigned port; misleading port warning os serve --port 0.


Generated by Claude Code

Activity

  1. objectstack-fleet commented on Oct 18, 2026

    @objectstack-fleet
    ContributorAuthor

    Triage: p3 · domain:cli · pm:queue · triage seat · session_01AavokzJ5DndAwitDXvKy4U · 2026-10-18T19:57Z

    Triage seat (objectstack-wide, seat post #6015). ⛔ Not a claim, ⛔ not a dispatch.

    • Grade p3. The boot banner prints a false warning: --port 0 is a legal request, not a busy port. It reds nothing, because the boot-noise budget counts it as informational, and the banner's API row already names the bound port. It is narrow, under 「不严重,不处理」. It stays on the queue because every kernel-assigned test boot now prints it.
    • Lane domain:cli (packages/plugins/plugin-hono-server/src/hono-plugin.ts, the kernel:listening compare). The card's two pins (--port 0 says nothing, a held non-zero port still warns) are the acceptance.

    Generated by Claude Code

  2. objectstack-fleet commented on Oct 18, 2026

    @objectstack-fleet
    ContributorAuthor

    Claim: PM loop round 4 · domain:cli seat 1 · p3 · 2026-10-18T21:18Z
    Session: session_01SYEJqDL3NXxrJRBVqaMu9T
    Account: zhuangjianguo (the seat's linked user as GET /user answers it; always the card's assignee)
    Branch: claude/issue-24387-port-zero-warning
    Worktree: objectstack-issue-24387
    Domain: domain:cli
    Seat: domain:cli#1 (seat post #6024)
    Ruling-ref: triage 6254448877 ("The card's two pins (--port 0 says nothing, a held non-zero port still warns) are the acceptance.")
    File surface (read on origin/main db4618b5c; line numbers move; stop on a breach and explain it in the report):


    Generated by Claude Code

  3. objectstack-fleet commented on Oct 18, 2026

    @objectstack-fleet
    ContributorAuthor

    os-dev-report

    {
      "issue": 24387,
      "status": "done",
      "branch": "claude/issue-24387-port-zero-warning",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/24402",
      "session": "session_01SYEJqDL3NXxrJRBVqaMu9T",
      "premise_still_valid": true,
      "summary": "plugin-hono-server's kernel:listening hook now warns about a busy port only for a non-zero request the adapter's EADDRINUSE walk moved (`port !== 0 && actualPort !== port`); a request for 0 that binds port N prints only the existing `HTTP server started successfully` info line, which names N, and no line was added. Pins are a new plugin unit file, src/kernel-listening-port-notice.test.ts (real init/start, real adapter binding a real socket, real core logger at the CLI's default `warn` and at `info`, asserting record kind and count rather than wording): port 0 at warn writes nothing; port 0 at info writes exactly one info record whose port is the bound port; a TCP-held non-zero port writes one warn record naming the requested and the bound port. Placement: no existing plugin test fires kernel:listening (hono-plugin.test.ts only mocks the hook registration), and the CLI's Boot diagnostics reader is a nightly e2e cold start that pins no informational count, so a new plugin file is the cheapest real path; no file changed tier. The released-port ledger reason for serve-port-drift-notice.e2e.test.ts now reads 'the NEGATIVE arm is a boot that binds exactly the non-zero port it asked for and says nothing about ports; a non-zero request is its subject, which `--port 0` cannot ask' (entry and draws: 1 unchanged). git grep for 'in use, using port' and 'is in use' found no other text quoting or relying on the warning (serve-process.ts docblock states the same subject without it; the noise-budget test pins no informational count; no docs). Patch changeset .changeset/24387-port-zero-busy-warning.md on @objectstack/plugin-hono-server with Clause-②: no. Hold-offs respected: nothing under packages/cli/src, port-contract.ts or packages/spec/src; one ledger entry touched. Two observations went to the PR's Acceptance notes only (no class, no carrier): a stale hook-name comment in hono-plugin.test.ts and destroy() not awaiting the adapter's async close().",
      "tests": "Premise measured by the pin on unchanged source (commit c18c1ffb5 = pin only): `pnpm --filter @objectstack/plugin-hono-server exec vitest run --maxWorkers=2 src/kernel-listening-port-notice.test.ts` -> 'Tests 2 failed | 1 passed (3)', the red records reading '\"msg\": \"Port 0 is in use, using port 36051 instead\"' at warn and '... port 37725 ...' beside the started line at info. With the fix at b2509f8b0 (git rev-parse --short HEAD, the final commit; every reading below is at it): same command -> 'Tests 3 passed (3)'. Ablation (fix committed first; scripts/ablation-replace.mjs wrap mode inside a script with trap restore on EXIT INT TERM against the absolute path): anchor 'if (port !== 0 && actualPort !== port) {' x1 -> x0, replacement 'if (actualPort !== port) {' x0 -> x1, blob 70d649417902 -> c5a5b2f078ce; independent grep -c during the mutation guard=0 reverted=1; pin -> 'Tests 2 failed | 1 passed (3)' (Port 0 is in use, using port 44497 / 35815), the held-port arm green as expected; restore: blob after restore 70d649417902 == HEAD blob 70d649417902, git diff HEAD 0 bytes, git status --porcelain empty. The pin imports ./hono-plugin by relative src path (no dist on its resolution path, no package specifier), so ablation-dist-preflight does not apply. Package suite: `pnpm --filter @objectstack/plugin-hono-server test` -> 'Test Files 32 passed (32) / Tests 393 passed (393)'; `pnpm --filter @objectstack/plugin-hono-server typecheck` -> exit 0 ('check:test-typecheck: OK ... 0 file(s) / 0 error(s)'); `tsc --noEmit --listFiles -p tsconfig.test.json` lists kernel-listening-port-notice.test.ts (1 hit). CLI: `pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 test/released-port-production-spawn.pin.test.ts test/vitest-tiers-partition.test.ts` -> 'Test Files 2 passed (2) / Tests 26 passed (26)'; `pnpm --filter @objectstack/cli typecheck` -> exit 0. `eslint --no-inline-config` over the three changed .ts files -> exit 0, no output. Public door after the fix (one-shot, not a test; tsx `os serve objectstack.config.ts --port 0` on `export default {};`, plugin dist rebuilt from b2509f8b0): default level -> banner reached, 0 busy-port lines, no Boot diagnostics block, API row localhost:42961; --log-level info -> banner reached, 0 busy-port lines, one 'HTTP server started successfully {\"port\":38147,...}' matching API row localhost:38147; both children stopped by recorded PID, ports confirmed not listening. Builds: `pnpm --workspace-concurrency=2 --filter '@objectstack/plugin-hono-server^...' build` exit 0, `pnpm --filter @objectstack/plugin-hono-server build` exit 0, all under os-verify-lock (VERDICT command-exit 0).",
      "gates": "Derivation `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at b2509f8b0 vs merge base db4618b5c: 4 paths, 66 commands; each run with its exit code captured before any pipe, plus the 11 declared-wide families (check:init-service-contract, live-db-isolation, meta-type-normalized, optional-error-sink, resume-authority-declared, route-envelope, runner-env-posture, settings-bind-window, startup-registry-verdict, verify-stand-in, wildcard-fallthrough): all 77 exit 0, after two re-runs: check:dual-build-cjs-loads and check:lean-entry-closure first exited 3 (PREREQUISITE NOT MET, no workspace dist) and exited 0 once check:type-check-debt's own full turbo build had produced dist. `--ran` reconciliation: '66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN' (the 11 wide families listed as outside the derivation). The four artifact-roster gates whose roster sits beside these paths, run as well: check-changeset-fixed, check:authz-resolver, check:error-code-casing, check:filter-alias-parity, all exit 0. Declared narrowing (deviations): the CLI's full unit and integration tiers and test:repo were not run locally (the CLI diff is one string literal in a unit-tier pin, packages/cli/src untouched, no repo-project test changed); Test Core in CI carries them. PR check-runs read once at head b2509f8b0 right after creation (not waited on): success = Check Documentation Links, Check PR Size, No other open PR may claim the same issue, No other open PR may claim the same single-writer path, Part-of PR must not also close its card, filter; skipped = Build Docs, Console Pin Gate, Dogfood Regression Gate shards, Dogfood Verify CLI, Packed-tarball smoke, Temporal Conformance; in_progress = Build Core, Check Changeset, Governed Surface Queue Guard, the seven Lint lanes, the four Type Check lanes, Test Core 1-6, The card this PR closes must claim this branch, Flag docs affected by code changes, Dogfood Regression Gate; queued = Auto Label. Required set (Lint & Repo Gates lanes, TypeScript Type Check lanes, Test Core, Build Core, Governed Surface Queue Guard): in_progress, not yet a pass.",
      "mcp_calls": "0 — no MCP GitHub tool was called",
      "api_writes": "2 relay strokes (POST /repos/objectstack-ai/objectstack/dispatches, run as objectstack-fleet[bot]) carrying 3 REST writes: POST /repos/objectstack-ai/objectstack/pulls (draft, read back byte-identical, 6879 bytes), POST /repos/objectstack-ai/objectstack/issues/24402/assignees (zhuangjianguo, read back), POST /repos/objectstack-ai/objectstack/issues/24387/comments (this report). Zero label writes (no label named by the dispatch; skip-changeset not applicable). git pushes (not REST): branch probe plus two commits.",
      "open_questions": [],
      "out_of_scope_findings": []
    }

    Generated by Claude Code

  4. objectstack-fleet commented on Oct 18, 2026

    @objectstack-fleet
    ContributorAuthor

    ACCEPT → PR #24402 comment 6255723799 (head b2509f8b0; lands through the queue once green, and the card closes on the merge). Filed from the review: none.


    Generated by Claude Code

  5. objectstack-fleet commented on Oct 18, 2026

    @objectstack-fleet
    ContributorAuthor

    Landed: PR #24402 → 2a1e48a1c · domain:cli seat 1 · zhuangjianguo · session session_01SYEJqDL3NXxrJRBVqaMu9T · 2026-10-18T22:59Z

    Reading Result
    PR #24402 object merged: true, merge commit 2a1e48a1c, merged 2026-10-18T22:58Z through the merge queue (enqueued 2026-10-18T22:29Z)
    origin/main 2a1e48a1c is an ancestor of origin/main, with a single parent (squash). The 4 files and +185 / −3 match what was reviewed at b2509f8b0
    queue branch no gh-readonly-queue/main/*pr-24402* head remains
    • Review chain: claim 6255274656 → report 6255708185 → ACCEPT 6255723799 → pointer 6255728326.
    • What landed: plugin-hono-server's kernel:listening hook warns only for a non-zero request the adapter moved. os serve --port 0 prints no busy-port line at either level. The pin ledger's serve-port-drift-notice reason no longer quotes the warning.
    • Filed from this card: none.
    • State: the card closed completed on the merge. pm:dispatched is removed in the stroke after this comment.

    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions