Skip to content

v1.93.30.0 fix(browse): browse starts when proxy creds come from BROWSE_PROXY_USER/PASS (#3457) - #3739

Merged
capy-ai[bot] merged 2 commits into
mainfrom
gsta-217-browse-proxy-creds
Nov 3, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
gsta-217-browse-proxy-creds

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3739,
  "head": "da1ef6e5d6c3a54aa8abc7768b0801c10dc98df8",
  "version": "1.91.378.0",
  "base": "main",
  "gate": {
    "browse": {
      "pass": 99,
      "fail": 0,
      "skip": 0
    },
    "typecheck": {
      "pass": 1,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "70a8a2386f096a1291478ae5913435eb220fcc93",
  "product_patch_id": "58abb8edce30a51a8f8eeacbdee09f3c221cb85f",
  "gstack_version": "1.91.378.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 6,
    "rules": "150435b0a543019a",
    "base": "2d1b55d7621df1a71e02037c79b63b7ee2fdc64f",
    "registry": "2d1b55d7621df1a71e02037c79b63b7ee2fdc64f",
    "gate_scan": {
      "tagged": 0,
      "head": "da1ef6e5d6c3a54aa8abc7768b0801c10dc98df8"
    },
    "reasons": [
      "runtime=6<=50"
    ]
  },
  "pregate": "requires-remote cleared @70a8a2386f09 (7 checks, current for da1ef6e5d6c3)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/41231658872",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41231658872",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41231661423",
    "pregate.json/remote_gate: remote-gate tree=70a8a2386f09 tests=4348 receipt=/home/user/.capy/work/gstack/ship-3457/remote-receipt.txt sha256=0cfecaaa7607"
  ],
  "issues": {
    "fixes": [
      3457
    ],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "BROWSER.md and docs/ (proxy credential policy)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen"
  }
}

What changed

browse with BROWSE_PROXY_USER/PASS: the daemon used to refuse its own merged creds and time out; now it starts

With BROWSE_PROXY_USER/BROWSE_PROXY_PASS set, browse used 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
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ HTTPS_PROXY=http://127.0.0.1:1 BROWSE_PROXY_USER=a BROWSE_PROXY_PASS=b browse status   # this branch da1ef6e
-$ HTTPS_PROXY=http://127.0.0.1:1 BROWSE_PROXY_USER=a BROWSE_PROXY_PASS=b browse status   # main 3bfe566
 [browse] Starting server with proxy http://***:***@127.0.0.1:1/ from HTTPS_PROXY...
+Status: healthy
+Mode: launched
+URL: about:blank
+Tabs: 1
+exit 0
+
+$ # HTTPS_PROXY carrying its own userinfo, plus BROWSE_PROXY_USER/PASS: two sources, still refused
+[browse] error: proxy creds set in both env (BROWSE_PROXY_USER) and URL — pick one source
-[browse] Server failed to start within 15s
 exit 1
-
-$ tail -1 browse-daemon.log
-[browse] error: proxy creds set in both env (BROWSE_PROXY_USER) and URL — pick one source (unset BROWSE_PROXY_USER/PASS or remove user:pass@ from HTTPS_PROXY)

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 through BROWSE_PROXY_USER/PASS (with --proxy, BROWSE_PROXY_URL or HTTPS_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 proxyServerEnv in browse/src/cli.ts, the one helper that builds the daemon's proxy environment for a normal start, an auto-restart, a headed connect with its supervisor respawn, and the Windows launcher. On every one of those paths the extra environment is merged after process.env, so the blank values win. The daemon's parseProxyConfig treats an empty value as unset (!!opts.envUser, proxy-config.ts:113), and the URL already carries the credentials because resolveProxy writes 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

Date Asked Exact words Outcome Covers Still pending
2026-10-31 One-round eng plan for #3457 (fix in proxyServerEnv with failing-first tests) and #3476; drop #2973 “Approved: build both PRs as planned (#3457 fix in proxyServerEnv with the three-spelling failing-first tests and the end-to-end case; #3476 one-line throw on error or non-zero status). Dropping #2973 with the measurement is right. Leave the path-refusal narrowing for credential-…” (GStack Minder (GSTA-36)) approved #3457 and #3476 fixes, #2973 drop none

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 proxyServerEnv passes a resolved BROWSE_PROXY_URL, it sets BROWSE_PROXY_USER and BROWSE_PROXY_PASS to 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_URL and HTTPS_PROXY with BROWSE_PROXY_USER/PASS, the restart and headed daemon environments go through the same serverProxyEnv + parseProxyConfig steps server.ts uses, and yield a/b once. 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 with HTTP_PROXY and BROWSE_PROXY_USER/PASS against 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:

  1. HTTPS_PROXY=http://127.0.0.1:1 with BROWSE_PROXY_USER/PASS: Status: healthy, exit 0. On main the same command failed to start within 15 s.
  2. HTTPS_PROXY carrying its own userinfo, plus BROWSE_PROXY_USER/PASS: refused in the CLI with "pick one source", exit 1, and no daemon was started.

The --proxy spelling 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.ts proxyServerEnv blanks BROWSE_PROXY_USER/PASS in the daemon env when it passes a resolved proxy URL; tests; changelog fragment). No staged, unstaged or new files.

Documentation health:

  • BROWSER.md — Current. The credential policy (URL or env vars, never both; $B refuses 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 fail
  • bun run typecheck: clean
  • Remote pregate (Ubicloud, gsta217): 4348 tests, 0 failed

…S are set (#3457)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions github-actions Bot changed the title fix(browse): browse starts when proxy creds come from BROWSE_PROXY_USER/PASS (#3457) v1.93.30.0 fix(browse): browse starts when proxy creds come from BROWSE_PROXY_USER/PASS (#3457) Nov 3, 2026
@capy-ai
capy-ai Bot merged commit 8319372 into main Nov 3, 2026
45 checks passed
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.

browse proxy: daemon crashes when an env proxy carries credentials beside BROWSE_PROXY_USER/PASS (#3448 widens it)

1 participant