Read an empty supervisor PORT as unset, so NaN never reaches Bun.serve - #343
Open
Bartok9 wants to merge 1 commit into
Open
Read an empty supervisor PORT as unset, so NaN never reaches Bun.serve#343Bartok9 wants to merge 1 commit into
Bartok9 wants to merge 1 commit into
Conversation
Empty PORT= used to parse to NaN and bind an ephemeral port while compose still published 4300. Treat blank as the default 4300; refuse non-numeric and out-of-range values instead of parseInt prefix traps.
Bartok9
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 2, 2026 23:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The supervisor read
Number.parseInt(process.env.PORT ?? "4300", 10).??only fires onundefined. An emptyPORT=from compose or a leftover.envline is"", so parse becameNaNandBun.serve({ port: NaN })bound an ephemeral port while compose still published 4300 — the same empty-string trap the API server fixed in #312/#340 and the computer saw in #96/#114. Prefix typos like30o0also started on port 30 viaparseInt.Empty/whitespace now means the default 4300. Non-numeric or out-of-range values refuse boot with a clear message. Parser lives in
supervisor/src/listen-port.tswith unit tests (no Docker).Where it runs
Boundary and audit
SUPERVISOR_TOKEN.Changelog
Unreleasedsection: empty supervisor PORT is unset, not an ephemeral bind.Proof
Node smoke of
listenPort(empty → 4300;4500→ 4500;30o0/0/65536refused). Addedsupervisor/tests/listen-port.test.tsfor bun test.