Skip to content

fix: apply --port/--host overrides before workspace registration#64

Merged
mantoni merged 1 commit intomantoni:mainfrom
AstroMined:fix/workspace-registration-port
Mar 11, 2026
Merged

fix: apply --port/--host overrides before workspace registration#64
mantoni merged 1 commit intomantoni:mainfrom
AstroMined:fix/workspace-registration-port

Conversation

@AstroMined
Copy link
Copy Markdown
Contributor

@AstroMined AstroMined commented Mar 10, 2026

Summary

  • When bdui start --port <N> is called while the server is already running, the --port and --host CLI options were applied to process.env after the "already running" early-return branch
  • getConfig() read the unset env vars and defaulted to port 3000, so the workspace registration POST went to the wrong port and silently failed
  • Moved the env var assignments before readPidFile() so getConfig() reflects CLI overrides in all code paths
  • Added a unit test covering custom-port registration and made the getConfig mock dynamic to catch regressions

Test plan

  • npx vitest run server/cli/commands.unit.test.js - all 9 tests pass (including new custom-port test)
  • npx vitest run server/ - all 130 server tests pass
  • Manual: start bdui start --port 3030 in repo A, then bdui start --port 3030 in repo B - confirmed "Workspace registered" message and workspace appears in picker dropdownter the "already running" early-return branch. This caused getConfig() to default to port 3000, sending the workspace registration POST to the wrong port. The registration silently failed and the new workspace never appeared in the picker dropdown.

When the server is already running and `bdui start --port <N>` is
called from a second repo, the port/host env vars were set after the
"already running" early-return branch. This caused getConfig() to
default to port 3000, sending the workspace registration POST to the
wrong port. The registration silently failed and the new workspace
never appeared in the picker dropdown.

Move the env var assignments before readPidFile() so getConfig()
reflects CLI overrides in all code paths.
@mantoni mantoni merged commit b354aa6 into mantoni:main Mar 11, 2026
2 checks passed
@mantoni
Copy link
Copy Markdown
Owner

mantoni commented Mar 11, 2026

Thank you! Released in v0.11.2.

@AstroMined AstroMined deleted the fix/workspace-registration-port branch March 23, 2026 21:15
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