Skip to content

Read an empty Bot PORT as unset, so NaN never reaches Bun.serve - #395

Open
Bartok9 wants to merge 1 commit into
CopilotKit:mainfrom
Bartok9:bartok/bot-empty-port-as-unset
Open

Read an empty Bot PORT as unset, so NaN never reaches Bun.serve#395
Bartok9 wants to merge 1 commit into
CopilotKit:mainfrom
Bartok9:bartok/bot-empty-port-as-unset

Conversation

@Bartok9

@Bartok9 Bartok9 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What this changes

PORT= on agent-bot / agent-langgraph used to parse as NaN and Bun.serve bound an ephemeral port while compose still published 4200/4201. Empty now means the shipped default; a non-digit value refuses to start. Same trap as supervisor #343.

Where it runs

  • New state that outlives a request? None.
  • What happens on the second replica? Each process reads its own PORT at boot. No shared state.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No. Existing listen ports only, parsed the same way as the supervisor.

Boundary and audit

  • Every acting call still goes through the gateway: resolve, decide, audit, then act.
  • New refusals and new failures each write a row. Boot refusal is process exit before serve; no new acting path.
  • Nothing new is trusted from the client that the server can resolve itself.

Changelog

  • A line in CHANGELOG.md under Unreleased.

Proof

Shared listenPort tests: empty/whitespace → fallback; digits in range accepted; 42o0 / 0 / 65536 refused.

agent-bot and agent-langgraph still used Number.parseInt(process.env.PORT ?? default).
Empty PORT= is not undefined, so parseInt yielded NaN and Bun.serve bound an ephemeral
port while compose published 4200/4201. Prefix typos started on the numeric prefix.
Same trap as supervisor CopilotKit#343.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant