Skip to content

[Bug]: Add-provider OAuth code login (Devin/windsurf) — expired login flow surfaces as "The dashboard target changed. Reopen this form on the current server." #8618

Closed

Description

@Matthewyin

Client or integration

OpenCodex dashboard

Area

Dashboard

Summary

Adding a Devin account via the dashboard's Add-provider login dialog fails with a misleading error after a normal, successful browser sign-in:

The dashboard target changed. Reopen this form on the current server.
(仪表板目标已更改。请在当前服务器上重新打开此表单。)

Nothing about the server target actually changed: a single standalone instance (ocx start --port 10100) served the dashboard for the whole session on a fixed port, with no Remote Link / hub-relay. What really happened is that the client-side login session had already been torn down by the time the token was pasted. The login never lands (auth.json gains no devin entry), and the message sends the user hunting for a server problem that does not exist.

Reproduction

  1. Dashboard → Providers → Add provider → Devin → Login. Browser opens https://windsurf.com/windsurf/signin?...&prompt=login.
  2. Complete the Cognition/Windsurf sign-in in the browser (a first-time login with 2FA / email verification easily takes more than 3 minutes).
  3. Copy the on-screen auth token, return to the still-open dashboard modal, paste it, click Submit.
  4. Observe the "dashboard target changed" error above.

Root cause (from source; v2.100.2 == dev on these files) — three unrelated failures share the single i18n key prov.targetChanged in gui/src/components/use-add-provider-oauth.ts (submitManualCode):

  1. Capture miss — activeCapturesRef.current.get(providerId) returns nothing because loginOAuth already dropped this provider's capture: the poll loop has a fixed budget of loginPollAttempts(deviceFlow, OAUTH_LOGIN_POLL_INTERVAL_MS, 100) = 100 × 2 s ≈ 3 min 20 s for non-device flows (line 174). Devin's windsurf flow has no device code, so it always gets the short budget. When the budget lapses, the hook cancels the server-side flow (/api/oauth/login/cancel) and deletes the capture.
  2. isApiTargetCaptureCurrent(capture) re-validation failure (origin/apiBase/transport/generation changed).
  3. Server 409 { error: "target_changed" } — produced only by src/client/hub-relay.ts (hub-relay / link mode), i.e. impossible in standalone.

In a stable standalone setup, #2 and #3 cannot fire, so what users actually hit is #1. Two aggravating details:

  • gui/src/pages/use-providers-oauth.ts:213 (the other login surface) already uses loginPollAttempts(deviceFlow, 2000, 150) — 5 minutes. The Add-provider modal still uses 100, so the two surfaces disagree.
  • When the poll loop exits through an !isCurrent() guard, finally deletes the capture but skips the UI cleanup (setOauthUrl("") runs only under isCurrent()), leaving the auth URL and the paste box rendered with no live flow behind them — a zombie form whose only symptom is the misleading message on submit.

Expected behavior:

  • A capture-miss on submit should say the login session ended/expired and to start the login again — not that the dashboard target changed.
  • The browser-login budget should be long enough for a real first-time provider sign-in (≥ the 150 attempts used by use-providers-oauth.ts, or honor the expiresAt that /api/oauth/login already returns for code mode instead of a fixed attempt count).
  • If the capture is dropped while the modal is still visible, the modal should be reset (URL cleared / timeout notice shown) rather than left usable.

Suggested fix:

  • Add a distinct key, e.g. prov.loginFlowEnded: "This login session has ended — click Login again, then paste the token for the new session." (zh: 「该登录流程已结束或超时,请重新点击登录后再粘贴验证码。」)
  • Raise the Add-provider browser-flow budget to 150 (matching use-providers-oauth.ts), or drive polling off the flow's expiresAt.
  • Reset the modal surface whenever the capture for a visible login is dropped.

Happy to verify a fix on my setup.

Version

@bitkyc08/[email protected] (npm)

Operating system

macOS (Darwin 25.6.0, arm64)

Provider and model

Devin (windsurf.com sign-in URL with redirect_uri=show-auth-token — URL + paste-token "code" flow, no device code)

Logs or error output

# Dashboard modal (manual-code message area):
仪表板目标已更改。请在当前服务器上重新打开此表单。
# English locale:
The dashboard target changed. Reopen this form on the current server.

# Server was stable and single-instance throughout:
# bun ... src/cli/index.ts start --port 10100   (one process, PID unchanged)
# Listening: 127.0.0.1:10100 (management), plus the proxy/shared planes; no restarts during the attempt.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    account-pool
    gui
    on Nov 13, 2026
  2. github-actions commented on Nov 13, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  3. changed the title [-][Bug] Add-provider OAuth code login (Devin/windsurf): expired login flow surfaces as "The dashboard target changed. Reopen this form on the current server."[/-] [+][Bug]: Add-provider OAuth code login (Devin/windsurf) — expired login flow surfaces as "The dashboard target changed. Reopen this form on the current server."[/+] on Nov 13, 2026
  4. added
    bug
    on Nov 13, 2026
  5. Ingwannu commented on Nov 13, 2026

    @Ingwannu
    Owner

    Confirmed against current dev 8f6d9b64e9 by source inspection: Add-provider's non-device poll budget is still100×2s, finally drops the capture, and submitManualCode maps a missing capture to prov.targetChanged. A stable server can therefore reach that message after a flow ends; it is not evidence that the server actually changed. No real login token or account was used in this triage.

    A focused fix should keep the target-capture fence intact and distinguish ended/expired login from a genuine target-change/409. Reuse the existing timeout/cancellation handling where appropriate, reconcile the browser-flow lifetime with the API's explicit expiry/other login surface, and clear only the surface still owned by that login generation. A superseded old login must not clear a replacement, and an old code must never be posted to a newly selected server.

    Please cover these with fake timers/transport fixtures: non-device expiry followed by code submit, slower successful login within its supported lifetime, real target change, replacement-login cleanup and device-flow behavior. This does not require sharing or reusing a live pasted token. The frontend flow/copy change still needs its focused implementation review; no live config/service or UI was changed here.

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

    account-poolbuggui

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions