Skip to content

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

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

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

Conversation

@Bartok9

@Bartok9 Bartok9 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What this changes

The LangGraph and Mastra example Bots used Number.parseInt(process.env.PORT ?? default). An empty PORT= is "", not unset, so they bound an ephemeral port while docs still named 4300/4400. They now share listenPort with agent-bot (#395).

Where it runs

  • New state that outlives a request? None.
  • What happens on the second replica? Each process still reads its own PORT at boot. Empty → documented default; a prefix typo still refuses to start.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No. Same listen, same documented ports.

Boundary and audit

  • Gateway path unchanged.
  • No new refusals in the server audit trail (process exits at boot, same as agent-bot).
  • Nothing new trusted from the client.

Changelog

  • Unreleased: example LangGraph/Mastra Bots no longer bind an ephemeral port on empty PORT=.

Proof

shared/listen-port.test.ts already covers empty/prefix/range. Same helper, same defaults 4300/4400.

Same empty-string trap as agent-bot (CopilotKit#395): PORT= in compose used to bind an
ephemeral port while docs still named 4300/4400.
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