The WAF (FAIL_SYS_USER_VALIDATE CAPTCHA) is triggered because browser sessions are created without the full set of tracking/WAF cookies that baxia expects.
What works: A real logged-in Chrome browser (Chrome MCP) has baxia fully active: fetch is patched (661 chars wrapper), _waf_async_initialized=true, baxiaInitialized=true. API calls succeed with the correct bx-umidtoken and bx-ua headers.
What breaks: When the server creates a new browser context for an account, only the JWT token cookie is injected. The context starts without baxia/WAF session cookies (cna, ssxmod_itna, tfstk, isg, x5sec). The WAF detects this as a thin/automated session and does not provide baxia initialization. Without baxia's fetch wrapper, bx-umidtoken and bx-ua headers are never generated, and the WAF blocks the API request.
-
createContextInternal()(playwright.ts) — When creating a new browser context, inject ALL cookies from the account'sprofileCookiesfield (cna, ssxmod_itna, tfstk, isg, token, etc.), not just the token. Gives the WAF an established session from the start. -
refreshAccountCookies()(playwright.ts) — After navigating to chat.qwen.ai, polls for session cookies up to 15 seconds (was a fixed 2-second sleep). After cookies are collected, saves ALL of them toacct.profileCookiesin accounts.json so they persist across server restarts. -
tryCheckToken()(browserProfiles.ts) — After a successful manual login via the headed browser (dashboard "Login" button), saves ALL cookies from the profile (not just the token) toacct.profileCookies. This captures baxia/WAF session cookies for future API sessions.
Since existing accounts were created via API auth (no full browser session), you need to:
- Login once through the web UI: Use the dashboard's "Login" button for each account. This opens a headed browser where you log in manually.
- After login: All cookies are automatically saved to the account profile.
- Restart the server: The next context creation will inject the full cookie set.
- API calls should now work: The WAF sees an established session with all tracking cookies.
src/services/playwright.ts— createContextInternal (inject profileCookies), refreshAccountCookies (wait+save)src/services/browserProfiles.ts— tryCheckToken (save all cookies after login)
8 accounts configured. None have profileCookies with a token cookie yet (requires manual web UI login).
bun src/index.tsx # Server on port 26405
bun test # 103 tests passsrc/services/playwright.ts- Browser context, cookie injection, fetch routingsrc/services/qwen.ts- Chat completion logic, error handling, header buildingsrc/services/browserProfiles.ts- Manual login flow, profile managementsrc/services/auth.ts- Account management, token management