feat(appkit): scan upward from preferred port in development#349
Merged
MarioCadenas merged 2 commits intomainfrom May 6, 2026
Merged
feat(appkit): scan upward from preferred port in development#349MarioCadenas merged 2 commits intomainfrom
MarioCadenas merged 2 commits intomainfrom
Conversation
When NODE_ENV is development, the server plugin now picks the first
available TCP port starting from the preferred port (server({ port }),
DATABRICKS_APP_PORT, or default 8000) and scanning upward using
get-port's portNumbers() helper (bounded to 100 ports). This avoids
EADDRINUSE failures when running multiple AppKit dev servers locally.
Production / non-development behavior is unchanged: the plugin binds
the configured/env/default port and surfaces listen errors as before.
Logging now reflects the actually bound port on the existing
"Server running on http://..." line; no extra fallback line is emitted.
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
atilafassina
approved these changes
May 6, 2026
Address review feedback on #349: when the preferred dev listen port is busy and the server binds a different port from the scan range, emit a single info log "Port {requested} was busy, picking {bound}". Silent when the preferred port was free. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
MarioCadenas
added a commit
that referenced
this pull request
May 7, 2026
Biome import collapsing on agent loader, run-agent, and tests after rebasing onto main. Lockfile and synced plugin manifest reflect the current main state (including get-port from #349 already on main). Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
MarioCadenas
added a commit
that referenced
this pull request
May 7, 2026
Biome import collapsing on agent loader, run-agent, and tests after rebasing onto main. Lockfile and synced plugin manifest reflect the current main state (including get-port from #349 already on main). Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
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.
Summary
NODE_ENV=development, the server plugin now picks the first free TCP port by scanning upward from the preferred port (server({ port }),DATABRICKS_APP_PORT, or default8000) usingget-port'sportNumbers(from, to)helper, bounded to 100 attempts.EADDRINUSEfailures when running multiple AppKit dev servers locally (e.g. two playgrounds at once).listenerrors surface as before.Server running on http://…line; no extra fallback log is emitted.Implementation
ServerPlugin.resolveListenPort()returns:await getPort({ host, port: portNumbers(requested, requested + 99) }).start()awaits the resolved port beforeapp.listen(...).logStartupInfo()reads the resolved port so logs match the actual socket.get-port@7.2.0to@databricks/appkitdependencies.Test plan
pnpm --filter @databricks/appkit typecheckpnpm exec vitest run packages/appkit/src/plugins/server/tests/server.test.ts packages/appkit/src/plugins/server/tests/server.integration.test.ts(37 tests pass; new dev/prod cases cover the resolution branches via a partialget-portmock)pnpm exec biome check --writeon touched files8001(or next free port) and the URL line reflects it