Skip to content

Authenticate the desktop bb CLI after a server move - #5486

Closed
timurkhakhalev wants to merge 1 commit into
get-bb:mainfrom
timurkhakhalev:bb/4243-fix-migrated-host-cli-authentication
Closed

timurkhakhalev wants to merge 1 commit into
get-bb:mainfrom
timurkhakhalev:bb/4243-fix-migrated-host-cli-authentication

Conversation

@timurkhakhalev

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

After a server move, the packaged launcher replaced the agent's authenticated proxy URL with the saved Connect URL, while the bundled CLI ignored authentication headers. The desktop command can also invoke the bundled CLI directly, bypassing the launcher; without connection environment variables it kept targeting the local default instead of the saved server. This continues #4277, which was closed without merge, and covers the additional desktop entry point reported in #4243.

What changed

  • CLI calls prefer a non-blank BB_SERVER_URL. Daemon and server launches retain saved-config precedence.
  • Both packaged and desktop bundled CLI resolve saved connections from the selected BB_DATA_DIR (default ~/.bb). Saved credentials are only applied when the selected URL matches the saved server; proxy/foreign overrides do not inherit them.
  • CLI HTTP/SDK transport binds private headers to the selected server origin, rejects credential-bearing redirects, and reports malformed private headers without their values. Anonymous requests keep normal redirect behavior.
  • Updated configuration docs, the machine guide, the bb-cli skill and SDK behavior notes. No server/daemon wire change or protocol bump.

The original #4277 patch is retained with its authorship. The desktop resolver and credential protections extend that patch.

How you verified

  • Saved-connection and redirect regressions fail on the original Route agent bb calls through the machine proxy after a server move #4277 patch and pass with these changes.
  • Turbo test for @bb/config, @bb/cli and bb-app: final CLI suite 874 passed, config 112 passed, bb-app 222 passed. Two existing tests are skipped.
  • Turbo typecheck/lint for bb-app, @bb/cli, @bb/config, @bb/sdk and @bb/templates: passes; affected checks rerun after review fixes.
  • pnpm exec turbo run build:host --filter=bb-app --concurrency=2 --output-logs=errors-only: passes.
  • Actual built raw CLI and launcher, isolated temporary HOME, disposable local HTTP servers and fictional credentials: ordinary-terminal authentication, proxy precedence without inherited credentials, foreign-server isolation, redirect rejection, unchanged local defaults, and no credential output all pass.
  • Four packaged malformed-header cases (saved/environment, invalid value/name): sanitized stderr and JSON output, zero network requests.
  • Independent review found two defects; both were fixed, and the second full-branch review found no remaining actionable findings. The reviewer independently repeated both packaged smoke checks.

Live Connect migration and real Windows execution were not tested. Installed applications and production services were not modified.

Fixes #4243

Continues #4277 and addresses the reproduction and transport review recorded in those discussions.

AGENT GENERATED

Prefer the daemon-provided proxy for agent CLI calls, and resolve saved
connections for ordinary terminals using either packaged CLI entry point.
Keep daemon/server URL precedence unchanged.

Bind saved machine headers to the selected server, drop inherited headers
for proxy/foreign overrides, reject authenticated redirects, and redact
invalid private headers. Add regression coverage and update the guides.

Fixes get-bb#4243
Continues get-bb#4277.

Co-authored-by: Sawyer Hood <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot closed this Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This is an automated message. We have closed this pull request because it has been open for more than two weeks.

@timurkhakhalev

Copy link
Copy Markdown
Contributor Author

@SawyerHood hey! could you please merge this?

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.

Agents on a host whose server moved to bb Connect get HTTP 401 from bb: launcher prefers config.json serverUrl over BB_SERVER_URL

1 participant