Skip to content

Playwright backend: chat requests timeout for 3.5-flash / 3.1-pro / 3.1-flash-lite (HTTP 504 after ~17s) #117

Description

@Skrblik

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

  1. python src/run.py --host 127.0.0.1 --port 6969
  2. 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}'
  3. 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

  1. Increase ui_wait_timeout to 30000+ to rule out race conditions during UI discovery.
  2. Add verbose logging around the model picker selection step so we can see which selector matched (or none).
  3. Run tools/audit_ui.py against the current production gemini.google.com to refresh MODEL_PICKER_FALLBACK_SELECTORS.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions