fix(auth): recover from setup status timeouts - #4371
Conversation
willem-bd
left a comment
There was a problem hiding this comment.
General note (not tied to a specific line): fetchSetupStatus's new AbortController only fires on the 5s timeout — it doesn't abort in-flight requests on component unmount or on a retry. The original code behaved the same way, so this isn't a regression, and it's safe in practice: the cancelled flag prevents stale state writes and the 5s timeout bounds any lingering request.
That said, the abort infrastructure is now in place, so if you want to go a step further you could thread an AbortController from each effect's cleanup so requests cancel genuinely on navigation/retry. Low priority — flagging it as an optional follow-up rather than something that needs to change here.
(Posted on behalf of a review of this PR — overall it's a clean, well-scoped fix.)
|
@willem-bd Thanks for the review. I’ve marked the PR as a default behavior change and clarified that registration remains hidden while setup-status is unavailable, while existing users can still sign in. Regarding the suggested page-level E2E coverage, I looked into adding fail → retry → recover scenarios for both I see two viable approaches:
I’m leaning toward the second option because the repository already separates distinct test topologies through Would a dedicated auth E2E config and CI step be preferred here, or would you rather keep these specs in the default Playwright suite with a second runtime? |
|
@willem-bd Could you please re-review the latest changes when you have a chance? Thank you! |
… resolved keep-ours-skin+graft-logic (bytedance#4371 setup-status phases/unavailable mode, useSettingsDialog refactor), migration-free (0008), chat() CHAT_OK, login/setup render WRI-branded
The authoritative section still said 'Zero runtime hotfixes are currently carrying', listing only two long-absorbed patches. That is the doc a future sync consults, and it was actively misleading: we carry ~51 files of deployment config and WRI re-skin, including surfaces that have already conflicted twice (07-19, 07-26). Replaced with the real inventory, split into deployment/infrastructure (redis-strip, readabilipy+Playwright, .dockerignore, deploy.sh, the schema_sync sentinel, and the lead-agent <language> block) and the WRI re-skin (auth pages carrying grafted bytedance#4371 logic, the 49-string i18n rebrand, nav de-branding, landing page, 20 assets). Also records what must NOT be changed (officialWebsite/githubTooltip/visitGithub; the About page's deliberate DeerFlow attribution), notes that .env's UV_EXTRAS and config.yaml are gitignored so they never appear in the diff, and adds a concrete post-sync verification: 3 DeerFlow refs per locale, /login + /setup 200 and WRI-branded.
* fix(auth): recover from setup status timeouts * test(auth): cover setup status recovery flows --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
Fixes #4366
Why
When the Gateway accepts a connection but
/api/v1/auth/setup-statusdoes not respond, the client-side auth probe had no timeout. The setup page could therefore remain onLoading…indefinitely, while the login page could never resolve whether registration should be available.The SSR auth probe already had a five-second timeout, so client and server behavior diverged precisely during first boot, database migrations, or Gateway/database outages. Users received no actionable error and, on setup, the previous fallback silently redirected them to login.
What changed
AbortSignal, and its timer is cleared on every completion path./setupnow replaces infinite loading and silent redirects with a localized unavailable state. Users can retry the probe or continue to login./loginremains usable when the setup probe fails. It displays a localized retry notice and conservatively hides registration until the setup state is known.Surface area
frontend/backend/applanggraph.json, or prompt changedocker/or sandboxed executionskills/backend/pyproject.tomlorfrontend/package.json(say what it buys us)Screenshots / Recording
No recording is attached. Browser verification used intercepted setup-status responses to exercise both recovery paths:
/login: failure notice visible, login still enabled, registration hidden; retry success removes the notice and restores registration./setup: failure opens the unavailable state; retry success restores the administrator setup form.Bug fix verification
frontend/tests/unit/core/auth/setup.test.tsmainand green on this branch? Not run as an isolated clean-main checkout. During implementation, the new regression suite failed before the timeout helper existed and passes on this branch.Validation
pnpm --dir frontend checkpnpm --dir frontend formatpnpm --dir frontend test— 81 test files, 723 tests passedpnpm --dir frontend build/setupand/loginAI assistance
Tool(s) used: Codex
How you used it: Implemented the timeout and recovery states, added regression tests, ran static/build/test validation, and exercised the UI recovery paths in Chromium.