mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
Align credential chips and clarify Restart sign-in (#23600)
## Thinking Path > - Paperclip lets people share provider credentials with selected agents. > - Connect account shows those agents as profile chips. > - The identity chip and disclosure link have different alignment needs. > - Give the chips one height and place the disclosure beside the access summary. > - Label the sign-in restart action directly. ## Linked Issues or Issue Description Related PR #23598. **What happened?** The identity chip was shorter than the agent chips, and the Change link moved when the chips wrapped. **Expected behavior** Keep chips at 28 pixels. Align Change and Done with the summary. Show Restart sign-in for the isolated sign-in flow. **Steps to reproduce** Open Antigravity under Other Models in Connect account and expand the access editor. ## What Changed Move the disclosure to the summary row and align its baseline. Set a common chip height. Update the restart link and its tests. ## Verification All 51 focused credential access and sign-in tests passed. ## Risks Long summaries can wrap on narrow viewports. ## 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:
1 parent
4363be6069
commit
741bed6651
7 files changed
+34
-35
No files matched your search
@@ -715,7 +715,7 @@ Claude, Codex, and Grok check only their connection-specific login home. The
|
||||
health response selects whether a self-hosted user may sign in.
|
||||
|
||||
Leaving and returning to a local sign-in screen resumes its active attempt. Navigation
|
||||
does not delete its credential home. **Start sign-in again**
|
||||
does not delete its credential home. **Restart sign-in**
|
||||
explicitly cancels the old attempt; abandoned attempts expire after 30 minutes.
|
||||
Completed and expired attempts are cleaned up through the existing lifecycle.
|
||||
|
||||
|
||||
@@ -520,19 +520,20 @@ describe("session replay", () => {
|
||||
it("hides the inline error retry link only when primaryHandlesRetry is enabled", async () => {
|
||||
const failedLogin = {
|
||||
...login,
|
||||
isolated: true,
|
||||
status: "expired" as const,
|
||||
error: "Google sign-in did not complete. Start sign-in again.",
|
||||
};
|
||||
const standalone = await render(
|
||||
<LocalProviderLoginInstructions adapterType="antigravity_runtime" hostedRedirect login={failedLogin} />,
|
||||
);
|
||||
expect(standalone.textContent).toContain("Start sign-in again");
|
||||
expect(standalone.textContent).toContain("Restart sign-in");
|
||||
|
||||
const footerOwned = await render(
|
||||
<LocalProviderLoginInstructions adapterType="antigravity_runtime" hostedRedirect primaryHandlesRetry login={failedLogin} />,
|
||||
);
|
||||
expect(footerOwned.textContent).toContain("Google sign-in did not complete.");
|
||||
expect(Array.from(footerOwned.querySelectorAll("button")).find(b => b.textContent === "Start sign-in again")).toBeUndefined();
|
||||
expect(Array.from(footerOwned.querySelectorAll("button")).find(b => b.textContent === "Restart sign-in")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("maps local/hosted sign-in state to the expected primary footer CTA", () => {
|
||||
|
||||
@@ -918,6 +918,6 @@ export function LocalProviderLoginInstructions({ adapterType, login, hostedRedir
|
||||
</div>}
|
||||
</>}
|
||||
{login?.error && <p role="alert">{login.error}</p>}
|
||||
{showInlineRetry && <button type="button" className="underline underline-offset-4" onClick={login!.retry}>{isolated ? "Start sign-in again" : "Check again"}</button>}
|
||||
{showInlineRetry && <button type="button" className="underline underline-offset-4" onClick={login!.retry}>{isolated ? "Restart sign-in" : "Check again"}</button>}
|
||||
</div>;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ it("checks once under StrictMode, preserves renaming and navigation, and cancels
|
||||
expect(api.cancelLocalLogin).not.toHaveBeenCalled();
|
||||
flushSync(() => Array.from(host.querySelectorAll('button')).find(b => b.textContent === 'Connect')!.click());
|
||||
await vi.waitFor(() => expect(api.connectLocal).toHaveBeenCalledWith("company", expect.objectContaining({ name: "Renamed", localSessionId: "attempt-1" })));
|
||||
flushSync(() => Array.from(host.querySelectorAll('button')).find(b => b.textContent === 'Start sign-in again')!.click());
|
||||
flushSync(() => Array.from(host.querySelectorAll('button')).find(b => b.textContent === 'Restart sign-in')!.click());
|
||||
await vi.waitFor(() => expect(api.startLocalLogin).toHaveBeenCalledTimes(2));
|
||||
expect(api.cancelLocalLogin).toHaveBeenCalledTimes(1);
|
||||
expect(api.cancelLocalLogin.mock.invocationCallOrder[0]).toBeLessThan(api.startLocalLogin.mock.invocationCallOrder[1]);
|
||||
@@ -48,7 +48,7 @@ it.each(["anthropic", "openai"] as const)("waits for the %s authorization card b
|
||||
api.checkLocalLogin.mockResolvedValue({ status: "sign_in_required" });
|
||||
flushSync(() => root.render(<Harness provider={provider} />));
|
||||
await vi.waitFor(() => expect(host.textContent).toContain("Preparing browser sign-in"));
|
||||
expect(host.textContent).not.toContain("Start sign-in again");
|
||||
expect(host.textContent).not.toContain("Restart sign-in");
|
||||
expect(api.startLocalLogin).toHaveBeenCalledTimes(1);
|
||||
|
||||
api.checkLocalLogin.mockResolvedValue({ status: "sign_in_required", authorizationUrl: "https://example.test/authorize", code: "ABCD-12345" });
|
||||
@@ -56,14 +56,14 @@ it.each(["anthropic", "openai"] as const)("waits for the %s authorization card b
|
||||
await vi.waitFor(() => expect(host.querySelector('a[href="https://example.test/authorize"]')).not.toBeNull());
|
||||
if (provider === "anthropic") expect(host.querySelector('input[aria-label="Authorization code"]')).not.toBeNull();
|
||||
else expect(host.textContent).toContain("ABCD-12345");
|
||||
const retry = Array.from(host.querySelectorAll("button")).find(button => button.textContent === "Start sign-in again");
|
||||
const retry = Array.from(host.querySelectorAll("button")).find(button => button.textContent === "Restart sign-in");
|
||||
expect(retry).toBeTruthy();
|
||||
|
||||
api.checkLocalLogin.mockResolvedValue({ status: "sign_in_required" });
|
||||
flushSync(() => retry!.click());
|
||||
await vi.waitFor(() => expect(api.startLocalLogin).toHaveBeenCalledTimes(2));
|
||||
await vi.waitFor(() => expect(host.textContent).toContain("Preparing browser sign-in"));
|
||||
expect(host.textContent).not.toContain("Start sign-in again");
|
||||
expect(host.textContent).not.toContain("Restart sign-in");
|
||||
expect(api.cancelLocalLogin).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ it("explicit retry can replace an attempt opened in another authentication host"
|
||||
api.startLocalLogin.mockRejectedValueOnce(new Error("Another sign-in is still open."));
|
||||
flushSync(() => root.render(<Harness />));
|
||||
await vi.waitFor(() => expect(host.textContent).toContain("Another sign-in"));
|
||||
flushSync(() => Array.from(host.querySelectorAll('button')).find(b => b.textContent === 'Start sign-in again')!.click());
|
||||
flushSync(() => Array.from(host.querySelectorAll('button')).find(b => b.textContent === 'Restart sign-in')!.click());
|
||||
await vi.waitFor(() => expect(host.textContent).toContain("ABCD-12345"));
|
||||
expect(api.startLocalLogin).toHaveBeenLastCalledWith("company", expect.objectContaining({ restart: true }));
|
||||
});
|
||||
@@ -158,7 +158,7 @@ it("hides a failed device prompt and lets the user restart sign-in", async () =>
|
||||
expect(host.textContent).not.toContain("OLD-CODE");
|
||||
expect(host.querySelector('a[href="https://auth.openai.com/codex/device"]')).toBeNull();
|
||||
api.checkLocalLogin.mockResolvedValue({ status: "sign_in_required", authorizationUrl: "https://auth.openai.com/codex/device", code: "NEW-CODE" });
|
||||
flushSync(() => Array.from(host.querySelectorAll("button")).find(b => b.textContent === "Start sign-in again")!.click());
|
||||
flushSync(() => Array.from(host.querySelectorAll("button")).find(b => b.textContent === "Restart sign-in")!.click());
|
||||
await vi.waitFor(() => expect(host.textContent).toContain("NEW-CODE"));
|
||||
expect(host.querySelector('[role="alert"]')).toBeNull();
|
||||
});
|
||||
|
||||
@@ -201,7 +201,7 @@ describe("AgentProviderConnection hosted Google sign-in gating", () => {
|
||||
expect(startSignInCta!.disabled).toBe(false);
|
||||
// Redundant inline retry link is hidden when the footer owns Start sign in.
|
||||
expect(Array.from(host.querySelectorAll("button")).find(
|
||||
(button) => button.textContent?.trim() === "Start sign-in again",
|
||||
(button) => button.textContent?.trim() === "Restart sign-in",
|
||||
)).toBeUndefined();
|
||||
|
||||
flushSync(() => startSignInCta!.click());
|
||||
|
||||
@@ -4697,37 +4697,35 @@ export function ConnectionAccessDefaults({
|
||||
|
||||
return (
|
||||
<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={cn("flex flex-wrap justify-between gap-x-3 gap-y-1", flat ? "items-center" : "items-baseline")}>
|
||||
<div className="grid gap-2">
|
||||
<p className={cn("text-muted-foreground", flat ? "text-xs" : "text-sm")}>{sentence}</p>
|
||||
{flat && <div className="flex flex-wrap items-center gap-1.5" role="group" aria-label="Credential access">
|
||||
<span className={agentIdentityChipClass}>
|
||||
{accessProps.grantKind === "organization" ? <UsersRound className="size-4" /> : <UserRound className="size-4" />}
|
||||
{ownerLabel}
|
||||
</span>
|
||||
{installChoice === "all" && <span className={agentIdentityChipClass}><Bot className="size-4" />Any agent</span>}
|
||||
{selected.map(agent => <span key={agent.id} className={agentIdentityChipClass}>
|
||||
<AgentIdentityChipContent agent={agent} />
|
||||
{editable && <button type="button" aria-label={`Remove ${agent.name}`} className="shrink-0 rounded-sm p-0.5 text-muted-foreground hover:text-foreground" onClick={() => {
|
||||
const next = new Set(installAgentIds);
|
||||
next.delete(agent.id);
|
||||
accessProps.setInstallAgentIds(next);
|
||||
}}><X className="size-3" /></button>}
|
||||
</span>)}
|
||||
{editable && installChoice === "specific" && <AgentSelect addChip agents={available} value="" disabled={!available.length}
|
||||
triggerClassName="size-7 justify-center rounded-md border-dashed bg-transparent p-0 text-muted-foreground"
|
||||
onChange={id => accessProps.setInstallAgentIds(new Set(installAgentIds).add(id))} />}
|
||||
</div>}
|
||||
</div>
|
||||
<div className={cn("flex justify-between gap-x-3 gap-y-1", flat ? "items-baseline" : "flex-wrap items-baseline")}>
|
||||
<p className={cn("min-w-0 text-muted-foreground", flat ? "text-xs" : "text-sm")}>{sentence}</p>
|
||||
<CollapsibleTrigger asChild><Button
|
||||
type="button"
|
||||
variant="link"
|
||||
className="h-auto p-0 text-xs font-semibold underline underline-offset-2"
|
||||
className="ml-auto h-auto shrink-0 p-0 text-xs font-semibold underline underline-offset-2"
|
||||
disabled={disabled}
|
||||
>
|
||||
{expanded && !forceOpen ? "Done" : "Change"}
|
||||
</Button></CollapsibleTrigger>
|
||||
</div>
|
||||
{flat && <div className="mt-2 flex flex-wrap items-center gap-1.5" role="group" aria-label="Credential access">
|
||||
<span className={cn(agentIdentityChipClass, "h-7")}>
|
||||
{accessProps.grantKind === "organization" ? <UsersRound className="size-4" /> : <UserRound className="size-4" />}
|
||||
{ownerLabel}
|
||||
</span>
|
||||
{installChoice === "all" && <span className={cn(agentIdentityChipClass, "h-7")}><Bot className="size-4" />Any agent</span>}
|
||||
{selected.map(agent => <span key={agent.id} className={cn(agentIdentityChipClass, "h-7")}>
|
||||
<AgentIdentityChipContent agent={agent} />
|
||||
{editable && <button type="button" aria-label={`Remove ${agent.name}`} className="shrink-0 rounded-sm p-0.5 text-muted-foreground hover:text-foreground" onClick={() => {
|
||||
const next = new Set(installAgentIds);
|
||||
next.delete(agent.id);
|
||||
accessProps.setInstallAgentIds(next);
|
||||
}}><X className="size-3" /></button>}
|
||||
</span>)}
|
||||
{editable && installChoice === "specific" && <AgentSelect addChip agents={available} value="" disabled={!available.length}
|
||||
triggerClassName="size-7 justify-center rounded-md border-dashed bg-transparent p-0 text-muted-foreground"
|
||||
onChange={id => accessProps.setInstallAgentIds(new Set(installAgentIds).add(id))} />}
|
||||
</div>}
|
||||
{(notice ?? []).map((reason) => (
|
||||
<p key={reason} className="mt-2 text-xs text-muted-foreground">{reason}</p>
|
||||
))}
|
||||
|
||||
@@ -588,7 +588,7 @@ function localSubscriptionStory(
|
||||
}
|
||||
await expect(screen.queryByRole("combobox", { name: "Saved subscription" })).not.toBeInTheDocument();
|
||||
await expect(screen.queryByText(/Run this in a terminal/)).not.toBeInTheDocument();
|
||||
await expect(screen.queryByRole("button", { name: "Start sign-in again" })).not.toBeInTheDocument();
|
||||
await expect(screen.queryByRole("button", { name: "Restart sign-in" })).not.toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user