name: webai-issue-body
description: Markdown body for GitHub issue about Playwright 3.5-flash timeout bug
type: text/markdown
Summary
Playwright backend chat requests against playwright/gemini/gemini-3.5-flash, playwright/gemini/gemini-3.1-pro, and playwright/gemini/gemini-3.1-flash-lite consistently return HTTP 504 "Request timed out" after roughly 17 seconds, even though /v1/auth/status reports playwright: VALID_SESSION and BrowserEngine: Initializing Browser... is logged. The webapi backend (gemini-3-flash, gemini-3-pro, gemini-3-flash-thinking, …) works flawlessly.
Environment
- WebAI-to-API: commit
f81aa12 (master, 2026-06-23)
- Server:
python src/run.py --host 127.0.0.1 --port 6969
- Python: 3.11.9 on Windows 11
- Auth: browser login via
verify_login.py, persisted to runtime/auth/gemini.json
- Auth status:
gemini_webapi: AUTHENTICATED (auth_source: gemini.json canonical store)
playwright: VALID_SESSION (auth_state_file: runtime/auth\gemini.json)
Steps to reproduce
python src/run.py --host 127.0.0.1 --port 6969
- Send a chat completion request using any Playwright-prefixed model:
curl -X POST http://127.0.0.1:6969/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer test" \
-d '{"model":"playwright/gemini/gemini-3.5-flash","messages":[{"role":"user","content":"hi"}],"max_tokens":50}'
- Observe the server logs.
Actual behavior
- Server returns HTTP 504 with body
{"detail":"Request timed out."} after ~17 seconds.
- Server log shows:
AuthSelector: Source selected: gemini.json canonical store
BrowserEngine: Initializing Browser...
BrowserEngine: New generation active.
ProviderSession(gemini): Closing session resources... <-- immediately closes
ProviderSession(gemini): All tabs purged from registry
ProviderSession(gemini): Session resources closed successfully.
AuthSelector: Source selected: gemini.json canonical store
AuthSelector: Using candidate for Playwright storage: gemini.json canonical store
INFO - provider_session_initialized
-- then nothing for ~17s, then 504 --
process_total_request_timeout is set to 120 in config.conf, so the 17-second cutoff is NOT coming from total_request_timeout. It appears to come from ui_wait_timeout = 15000 (15s) or the FastAPI/uvicorn middleware.
Expected behavior
Playwright chat requests should complete in 10-45 seconds and return a valid chat.completion JSON, like the webapi backend does.
Notes
Suggested next steps
- Increase
ui_wait_timeout to 30000+ to rule out race conditions during UI discovery.
- Add verbose logging around the model picker selection step so we can see which selector matched (or none).
- Run
tools/audit_ui.py against the current production gemini.google.com to refresh MODEL_PICKER_FALLBACK_SELECTORS.
name: webai-issue-body
description: Markdown body for GitHub issue about Playwright 3.5-flash timeout bug
type: text/markdown
Summary
Playwright backend chat requests against
playwright/gemini/gemini-3.5-flash,playwright/gemini/gemini-3.1-pro, andplaywright/gemini/gemini-3.1-flash-liteconsistently return HTTP 504 "Request timed out" after roughly 17 seconds, even though/v1/auth/statusreportsplaywright: VALID_SESSIONandBrowserEngine: Initializing Browser...is logged. The webapi backend (gemini-3-flash,gemini-3-pro,gemini-3-flash-thinking, …) works flawlessly.Environment
f81aa12(master, 2026-06-23)python src/run.py --host 127.0.0.1 --port 6969verify_login.py, persisted toruntime/auth/gemini.jsonSteps to reproduce
python src/run.py --host 127.0.0.1 --port 6969Actual behavior
{"detail":"Request timed out."}after ~17 seconds.process_total_request_timeoutis set to120inconfig.conf, so the 17-second cutoff is NOT coming fromtotal_request_timeout. It appears to come fromui_wait_timeout = 15000(15s) or the FastAPI/uvicorn middleware.Expected behavior
Playwright chat requests should complete in 10-45 seconds and return a valid
chat.completionJSON, like the webapi backend does.Notes
/v1/modelsendpoint correctly advertisesplaywright/gemini/gemini-3.5-flash,playwright/gemini/gemini-3.1-pro, andplaywright/gemini/gemini-3.1-flash-lite(added by PR Harden and synchronize Gemini Playwright model selection and discovery #93).src/app/services/browser/adapters/scripts/gemini_scripts.pyhasMODEL_PICKER_FALLBACK_SELECTORSpopulated (PR Harden and synchronize Gemini Playwright model selection and discovery #93) andui_wait_timeoutis documented (PR Refactor configuration routing and fix Playwright interaction timeout #85).gemini-3.5-flashandgemini-3.1-proexist in the UI's model picker — but Playwright'sMODEL_PICKER_FALLBACK_SELECTORS(button[aria-label*="Open mode picker"],button[aria-label*="Select model"], etc.) may not match the current Gemini UI DOM, leading to a selector miss and silent timeout.chrome.exeprocesses start (normal for Playwright headless Chromium), so the browser is launching — but the request handler never reports back.Suggested next steps
ui_wait_timeoutto 30000+ to rule out race conditions during UI discovery.tools/audit_ui.pyagainst the current production gemini.google.com to refreshMODEL_PICKER_FALLBACK_SELECTORS.