Skip to content

fix(auth): a hung "Sign in with SSO" request gives the login page back after the 20 s sign-in watchdog - #35737

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-aru6wr
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-aru6wr

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #34861

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:登录页按“使用 SSO 登录”后若服务器一直不回应,约 20 秒后转圈停止、提示登录超时,邮箱框和按钮恢复可用,可以直接重试;此前会一直转圈直到刷新页面。
  • 为什么做:修复单点登录用户在身份提供方接口卡住时被困在登录页的问题,与其他登录按钮已有的 20 秒超时保护对齐。
  • 出错会怎样:只影响按邮箱走单点登录的那一步;最坏情况是超时提示出现得过早或不出现,可直接撤回本次改动恢复原样。
  • 要你做什么:无

What changes

  • ui/packages/auth/src/LoginForm.tsx, handleSso: the POST /api/v1/auth/sign-in/sso request now carries an AbortController signal, aborted after SSO_SIGN_IN_TIMEOUT_MS (20 000 ms). On that abort the form shows SSO_SIGN_IN_TIMEOUT_TEXT and clears ssoSubmitting, so the SSO button and the SSO email field are usable again (retry path). The timer is cleared in finally on every settle; a successful answer still navigates to data.url and keeps the pending state through teardown.
  • The window and the sentence are the same as the provider buttons' watchdog (SIGN_IN_TIMEOUT_MS / withTimeout inside signInWithProvider in createAuthClient.ts). They are module constants in LoginForm.tsx, not imported: createAuthClient.ts is outside this card's file surface, and the watchdog there is a local of signInWithProvider with nothing exported to share.
  • The body read (res.json()) is also under the signal: an abort during the body read surfaces as the timeout, not as the "No SSO provider" fallback.
  • Changeset: @object-ui/auth patch.

Why

A hung SSO request left the button spinning and the email field disabled until a reload (reproduced by QA twice under SSO-only mode). The card's expected behaviour: "after about 20 s the watchdog recovers the button with an error and a retry path."

Tests

New top-level describe in the shared harness ui/packages/auth/src/__tests__/LoginForm.test.tsx (SSO-only mode, fake setTimeout/clearTimeout):

  • Pin: the SSO fetch never answers. At 19 999 ms the button and the email field are still disabled, the request's signal is not aborted and no alert shows; at 20 000 ms the signal is aborted, the alert reads as a timeout, and the button and the email field are enabled.
  • CONTROL: an answering fetch still sets window.location.href to the IdP URL; after 20 s the signal is not aborted, the button keeps its pending state, and no alert shows.
Readings at head 171e0ee (after merging origin/main a3a74f2)
  • pnpm --dir ui exec vitest run packages/auth/ under the verify lock: Test Files 48 passed (48), Tests 493 passed (493), VERDICT command-exit 0.
  • pnpm --filter @object-ui/auth type-check (tsc --noEmit && tsc -p tsconfig.test.json; the second program includes src/**/*.test.tsx): VERDICT command-exit 0.
  • Ablation (at c00af54, the fix committed first; the test imports ../LoginForm from source, no dist in the path): node scripts/ablation-replace.mjs replaced the timer body controller.abort(); / SSO_SIGN_IN_TIMEOUT_MS with a no-op and a 1e9 ms delay (anchor x1 to x0, replacement x0 to x1, blob 990a9efa to 60b77598). Pin RED: expected false to be true on signal.aborted; CONTROL green. Restored: blob equals HEAD (990a9efa), git diff HEAD empty.

Acceptance notes

  • The 20 s value and the timeout sentence now live in two places (LoginForm.tsx module constants and the local inside signInWithProvider). Moving the watchdog into one shared module is a follow-up for whoever next edits createAuthClient.ts; not done here because that file was outside this card's surface.
  • The timeout sentence is not localized, same as the provider buttons' watchdog sentence (shown via the error's message). No new LoginFormLabels key was added.
  • onError is not called on the SSO path, as before this change.

Verification

Read first: ui/packages/auth/src/LoginForm.tsx handleSso (risk hunk: the res.json().catch rethrow on timeout and the finally clearing the timer, which must not fire after a successful navigation).

Two-minute check: pnpm --dir ui exec vitest run packages/auth/src/__tests__/LoginForm.test.tsx -t "aborted after 20 s" shows 2 passed.

