From 111973c5e392e15df5b8d6bc63298df3dbb8d8e4 Mon Sep 17 00:00:00 2001 From: Tonio Date: Mon, 30 Nov 2026 07:30:05 +0000 Subject: [PATCH] Show waiting and retry in the onboarding sign-in card (#23268) ## Thinking Path > - Paperclip helps people manage AI agents. > - Onboarding connects an agent to a model. > - Users open the provider sign-in from the connection card. > - The card should show when the provider is waiting and how to recover after a timeout. > - This change keeps both actions in the same place. ## Linked Issues or Issue Description **Subsystem affected** Model connection during first-agent onboarding. Related work includes #23255 and #6636. **Current behavior** The sign-in link remains active after opening the provider. Retry appears in the footer. **Proposed behavior** Show a waiting label beside the code. Offer retry inside the card when sign-in expires. Keep Next disabled during these states. ## What Changed - Show the provider-specific waiting label after opening sign-in. - Show a retry action and saved-setup message in the card. - Cover both providers and the reset after retry. ## Verification - Ran the UI typecheck. - Ran the adapter login card and local login tests. All 33 passed. ## Risks Local and hosted sign-in expose retry through different handlers. This change keeps the existing session handlers. ## Model Used OpenAI GPT-6 with Codex repository and test tools. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip --- ui/src/components/AdapterLoginChrome.test.tsx | 34 +++++++++++++ ui/src/components/AdapterLoginChrome.tsx | 49 +++++++++++++++++-- ui/src/components/OnboardingWizard.tsx | 8 +-- 3 files changed, 84 insertions(+), 7 deletions(-) diff --git a/ui/src/components/AdapterLoginChrome.test.tsx b/ui/src/components/AdapterLoginChrome.test.tsx index 93163e36be7..ac998c56ac9 100644 --- a/ui/src/components/AdapterLoginChrome.test.tsx +++ b/ui/src/components/AdapterLoginChrome.test.tsx @@ -9,6 +9,8 @@ import { LocalProviderLoginInstructions, OnboardingLoginCard, OnboardingCardField, + OnboardingSignInMark, + ProviderSubscriptionCard, OnboardingLoginCodeRow, onboardingCardInputClass, resolveLocalLoginPrimaryAction, @@ -73,6 +75,38 @@ describe("the connect step's cards", () => { flushSync(() => root!.render(node)); } + it.each([ + ["submitted_code", "Claude", "Waiting for code…"], + ["displayed_code", "OpenAI", "Waiting for sign-in…"], + ] as const)("keeps waiting and retry inside the %s card", (mode, providerName, waitingLabel) => { + const open = vi.fn(); + const retry = vi.fn(); + const card = (failure?: "expired") => ( + }> + + {failure ? null : } + + + ); + render(card()); + flushSync(() => container.querySelector("a")!.click()); + expect(open).toHaveBeenCalledOnce(); + expect(container.querySelector("button")?.disabled).toBe(true); + expect(container.textContent).toContain(waitingLabel); + const reopen = container.querySelector(`a[aria-label="Reopen ${providerName} sign-in"]`); + expect(reopen?.getAttribute("href")).toBe("https://example.test/login"); + expect(container.querySelector("input")?.disabled).toBe(false); + flushSync(() => root!.render(card("expired"))); + expect(container.textContent).toContain("Your setup is saved."); + const button = container.querySelector("button")!; + expect(button.textContent).toBe("Retry sign in"); + button.click(); + expect(retry).toHaveBeenCalledOnce(); + flushSync(() => root!.render(card())); + expect(container.querySelector("a")?.textContent).toBe("Sign in"); + }); + it("gives every card field the same input, from one declaration", () => { // The step asks for three different things in this row — a browser code, a // key — and they sit one toggle apart in the same canvas, so a divergence diff --git a/ui/src/components/AdapterLoginChrome.tsx b/ui/src/components/AdapterLoginChrome.tsx index 645eaa897bd..290f1da0274 100644 --- a/ui/src/components/AdapterLoginChrome.tsx +++ b/ui/src/components/AdapterLoginChrome.tsx @@ -458,6 +458,7 @@ export function OnboardingCardField({ ); } +export const OnboardingSignInRetry = createContext<(() => void) | null>(null); export const OnboardingSignInMark = createContext(null); /** Shared authentication presentation. Hosts retain their existing session lifecycle. */ @@ -483,17 +484,50 @@ export function ProviderSubscriptionCard({ children: ReactNode; }) { const mark = useContext(OnboardingSignInMark); - if (mark && !failure && (mode === "submitted_code" || mode === "displayed_code")) { + const retry = useContext(OnboardingSignInRetry) ?? onRetry; + const [openedUrl, setOpenedUrl] = useState(null); + useEffect(() => { + if (loading || failure) setOpenedUrl(null); + }, [loading, failure]); + if (mark && failure) { + return ( + + {failureMessage ?? (failure === "expired" ? "This sign-in expired. Retry signing in to get a new code." : "Sign-in didn’t finish. Try signing in again.")} + Your setup is saved. + }> +
+ {retry && } + {children} +
+
+ ); + } + if (mark && (mode === "submitted_code" || mode === "displayed_code")) { + const waiting = Boolean(openedUrl && openedUrl === authorizationUrl); + const signInInstruction = `Sign into your ${providerName} account`; return ( - 1. Sign into your {providerName} account{mode === "submitted_code" && " and copy the authorization code"}. + 1. {waiting ? ( + + {signInInstruction} + + ) : signInInstruction}{mode === "submitted_code" && " and copy the authorization code"}. 2. {mode === "submitted_code" ? "Return to this window and enter the authorization code." : "Enter the code below in the sign-in window."} }> @@ -741,6 +775,13 @@ export function LocalProviderLoginInstructions({ adapterType, login, hostedRedir const safeAuthorizationUrl = isHttpAuthorizationUrl(login?.authorizationUrl) ? login.authorizationUrl : null; const awaitingBrowserSignIn = browserLogin && !ready && !login?.authorizationUrl && !needsRetry; const showInlineRetry = Boolean(login && !login.preparing && !ready && !awaitingBrowserSignIn && (isolated || login.error) && !(primaryHandlesRetry && needsRetry)); + if (onboardingSignIn && login && needsRetry && !ready) { + return {null}; + } return
{ready ? <>

{login?.accountLabel ?? provider} is signed in. Click Connect to use this account.

diff --git a/ui/src/components/OnboardingWizard.tsx b/ui/src/components/OnboardingWizard.tsx index 835eba6e3b3..b66b0e7786f 100644 --- a/ui/src/components/OnboardingWizard.tsx +++ b/ui/src/components/OnboardingWizard.tsx @@ -1,4 +1,4 @@ -import { OnboardingSignInMark } from "./AdapterLoginChrome"; +import { OnboardingSignInMark, OnboardingSignInRetry } from "./AdapterLoginChrome"; import type { AiConnectionLoginIntent } from "@paperclipai/shared"; import { cancelAdapterLoginSession, cancelPendingAdapterLogin, matchesAdapterLoginTarget } from "./useAdapterLoginCancellation"; import { useQueryView } from "@/components/QueryView"; @@ -1685,9 +1685,9 @@ function OnboardingWizardInner({ }); const localLoginAction = localLoginPrimary.action; const connectCta = resolveOnboardingConnectCta({ - passiveSubscriptionFooter: subscriptionSignIn && localLoginAction?.kind !== "retry" && !error && !visibleAdapterEnvError, + passiveSubscriptionFooter: subscriptionSignIn && (Boolean(retryLogin) || localLoginAction?.kind === "retry" || (!error && !visibleAdapterEnvError)), setupError, - retryLogin: Boolean(retryLogin), + retryLogin: !subscriptionSignIn && Boolean(retryLogin), connectProgress, adapterEnvLoading, connectPhase, @@ -3356,6 +3356,7 @@ function OnboardingWizardInner({ `connectCardMounted`. */} : null}> + {!connectCardMounted ? null : connectProgress ? (

@@ -3526,6 +3527,7 @@ function OnboardingWizardInner({ /> ) : browserSignInUnavailable ?

This environment does not support browser sign-in. Go back to use an API key or choose another model.

: null ) : null} +
{showAdvancedSetup && (