Repository navigation
v1.93.30.0 fix(browse): browse starts when proxy creds come from BROWSE_PROXY_USER/PASS (#3457) - #3739
Merged
Conversation
…S are set (#3457) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
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 changed
With
BROWSE_PROXY_USER/BROWSE_PROXY_PASSset,browseused to fail to start its daemon. Now it starts, and setting credentials in both places is still refused.Before/after as text: browse with BROWSE_PROXY_USER/PASS: the daemon used to refuse its own merged creds and time out; now it starts
Why
#3457 reported that the daemon crashes when a proxy URL from the environment comes with
BROWSE_PROXY_USER/PASS, and the CLI only says "Server failed to start within 15s". It's broader than the issue says. The CLI copies those two variables into the proxy URL it hands the daemon, and the daemon also inherits the variables. So every documented way to pass proxy credentials throughBROWSE_PROXY_USER/PASS(with--proxy,BROWSE_PROXY_URLorHTTPS_PROXY) made the daemon see the credentials twice and refuse to start. Reproduced on main 3bfe566 through the real CLI. The daemon log is shown above.Blast radius
The change is limited to
proxyServerEnvinbrowse/src/cli.ts, the one helper that builds the daemon's proxy environment for a normal start, an auto-restart, a headedconnectwith its supervisor respawn, and the Windows launcher. On every one of those paths the extra environment is merged afterprocess.env, so the blank values win. The daemon'sparseProxyConfigtreats an empty value as unset (!!opts.envUser, proxy-config.ts:113), and the URL already carries the credentials becauseresolveProxywrites them there (proxy-config.ts:378-382). Evidence: the unit tests run that exact parse for all three spellings, and the end-to-end test drives a real daemon through a proxy that demands Basic auth. Security read: no new network calls, no new environment variables read, and no new place the credentials appear. The daemon now sees them once instead of twice.Approvals
Source: gstack-approvals record for gsta-217-browse-proxy-creds (display only; not an approval citation).
Summary
The daemon now reads the proxy credentials once, from the URL the CLI resolved. Whenever
proxyServerEnvpasses a resolvedBROWSE_PROXY_URL, it setsBROWSE_PROXY_USERandBROWSE_PROXY_PASSto empty for the daemon. The refusal for credentials set both in a URL and in the variables still runs in the CLI, on what the user actually set, before any daemon starts.The issue's open question, whether to stop refusing a path in a credential-free proxy URL such as
.../pac, is out of scope here. It's noted on #3457 as a follow-up.Test Coverage
Coverage: deterministic (the one changed runtime file has changed tests that name it).
browse/test/restart-env.test.ts: for--proxy,BROWSE_PROXY_URLandHTTPS_PROXYwithBROWSE_PROXY_USER/PASS, the restart and headed daemon environments go through the sameserverProxyEnv+parseProxyConfigstepsserver.tsuses, and yielda/bonce. Regression proof: all three fail at 3bfe566 with "pick one source" and pass after the fix. A control confirms that without a resolved proxy the variables are left alone.browse/test/proxy-env-daemon.test.ts: an end-to-end start withHTTP_PROXYandBROWSE_PROXY_USER/PASSagainst a local proxy that answers 407 until Chromium sends the Basic credentials. Regression proof: it fails at 3bfe566 (15 s start timeout) and passes after the fix (0.8 s).browse/test/cli-supervisor.test.ts: the expected headed respawn environment now includes the two blanked variables.Tests ran: browse 99
Tests ran: typecheck count unavailable
Pre-Landing Review
No issues found. One batched specialist pass (testing, security, state machines, red team), the native adversarial pass and a cross-family outside voice (openai/gpt-6.1-sol) all returned no findings.
REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen
Gate edits: none detected (GATE_SCAN tagged=0)
Outside review: clean (openai/gpt-6.1-sol)
Exploratory QA
These smoke probes ran through the real CLI on this branch, with a fresh state directory each time:
HTTPS_PROXY=http://127.0.0.1:1withBROWSE_PROXY_USER/PASS:Status: healthy, exit 0. On main the same command failed to start within 15 s.HTTPS_PROXYcarrying its own userinfo, plusBROWSE_PROXY_USER/PASS: refused in the CLI with "pick one source", exit 1, and no daemon was started.The
--proxyspelling was not run by hand. The unit test covers it.Design Review
No frontend files changed — design review skipped.
Eval Results
No prompt-related files changed — evals skipped.
Plan Completion
Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). The approved plan is in the Approvals row above.
Issues
Fixes #3457
Verification Results
Remote pregate: tree 70a8a2386f09, 4348 tests, 0 failed ($0.05). Windows Free Tests run 41231661423: success. The macOS named-regressions and cso-macos-launcher jobs in Free Tests run 41231658872: success.
TODOS
No TODO items completed in this PR.
Documentation
Status: current — no documentation changes needed.
Scope:
3bfe566..HEAD(browse/src/cli.tsproxyServerEnvblanksBROWSE_PROXY_USER/PASSin the daemon env when it passes a resolved proxy URL; tests; changelog fragment). No staged, unstaged or new files.Documentation health:
$Brefuses when both are set) still matches. The fix removes a false double-credential refusal inside the daemon and doesn't change the user-facing contract.Coverage debt: none. The fix adds no public surface. Diagram drift: none.
Test plan
bun test browse/test/restart-env.test.ts browse/test/proxy-env-daemon.test.ts browse/test/cli-supervisor.test.ts browse/test/proxy-env.test.ts browse/test/proxy-config.test.ts: 99 pass, 0 failbun run typecheck: cleangsta217): 4348 tests, 0 failed