Local gate readings
  • node scripts/pm/dispatch-gates.mjs --commands derived 38 families for this diff. 37 ran at head 171e0ee, all exit 0. --ran reconciliation: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED".
  • pnpm --dir ui exec vitest run scripts/ ran once at c00af54 (before the merge): exit 1, 2 files red of 173 (date-only-zone-pins-10183.test.ts, which drives other ui packages' zone tests, and a closure-budget test that needs a built Console bundle: "Budgeted chunk ui-components is ABSENT from the eager closure"). Neither reads ui/packages/auth. Read as an unbuilt-workspace reading, not a verdict, and left to CI's Test UI.
  • node scripts/pm/overlap-check.mjs --branch=HEAD and --pr=35575: VERDICT clean exit 0.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran; pnpm lint is a repo-wide scan left to CI, not run locally.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c

…in watchdog window

The SSO-by-email submit was a bare fetch with no signal, so a request
that never answered left the button pending and the email field
disabled. It now runs under an AbortController aborted after 20 s, the
same window and sentence as the provider buttons' watchdog.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c

Final head for review · 2026-11-20T04:49Z: 171e0ee38e0bdc54811f3fd08ee31e7ce1e4d1b4. Check-runs on that head read now: 39 success, 13 skipped, 0 failed, 0 running. L1 requested from the seat's L1-a thread (diff +100 / −4 over 3 files). Card #34861, claim 7015932648, dev report 7030476773.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

席位核对

L1: ACCEPT (L1-a, for area d7-A) at head 171e0ee38e0bdc54811f3fd08ee31e7ce1e4d1b4, read 2026-11-20T04:51Z.

Checklist (l1-review-checklist.md), read on GitHub and in the head tree:

  • Shape. Draft, base main. Fixes #34861 is the only closing keyword, and it fits: the card's expected behaviour ("after about 20 s the watchdog recovers the button with an error and a retry path") is delivered. Clause-②: no and Metadata-protocol: none sit at line start in the body and the changeset. The ui/** path stays in this lane under 留道, as claim 7015932648 records.
  • Scope. 3 files, +100/−4: LoginForm.tsx, its shared-harness test and one changeset. No content/docs/releases/ edit. @object-ui/auth is published and carries a patch changeset.
  • Code (handleSso).
    • An AbortController per press. The timer sets timedOut and aborts after SSO_SIGN_IN_TIMEOUT_MS, and the signal goes to fetch.
    • res.json().catch rethrows only when timedOut, so an abort during the body read becomes the timeout message instead of the "No SSO provider" fallback, while a plain JSON parse failure keeps the old {} fallback.
    • finally clears the timer on every settle, including the success return before navigation, so a navigating page never gets a late abort or alert.
    • setSsoSubmitting(false) runs on both the error and catch paths, so the button and field come back.
  • Point (1): the duplicated window and sentence. Accepted.
  • Changeset prose, sentence by sentence.
    • "kept spinning … until the page was reloaded" is the card's reproduction.
    • "same 20-second limit as the identity-provider buttons" is true per the values above.
    • "the request is cancelled, the page says the sign-in timed out, and the email field and the button can be used again" is the main pin at 19 999 / 20 000 ms.
    • "An answering request still sends the browser to the identity provider" is the CONTROL.
  • Tests.
    • The main pin uses fake setTimeout / clearTimeout. At 19 999 ms: still disabled, not aborted, no alert. At 20 000 ms: aborted, the alert reads as a timeout, and both controls are enabled.
    • CONTROL: an answering fetch navigates and is never aborted after 20 s.
    • Ablation with the timer neutered: the pin goes red on signal.aborted and the CONTROL stays green, restored blob-equal. The tests import ../LoginForm from source, so there is no dist leg.
    • Not pinned, nit only: the abort-during-res.json() branch. It is small and its intent is stated in the code comment.
  • Point (2): the ui scripts/ family run red locally before the merge. Accepted, as NOT MEASURED locally rather than as passing. The two red files (date-only-zone-pins-10183, the closure-budget test that needs a built Console bundle) read no ui/packages/auth file and are named with their unbuilt-workspace cause. Per l1-review-checklist.md the gate evidence is the check runs: CI at 171e0ee3 has 52 runs, 39 success and 13 skipped, none red. Lint & Repo Gates, TypeScript Type Check, Type Check UI, Lint UI, Test UI and Check Changeset are all success.
  • Contract review. None owed: no Clause-②: yes, no narrowing, no packages/spec/src/**, no governed path. This PR is non-governed and well under 3,000 lines, so it lands by the area after check-governed-merges.mjs --pr 35737.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c

Landing · 2026-11-20T04:52Z · head 171e0ee38e0bdc54811f3fd08ee31e7ce1e4d1b4 · L1 ACCEPT 7030778308 (L1-a); no L2 owed (Clause-② no, no packages/spec/src/**, no narrowing arm)

Probe Reading
check-governed-merges.mjs --pr 35737 NOT governed · 0 of 3 paths hit the register · +100 / −4 = 104 lines ≤ 3000
Check-runs at head 52: 39 success, 13 skipped, 0 failed
K (rev-list --count --first-parent PRBASE..origin/main, PRBASE a3a74f27 = merge base; Test Core skipped by path selection on this ui-only diff) 3 (< 15); this PR touches no shared-budget input

State: ready + auto-merge now; #34861 closes on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 04:53
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit ca4ec2a Nov 20, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-aru6wr branch November 20, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login: a hung "Sign in with SSO" request spins forever; the 20 s sign-in watchdog does not cover the SSO-by-email path

2 participants