Repository navigation
fix(browser): apply gemini-web provider proxy and start Xvfb for headed zai-web (#15076) - #15851
Merged
diegosouzapw merged 2 commits intoOct 9, 2026
Merged
Conversation
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
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.
Refs #15076
Refs #15300
Root cause
GeminiWebExecutoropenedbrowser.newContext({ userAgent })without ever callingresolvePlaywrightProxy, so the proxy configured forgemini-webnever reached Chromium.-webimage has no X server and nothing sets DISPLAY, sochromium.launchdied with a barebrowserType.launch ... closed502 for every account.Fix
gemini-web.ts: resolve the provider proxy per context (resolvePlaywrightProxy("gemini-web")) and pass it tonewContextonly when one exists, so the shared leased browser needs no invalidation.open-sse/services/virtualDisplay.ts: on Linux with no DISPLAY/WAYLAND_DISPLAY, a headed launch starts one private Xvfb per process (spawn, args array, no shell,-displayfdpicks a free display), reuses it, and kills it inshutdownPool.browserPool.tspassesenv.DISPLAYto the headed launch. Hosts that already have a display are untouched.browserExecutableCheck.ts: newisMissingDisplay();zai-web.tsmaps it to an actionable 503 +X-Omni-Fallback-Hint: connection_cooldown(same class as [BUG] Z.ai web error #13232) instead of a bare 502.runner-web: installsxvfbexplicitly.webpack-create-require-warning.test.ts: added./virtualDisplay.tsto the isolated-compile externals (same reason as./obscura.ts); no assertion changed.Scope cuts (follow-ups)
For #15076 the plan-file also lists request-proxy-context resolution, edge-relay (vercel/deno/cloudflare) 503 rejection and SOCKS5-with-auth handling (from closed PR #15249). Not included here: this PR covers the provider/global registry proxy that the issue reports, reusing the existing
resolvePlaywrightProxyidiom.Tests (TDD)
tests/unit/issue-15076-gemini-web-proxy.test.tsRED on base:configured proxy never reached Playwright: {"launchOptions":[{"headless":true}],"contextOptions":[{"userAgent":...}]}-> GREEN.tests/unit/zai-web-headed-no-display-15300.test.tsRED on base:STATUS 502 ... browserType.launch: Target page, context or browser has been closed-> GREEN:STATUS 503 HINT connection_cooldown.tests/unit/virtual-display-15300.test.ts(fake spawn): no Xvfb when a display exists, single reused Xvfb, typed error when the binary is missing,isMissingDisplaymatching.zai-web-stream-error-boundaryfails identically on the unfixed base (504 !== 502), pre-existing.Gates
typecheck:core, check:open-sse-typecheck, eslint (with suppressions), prettier, check-file-size, check-complexity, check-cognitive-complexity: all OK.
Live check needed
The Docker
-webimage change (xvfb install + automatic Xvfb) needs a rebuild and a live zai-web request on the VPS; not verifiable in this sandbox (no Xvfb locally).