Files
PaperClipAI/tests
DottaandPaperclip 3fd66c0e12 fix(ui): surface local and hosted sign-in actions on the primary footer button (#23112)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Operators connect AI subscriptions (such as Google Antigravity,
Claude, and Codex) through `AgentProviderConnection` and
`OnboardingWizard`, which share `FooterNav` for the primary step button
> - The remote sandbox login path (`AdapterLoginPanel`) updates the
primary footer button to `Sign in to <Provider>`, `Retry sign-in`, or
`Connecting`, but the local and hosted sign-in path (`useLocalAiLogin` +
`LocalProviderLoginInstructions`) did not wire into `FooterNav`
> - As a result, the primary footer button stayed disabled and labeled
`Connect` both when sign-in failed/expired and when a sign-in URL was
ready, forcing users to hunt for a small muted inline link (`Start
sign-in again` or `Sign in to Antigravity`)
> - This pull request maps `useLocalAiLogin` state onto the shared
primary footer button in both `AgentProviderConnection` and
`OnboardingWizard` and hides the redundant inline retry link on
failed/expired states when the footer owns it
> - The benefit is that the required next action is always the
prominent, enabled primary button on every connect screen

## Linked Issues or Issue Description

**What happened?**
On the Connect Antigravity subscription screens (and other
`useLocalAiLogin` subscription flows), the bottom-right primary button
remained disabled and labeled `Connect` while the required action was a
small muted link inside the card (`Start sign-in again` on
failed/expired sign-in, or `Sign in to Antigravity` when the OAuth URL
was ready).

**Expected behavior**
- When sign-in fails or expires, the primary footer button should be
enabled and labeled `Start sign in`, and clicking it should restart the
sign-in flow.
- When the sign-in URL is ready, the primary footer button should be
enabled and labeled `Sign in to Antigravity` (or the active provider
name), and clicking it should open the authorization URL in a new tab.
- Once sign-in succeeds, the primary footer button should switch back to
an enabled `Connect` button.

**Steps to reproduce**
1. Open the Antigravity app connection screen
(`/apps/connect?source=antigravity`) in a hosted environment with
subscription mode selected.
2. Observe the sign-in prompt state: the primary bottom-right `Connect`
button is disabled while `Sign in to Antigravity` is only a small
underlined link inside the card.
3. Let the sign-in fail or expire and observe the error state: the
primary bottom-right `Connect` button stays disabled while `Start
sign-in again` is only a small underlined link.

## What Changed

- `ui/src/components/AdapterLoginChrome.tsx`:
- Added `resolveLocalLoginPrimaryAction` to map `useLocalAiLogin` state
(`preparing`, `error`/`expired`, `submitting`, `sign_in_required` with
valid HTTP(S) `authorizationUrl`, and `ready`) to a typed primary CTA
descriptor.
- Added optional `primaryHandlesRetry` and `onSubmittingChange` props to
`LocalProviderLoginInstructions` so hosts that surface `Start sign in`
and `Connecting` on `FooterNav` hide the redundant inline error retry
link while standalone callers keep existing behavior.
- `ui/src/components/new-agent/AgentProviderConnection.tsx`:
- Wired `resolveLocalLoginPrimaryAction` into `FooterNav`
(`primaryLabel`, `primaryDisabled`, `primaryIcon`, `onPrimary`) so
failed/expired states render an enabled `Start sign in` button, ready
authorization URLs render an enabled `Sign in to <Provider>` button that
opens the URL in a new tab, and submitting/preparing states show spinner
feedback.
- `ui/src/components/OnboardingWizard.tsx`:
- Wired `resolveLocalLoginPrimaryAction` into `connectCta` and
`handleConnectStepPrimary` for the matching
`LocalProviderLoginInstructions` branch so onboarding has the same
primary CTA behavior.
- `ui/src/components/AdapterLoginChrome.test.tsx`,
`ui/src/components/new-agent/AgentProviderConnection.test.tsx`,
`ui/src/pages/apps/AppsConnect.test.tsx`:
- Added unit and render tests covering `resolveLocalLoginPrimaryAction`,
`primaryHandlesRetry`, enabled `Sign in to Antigravity` opening the
authorization URL, enabled `Start sign in` restarting failed/expired
sign-in without a redundant inline link, and returning to enabled
`Connect` once ready.

## Verification

- Ran `pnpm --filter @paperclipai/ui typecheck` — passed.
- Ran `pnpm exec vitest run
ui/src/components/AdapterLoginChrome.test.tsx
ui/src/components/new-agent/AgentProviderConnection.test.tsx
ui/src/pages/apps/AppsConnect.test.tsx
ui/src/components/ai-connections/useLocalAiLogin.test.tsx` — 4 test
files, 39 tests passed.

## Risks

- Low risk: UI-only change scoped to the `useLocalAiLogin` branch of
`AgentProviderConnection` and `OnboardingWizard`. Standalone
`LocalProviderLoginInstructions` callers default to `primaryHandlesRetry
= false`, and authorization URLs are validated as `http:` or `https:`
before calling `window.open`.

## Model Used

- Google Gemini (Antigravity agent with tool use, file editing, and
shell execution).

## 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
- [ ] All Paperclip CI gates are green
- [ ] 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 <noreply@paperclip.ing>
2026-11-27 13:37:22 +00:00
..