Read whole numbers from computer env, and keep the port in range - #501
Merged
davidmckayv merged 2 commits intoSep 12, 2026
Merged
Conversation
Ayush7614
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 12, 2026 12:16
# Conflicts: # CHANGELOG.md
davidmckayv
approved these changes
Sep 12, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Deep-reviewed clean (validation, no secret leak, fail-closed, agrees with existing layers). CI green.
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
Fixes #497. The computer's env reader accepted anything
Numbercalled finite and positive:PORT=80.5,NAVIGATION_TIMEOUT_MS=0.5,ACTION_TIMEOUT_MS=0.1,COMPUTER_MAX_BROWSERS=2.5,COMPUTER_BROWSER_IDLE_MS=0.5were all returned verbatim. A fractional port misbound at boot, a fractional timeout fired before any action could finish (surfacing as 502s reading as a broken computer), and a fractional cap reached eviction math.PORT=99999parsed fine and then misbound — a deployment failure instead of the documented fallback.numberFromEnvnow takes whole numbers on sight (trim +/^\\d+\$/+parseInt, the same rule as the supervisor'slistenPort), with optionalmin\)/maxfor settings with a range.PORTrides{ min: 1, max: 65535 }; timeouts and counts stay unbounded above, like before. Zero semantics unchanged:COMPUTER_BROWSER_IDLE_MS=0` still keeps browsers resident, and the empty-string-means-unset rule the function exists for is untouched.Where it runs
The computer process holding one Bot browser, at env read. Same fallback on every computer.
Postgres is already there and is the default answer to all of the above: nothing here needs it.
Boundary and audit
Bun.serve/Playwright/eviction math.Changelog
CHANGELOG.mdunderUnreleased: computer env validation entry.Proof
bun test agent-computer/tests/number-from-env.test.ts: 28 pass (11 pre-existing + 17 new: 6 fractional/sci/hex fallbacks, large-int passthrough, zero-off fraction, 4 in-range ports, 6 out-of-range/non-whole fallbacks).bun testinagent-computer: 306 pass, 15 skip, 0 fail across 21 files.bun run typecheckinagent-computer(afterbun install --frozen-lockfile, as CI does): clean.bunx biome format+bunx biome lint --error-on-warningson touched files: clean.