Skip to content

fix(dashboard): report the bound port and accept --port 0 - #2526

Open
Amronos wants to merge 2 commits into
vercel-labs:mainfrom
Amronos:dashboard-port-zero
Open

Amronos wants to merge 2 commits into
vercel-labs:mainfrom
Amronos:dashboard-port-zero

Conversation

@Amronos

@Amronos Amronos commented Nov 10, 2026

Copy link
Copy Markdown

Problem

A script or tool that starts the dashboard needs to know which port it listens on and when it is ready. Today neither is reported:

  • dashboard start --port 0 is rejected, so a caller has to pick a free port itself and pass it in. Another process can take that port before the dashboard binds it.
  • dashboard start prints success and the requested port right after it spawns the background server, before the server binds. If the port is taken, the command still reports Dashboard started and exits 0, and the caller only finds out by polling the URL.

Changes

  • The background server prints the port it bound on stdout once its listeners are bound. dashboard start waits for that line before it writes dashboard.pid and dashboard.config and reports success.
  • --port 0 is accepted. The OS picks a free port and dashboard start reports the bound port, as data.port with --json. dashboard.config stores the bound port.
  • If the server exits before it binds, for example because the port is taken, dashboard start fails with Failed to start dashboard: the dashboard server exited before it started listening and cleans up its state files.
  • A repeated dashboard start --port 0 reuses a running dashboard on any port when the allowed origins match, and reports the running dashboard's port.
  • MCP agent_browser_dashboard_start accepts port: 0.
  • --help, the docs, and the core skill reference describe --port 0 and the reported port.
$ agent-browser dashboard start --port 0 --json
{"data":{"access_urls":[],"pid":41250,"port":53817},"success":true}

Tests

  • cli/tests/dashboard_cli.rs: a new test starts with --port 0, connects to the reported port without retrying, gets 200 OK from /api/sessions, then checks that a second --port 0 start reports already_running with the same port.
  • Unit tests for the parser and the running-config comparison now cover port 0, and --port 65536 replaces --port 0 as the invalid case.
  • pnpm --filter docs test, type-check, build and test:routes pass locally, with a docs-edits.json entry for the changed sentence on /commands.
  • On my fork's CI the new test passes on Linux and both macOS targets. The Windows job fails on the two session_settings unit tests that also fail on main, so it stops before the integration tests.

Written by Opus 5.5 (opus-5.5) through Sprocket.

Amronos and others added 2 commits November 10, 2026 12:45
`dashboard start` now waits for the server to bind before it reports
success, and prints the port it actually bound. This lets `--port 0`
pick a free port, and makes start fail instead of claiming success when
the port is taken.

Co-authored-by: usesprocket[bot] <306702232+usesprocket[bot]@users.noreply.github.com>
Co-authored-by: usesprocket[bot] <306702232+usesprocket[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

@Amronos is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant