Unify provider sign-in and access controls in Connect account (#23551)

## Thinking Path

> - Paperclip manages work for AI agents.
> - Agents use provider accounts.
> - People connect those accounts in a dialog.
> - Other Models uses a second heading and a separate sign-in action.
> - Reusing the wizard card puts provider instructions and sign-in
controls together.

## Linked Issues or Issue Description

Related PR: #23474.

**What happened?**

Other Models shows duplicate headings and nested access controls.

**Expected behavior**

Show one heading, a full-width provider card, and an access disclosure
below the credentials.

**Steps to reproduce**

Open Connect account, choose Other Models, select xAI, and expand
Change.

## What Changed

Use the wizard sign-in card for subscription providers. Move access
settings below the credentials. Flatten the disclosure and show Done
when it is open.

## Verification

All 35 focused AgentProviderConnection and AdapterLoginChrome tests
passed.

## Risks

Browser redirect and code-based providers use different credential
fields.

## Model Used

OpenAI GPT-6, via Codex.

## Checklist

- [ ] I have included a thinking path that traces from project context
to this change
- [ ] I have specified the model used (with version and capability
details)
- [ ] 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
- [ ] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [ ] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [ ] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [ ] 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
- [ ] I will address all Greptile and reviewer comments before
requesting merge
This commit is contained in:
Tonio authored and GitHub committed 2026-12-02 21:34:41 +00:00
1 parent 7851c2d1e3
commit 3d0e0b6dd9
6 files changed
+37 -27

No files matched your search

+6 -2
View File
@@ -533,13 +533,17 @@ export function ProviderSubscriptionCard({
</OnboardingLoginCard>
);
}
if (mark && (mode === "submitted_code" || mode === "displayed_code")) {
if (mark) {
const nextInstruction = mode === "submitted_code" ? "Return to this window and enter the authorization code."
: mode === "displayed_code" ? "Enter the code below in the sign-in window."
: mode === "hosted_redirect" ? "Return here and paste the authorization code or callback URL."
: "Finish signing in and return to this window.";
const signInInstruction = `Sign into your ${providerName} account`;
return (
<OnboardingLoginCard revealTogether loading={loading} instruction={
<span className="grid gap-1">
<span>1. {signInInstruction}{mode === "submitted_code" && " and copy the authorization code"}.</span>
<span>2. {mode === "submitted_code" ? "Return to this window and enter the authorization code." : "Enter the code below in the sign-in window."}</span>
<span>2. {nextInstruction}</span>
</span>
}>
<div className="flex flex-col gap-2">
@@ -27,7 +27,7 @@ type Props = {
name: string;
hideName?: boolean;
defaultAccountDialog?: boolean;
inlineOpenAiSubscription?: boolean;
providerDialog?: boolean;
onOtherModels?: () => void;
advancedProviders?: ReactNode;
nameForMethod?: (method: AiAuthMethod) => string;
@@ -48,7 +48,7 @@ export function AiConnectionCredentialStep(props: Props) {
return <SubscriptionConnectionStep {...props} />;
}
function SubscriptionConnectionStep({ defaultAccountDialog, inlineOpenAiSubscription, onOtherModels, advancedProviders, companyId, provider, initialMethod, fixedMethod, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, loginAgentId, onComplete, onCancel, defaults, disabled }: Props) {
function SubscriptionConnectionStep({ defaultAccountDialog, providerDialog, onOtherModels, advancedProviders, companyId, provider, initialMethod, fixedMethod, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, loginAgentId, onComplete, onCancel, defaults, disabled }: Props) {
const [name, setName] = useState(initialName);
const [draftMethod, setDraftMethod] = useState<"subscription" | "api">(initialMethod === "api_key" ? "api" : "subscription");
const [draftKey, setDraftKey] = useState("");
@@ -114,8 +114,8 @@ function SubscriptionConnectionStep({ defaultAccountDialog, inlineOpenAiSubscrip
const loadError = views.find((view) => view.kind === "error");
const intent: AiConnectionLoginIntent = { provider: provider as AiConnectionLoginIntent["provider"], method: "subscription", name, ownership, agentIds, allAgents, connectionId };
const dialogFields = defaultAccountDialog && (provider === "anthropic" || provider === "openai");
const accountFields = <>{!hideName && <label className="grid gap-2 text-sm">Connection name<Input value={name} onChange={(event) => setName(event.target.value)} disabled={Boolean(connectionId)} /></label>}{defaults}</>;
return <div className={dialogFields ? "w-full min-w-0 space-y-6" : "mx-auto w-full min-w-0 max-w-xl space-y-6"}>
const accountFields = <>{!hideName && <label className="grid gap-2 text-sm">Connection name<Input value={name} onChange={(event) => setName(event.target.value)} disabled={Boolean(connectionId)} /></label>}{!providerDialog && defaults}</>;
return <div className={dialogFields || providerDialog ? "w-full min-w-0 space-y-6" : "mx-auto w-full min-w-0 max-w-xl space-y-6"}>
{!dialogFields && accountFields}
{!suppliedEnvironmentId && !forced.forced && loginEnvironments.length > 1 && <Select value={environmentId ?? ""} onValueChange={setChosenEnvironment}>
<SelectTrigger className={ANALYTICS_MASK_CLASS} aria-label="Sign-in environment"><SelectValue placeholder="Sign-in environment" /></SelectTrigger>
@@ -135,12 +135,12 @@ function SubscriptionConnectionStep({ defaultAccountDialog, inlineOpenAiSubscrip
onBack={onCancel}
onConnected={() => {}}
testConnection={async () => false}
managedAccount={{ draft: dialogFields ? { method: draftMethod, setMethod: setDraftMethod, apiKey: draftKey, setApiKey: setDraftKey } : undefined, preparingEnvironment: loading, inlineOpenAiSubscription, defaultAccountDialog, onOtherModels, accountFields: dialogFields ? accountFields : undefined, advancedProviders, intent, nameForMethod, initialMethod, fixedMethod: fixedMethod ?? Boolean(connectionId), disabled: disabled || loading || Boolean(environmentError) || Boolean(loadError) || !name.trim(), onComplete: (result) => { void client.invalidateQueries({ queryKey: ["ai-connections", companyId] }); void client.invalidateQueries({ queryKey: ["tools"] }); onComplete(result); } }}
managedAccount={{ draft: dialogFields ? { method: draftMethod, setMethod: setDraftMethod, apiKey: draftKey, setApiKey: setDraftKey } : undefined, preparingEnvironment: loading, providerDialog, accessSettings: providerDialog ? defaults : undefined, defaultAccountDialog, onOtherModels, accountFields: dialogFields ? accountFields : undefined, advancedProviders, intent, nameForMethod, initialMethod, fixedMethod: fixedMethod ?? Boolean(connectionId), disabled: disabled || loading || Boolean(environmentError) || Boolean(loadError) || !name.trim(), onComplete: (result) => { void client.invalidateQueries({ queryKey: ["ai-connections", companyId] }); void client.invalidateQueries({ queryKey: ["tools"] }); onComplete(result); } }}
/>}
</div>;
}
function ApiKeyConnectionStep({ advancedProviders, companyId, provider, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, defaults, disabled, onComplete, onCancel }: Props) {
function ApiKeyConnectionStep({ providerDialog, advancedProviders, companyId, provider, connectionId, name: initialName, hideName, nameForMethod, ownership, agentIds, allAgents, environmentId: suppliedEnvironmentId, defaults, disabled, onComplete, onCancel }: Props) {
const [name, setName] = useState(initialName);
const [apiKey, setApiKey] = useState("");
const client = useQueryClient();
@@ -156,7 +156,7 @@ function ApiKeyConnectionStep({ advancedProviders, companyId, provider, connecti
onSuccess: (result) => { void client.invalidateQueries({ queryKey: ["ai-connections", companyId] }); void client.invalidateQueries({ queryKey: ["tools"] }); onComplete({ ...result, method: "api_key" }); },
onSettled: () => setApiKey(""),
});
return <div className="mx-auto w-full min-w-0 max-w-xl space-y-4">
return <div className={providerDialog ? "w-full min-w-0 space-y-4" : "mx-auto w-full min-w-0 max-w-xl space-y-4"}>
{!hideName && <label className="block space-y-2 text-sm">Connection name<Input value={name} onChange={(event) => setName(event.target.value)} disabled={Boolean(connectionId)} /></label>}
{save.error && <p role="alert" className="text-sm text-destructive">{describeError(save.error).body}</p>}
{copilot && <p className="text-sm text-muted-foreground">Use a personal fine-grained token with Copilot Requests permission. <a className="underline" href="https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/authenticate-copilot-cli" target="_blank" rel="noreferrer">GitHub token instructions</a>. Verification discovers models in the selected environment and sends no model prompt. Repository access uses a separate connection.</p>}
@@ -165,8 +165,8 @@ function ApiKeyConnectionStep({ advancedProviders, companyId, provider, connecti
<SelectContent className={ANALYTICS_MASK_CLASS}>{(envs.data ?? []).filter(env => env.status === "active").map(env => <SelectItem key={env.id} value={env.id}>{env.name}</SelectItem>)}</SelectContent>
</Select>}
{environmentError && <p role="alert" className="text-sm text-destructive">{environmentError}</p>}
{defaults}
<ProviderApiKeyCard providerName={copilot ? "GitHub Copilot" : provider === "google" ? "Antigravity" : "OpenRouter"} value={apiKey} onChange={setApiKey} onSubmit={() => { if (!preparing && !environmentError && name.trim() && apiKey.trim()) save.mutate(); }} disabled={disabled || save.isPending || preparing || Boolean(environmentError)} placeholder={copilot ? "github_pat_..." : "Enter API key here"} autoFocus />
{defaults}
{advancedProviders}
<div className="flex justify-between gap-2"><Button variant="ghost" onClick={onCancel}>Cancel</Button><Button disabled={disabled || !name.trim() || !apiKey.trim() || save.isPending || preparing || Boolean(environmentError)} onClick={() => save.mutate()}>{save.isPending ? "Connecting…" : "Connect"}</Button></div>
</div>;
@@ -267,6 +267,7 @@ export function AiProviderSetup({
);
const accessDefaults = !reconnect ? (
<ConnectionAccessDefaults
flat={providerGrid}
companyId={companyId}
extra={advanced ? modelSettings : undefined}
agents={agents.data ?? []}
@@ -289,7 +290,7 @@ export function AiProviderSetup({
if (!reconnect && accountsView.kind === "error") return <QueryErrorState error={accounts.error} action="load connection permissions" onRetry={accountsView.retry} retrying={accountsView.isFetching} />;
return (
<div className="mx-auto w-full max-w-2xl space-y-6" onSubmit={(event) => event.stopPropagation()}>
{!(step === "provider" && hideProviderHeading) && (
{!(hideProviderHeading && (providerGrid || step === "provider")) && (
<div className="space-y-2">
<h2 className="text-xl font-semibold">
{step === "provider"
@@ -318,7 +319,7 @@ export function AiProviderSetup({
</>
) : !advanced ? (
<AiConnectionCredentialStep
inlineOpenAiSubscription={providerGrid && nativeProvider === "openai"}
providerDialog={providerGrid}
companyId={companyId}
provider={nativeProvider}
connectionId={reconnect?.id}
@@ -83,7 +83,7 @@ function renderConnection(adapterType: "antigravity_runtime" | "claude_local" |
testConnection={async () => true}
managedAccount={{
defaultAccountDialog: presentation === true,
inlineOpenAiSubscription: presentation === "other-models",
providerDialog: presentation === "other-models",
intent: {
provider,
method: "subscription",
@@ -77,7 +77,8 @@ export function AgentProviderConnection({
/** Connections supplies its access intent; presentation and login controllers stay shared. */
managedAccount?: {
defaultAccountDialog?: boolean;
inlineOpenAiSubscription?: boolean;
providerDialog?: boolean;
accessSettings?: ReactNode;
preparingEnvironment?: boolean;
draft?: {
method: "subscription" | "api";
@@ -307,7 +308,7 @@ export function AgentProviderConnection({
const localLoginAction = localLoginPrimary.action;
const wizardCard = managedAccount?.defaultAccountDialog &&
(adapterType === "claude_local" || adapterType === "codex_local");
const inlineLogin = Boolean((wizardCard || managedAccount?.inlineOpenAiSubscription) && opened && method === "subscription");
const inlineLogin = Boolean((wizardCard || managedAccount?.providerDialog) && opened && method === "subscription");
const localReady = inlineLogin && !needsLogin && canUseLocalLogin && localLogin.status === "ready";
const autoSaved = useRef(false);
useEffect(() => {
@@ -318,9 +319,9 @@ export function AgentProviderConnection({
void connect();
}
}, [localReady, managedAccount?.disabled, connect]);
const providerMark = wizardCard || inlineLogin
const providerMark = (wizardCard || managedAccount?.providerDialog) && (adapterType === "claude_local" || adapterType === "codex_local")
? <ModelSourceMark type={adapterType} Fallback={Loader2} />
: <AdapterMark type={adapterType} />;
: <AdapterMark type={adapterType} className={managedAccount?.providerDialog ? "size-full" : undefined} />;
const switchMode = (next: ModelConnectionMode) => {
if (advancedConnection && next === (advanced ? "advanced" : method)) return;
onDraftChanged?.();
@@ -337,7 +338,7 @@ export function AgentProviderConnection({
return (
<div className="min-w-0 max-w-full">
<ModelSourceTiles
animateLayout={!wizardCard}
animateLayout={!wizardCard && !managedAccount?.providerDialog}
label={advancedConnection ? "Connection type" : "Connect your model provider"}
sources={advancedConnection ? [
{ id: "subscription", label: provider, icon: providerMark, credentialMode: "subscription" },
@@ -353,7 +354,7 @@ export function AgentProviderConnection({
]}
mode={advanced ? "advanced" : method}
selectedId={advancedConnection ? (advanced ? "advanced" : method) : opened ? adapterType : null}
collapsed={!wizardCard && !advancedConnection && opened}
collapsed={!managedAccount?.providerDialog && !wizardCard && !advancedConnection && opened}
onSelect={id => {
if (managedAccount?.disabled) return;
if (id === "other") { managedAccount?.onOtherModels?.(); return; }
@@ -459,7 +460,7 @@ export function AgentProviderConnection({
</p>
) : inlineLogin && (managedAccount?.preparingEnvironment || (needsHealth && health.isPending && !needsLogin) ||
(canUseLocalLogin && !needsLogin && !localLogin.error && localLogin.status !== "expired" && !localReady &&
(localLogin.preparing || !localLogin.authorizationUrl))) ? (
(adapterType === "grok_local" ? !localLogin.command : localLogin.preparing || !localLogin.authorizationUrl))) ? (
<ProviderSubscriptionCard loading providerName={provider}
mode={adapterType === "claude_local" ? "submitted_code" : "displayed_code"}>
{null}
@@ -549,6 +550,7 @@ export function AgentProviderConnection({
{needsHealth && healthView.kind === "error" && (
<p role="alert" className="mt-4 text-sm text-destructive">Could not prepare sign-in. Reload this page to try again.</p>
)}
{managedAccount?.accessSettings && <div className="mt-6">{managedAccount.accessSettings}</div>}
{managedAccount?.advancedProviders && <div className="pt-2">{managedAccount.advancedProviders}</div>}
<FooterNav
onBack={() => {
@@ -4333,6 +4333,7 @@ export function AccessStepContent({
hideFooter = false,
/** Embedded: drop the page-level width cap so it fits its container. */
bare = false,
flat = false,
onBack,
onContinue,
}: {
@@ -4364,6 +4365,7 @@ export function AccessStepContent({
pending?: boolean;
hideFooter?: boolean;
bare?: boolean;
flat?: boolean;
onBack: () => void;
onContinue: () => void;
}) {
@@ -4414,9 +4416,9 @@ export function AccessStepContent({
return (
<div className={bare ? "" : "mx-auto max-w-2xl"}>
<div className="overflow-hidden rounded-xl border border-border bg-background">
<div className={flat ? undefined : "overflow-hidden rounded-xl border border-border bg-background"}>
<div className="divide-y divide-border">
<section className="p-6">
<section className={flat ? "py-4" : "p-6"}>
<h2 className="text-sm font-semibold text-foreground">{identityHeading}</h2>
{githubIdentity && grantKind === "agent" ? (
<p className="mt-2 text-sm text-muted-foreground">This agent uses this GitHub account for everyone’s work, instead of the person giving instructions.</p>
@@ -4510,7 +4512,7 @@ export function AccessStepContent({
)}
</section>
<section className="p-6">
<section className={flat ? "py-4" : "p-6"}>
<h2 className="text-sm font-semibold text-foreground">{agentAccessHeading}</h2>
{preserveAgentAccess ? (
<div className="mt-4 flex items-start gap-3 rounded-md border border-border bg-muted/40 p-4">
@@ -4655,6 +4657,7 @@ export function ConnectionAccessDefaults({
sentence,
notice,
extra,
flat = false,
forceOpen = false,
disabled = false,
...accessProps
@@ -4682,7 +4685,7 @@ export function ConnectionAccessDefaults({
const [open, setOpen] = useState(false);
const expanded = open || forceOpen;
return (
<Collapsible open={expanded} onOpenChange={setOpen} className="mt-6 rounded-lg border border-border bg-muted/30 px-4 py-3">
<Collapsible open={expanded} onOpenChange={setOpen} className={flat ? "w-full" : "mt-6 rounded-lg border border-border bg-muted/30 px-4 py-3"}>
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
<p className="text-sm text-muted-foreground">{sentence}</p>
<CollapsibleTrigger asChild><Button
@@ -4691,7 +4694,7 @@ export function ConnectionAccessDefaults({
className="h-auto p-0 text-xs font-semibold underline underline-offset-2"
disabled={disabled}
>
Change
{expanded && !forceOpen ? "Done" : "Change"}
</Button></CollapsibleTrigger>
</div>
{(notice ?? []).map((reason) => (
@@ -4701,8 +4704,8 @@ export function ConnectionAccessDefaults({
<div className="mt-3 space-y-6">
{extra}
{agents
? <AccessStepContent {...accessProps} agents={agents} bare hideFooter submitLabel="" onBack={() => {}} onContinue={() => {}} />
: <AccessStep {...accessProps} companyId={companyId} bare hideFooter submitLabel="" onBack={() => {}} onContinue={() => {}} />}
? <AccessStepContent flat={flat} {...accessProps} agents={agents} bare hideFooter submitLabel="" onBack={() => {}} onContinue={() => {}} />
: <AccessStep flat={flat} {...accessProps} companyId={companyId} bare hideFooter submitLabel="" onBack={() => {}} onContinue={() => {}} />}
</div>
</CollapsibleContent>
</Collapsible>