Skip to content

Read an empty APP_PORT as unset, so NaN never reaches Vite - #430

Merged
davidmckayv merged 3 commits into
CopilotKit:mainfrom
Bartok9:bartok/app-empty-port-as-unset
Sep 8, 2026
Merged

Read an empty APP_PORT as unset, so NaN never reaches Vite#430
davidmckayv merged 3 commits into
CopilotKit:mainfrom
Bartok9:bartok/app-empty-port-as-unset

Conversation

@Bartok9

@Bartok9 Bartok9 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What this changes

Empty APP_PORT= / SERVER_PORT= (compose blank, leftover .env) used to become NaN for Vite, so the UI bound an ephemeral port and /api proxied to http://localhost:. Both now mean the documented defaults via listenPort; non-numeric values refuse to start.

Where it runs

  • New state that outlives a request? None.
  • What happens on the second replica? Each process still reads its own env; empty still means 3010/3001.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No. Same Vite ports, now parsed strictly.

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. N/A — process start, not a gateway call.
  • Nothing new is trusted from the client that the server can resolve itself.

Changelog

  • A line in CHANGELOG.md under Unreleased.

Proof

listenPort already covered empty/typo cases in shared/listen-port.test.ts. Added app/vite-listen-port.test.ts for the 3010/3001 fallbacks. Local bun was not on this nightly PATH; CI will run the suite.

Empty APP_PORT= and SERVER_PORT= in compose or a leftover .env used to
parse as NaN, so the UI bound an ephemeral port and the /api proxy targeted
http://localhost:. Same listenPort helper as the Bots.

@davidmckayv davidmckayv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep-reviewed against live code (correctness, governance, no vendor/secret/scale issues). Composed build+tests green. CHANGELOG/format rebase on CI-validated substance.

@davidmckayv
davidmckayv merged commit befd63f into CopilotKit:main Sep 8, 2026
14 checks passed
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.

2 participants