Skip to content

fix(ui): resume existing session when passkey sign-in returns session_exists - #10841

Merged
mikepitre merged 2 commits into
mainfrom
mike/fix-passkey-session-exists
Nov 16, 2026
Merged

mikepitre merged 2 commits into
mainfrom
mike/fix-passkey-session-exists

Conversation

@mikepitre

@mikepitre mikepitre commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

In <SignIn />, the email/password form (SignInStart.attemptToRecoverFromSignInError) and the social buttons (SignInSocialButtons.handleError) both recover from a session_exists error by activating client.lastActiveSessionId. The passkey handler (useHandleAuthenticateWithPasskey) did not. It passed the error to handleError, so the card showed "You're already signed in." and the user was stuck on the sign-in page.

This happens when an earlier sign-in completed but its redirect never landed (for example after a dropped connection), and the user then clicks "Use passkey instead" on the same page. A customer reported it and was working around it with __internal_onAfterResponse.

This PR adds the same session_exists → setActive({ session: client.lastActiveSessionId }) recovery to the passkey handler.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

…_exists

The email/password form and the social buttons in <SignIn /> recover from
`session_exists` by activating `client.lastActiveSessionId`. The passkey
handler did not, so a passkey sign-in after a completed sign-in whose
redirect never landed showed "You're already signed in." and left the user
stuck on the sign-in page.

Add the same recovery to useHandleAuthenticateWithPasskey.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 16, 2026 4:59pm UTC
swingset Ready Ready Preview Nov 16, 2026 4:59pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 28200eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

When passkey sign-in returns a Clerk API response error containing SESSION_EXISTS, the hook activates the client’s last active session and passes the existing sign-in navigation callback to setActive. A test checks that the session is activated and the error message is not displayed. A patch changeset records the update.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: dmoerner, zourzouvillys, alexcarpenter

Merge Risk: Minimal · up to 28200

Passkey sign-in now resumes an existing session instead of leaving the user on the sign-in page with "You're already signed in." The behavior matches the other sign-in methods and is covered by a test. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the passkey sign-in handler now resumes the existing session when it returns session_exists. It uses the conventional fix(ui) prefix and matches the raw summary and PR…
Description check Passed The description explains the bug. The email/password form and social buttons already recover from session_exists, but the passkey handler did not. It describes the fix that activates client.lastActive…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the passkey sign-in handler now resumes the existing session when it returns session_exists. It uses the conventional fix(ui) prefix and matches the raw summary and PR objectives.

Full details: Description check

Explanation

The description explains the bug. The email/password form and social buttons already recover from session_exists, but the passkey handler did not. It describes the fix that activates client.lastActiveSessionId, which matches the changed files in shared.ts and the new SignInStart test.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: clerk/javascript
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 84de684
  • Layers: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: b25acf92-62f4-4790-854a-5d03cbefaf76
Commits

Reviewing files that changed from the base of the PR and between 84de684 and 28200eb.

Files selected for processing: 3

  • .changeset/passkey-session-exists.md
  • packages/ui/src/components/SignIn/__tests__/SignInStart.test.tsx
  • packages/ui/src/components/SignIn/shared.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 5 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

@github-actions github-actions Bot added the ui label Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10841

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10841

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10841

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10841

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10841

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10841

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10841

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10841

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10841

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10841

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10841

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10841

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10841

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10841

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10841

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10841

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10841

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10841

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10841

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10841

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10841

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10841

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10841

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10841

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10841

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10841

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10841

commit: 28200eb

@github-actions

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-11-16T17:03:16.476Z

Summary

Metric Count
Packages analyzed 20
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 28200eb.

@blacksmith-sh

blacksmith-sh Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Matches Passkey sign-in resumes existing session on session_exists

Before, the card showed "You're already signed in." and stayed on /sign-in; after, the click activated the last active session and redirected signed in.

Recording

Watch full video · Original footage · 0:00 Sign-in card, signed out · 0:04 Click Use passkey instead · 0:13 Landed on the after-sign-in page

Merge-base

Stuck on error card

This PR 28200eb4

Redirected, signed in

Merge-base

API calls: 400 only

This PR 28200eb4

API calls: touch session

Proof on 28200eb4 (from 521efcd3) · mocked: Clerk Frontend API (hosted dev instance) (setting auth_config.single_session_mode) · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

@wobsoriano wobsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense!

@mikepitre
mikepitre merged commit 4c74f50 into main Nov 16, 2026
62 checks passed
@mikepitre
mikepitre deleted the mike/fix-passkey-session-exists branch November 16, 2026 17:41

This branch was successfully deployed

2 active deployments
Preview – swingset — 28200eb4 Deployed Nov 16, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 28200eb4 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants