mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
Use in-panel OpenAI sign-in from Other Models (#23474)
## Thinking Path > - Paperclip lets people connect provider accounts for agent work. > - The Connect account dialog includes a provider grid. > - OpenAI subscription setup from that grid still uses the footer to start sign-in. > - This change uses the same sign-in panel as direct OpenAI setup. > - People can see when authorization is pending and when they can proceed. ## Linked Issues or Issue Description **Subsystem affected** Agent settings and managed AI accounts. Related change: #23361. **Current behavior** OpenAI under Other Models presents a sign-in hyperlink and repurposes the footer during authorization. **Proposed behavior** Start device authorization from the panel. Show Waiting… there and keep Next disabled while authorization is pending. ## What Changed - Enable inline subscription controls for OpenAI when opened from the provider grid. - Exercise the grid presentation in the sign-in panel tests. ## Verification - All 33 focused agent connection and sign-in panel tests passed. - Open Connect account, select Other Models, select OpenAI, and click Sign in. ## Risks The changed path shares completion handling with direct subscription setup. Provider authentication and access settings still use the same APIs. ## Model Used OpenAI GPT-6 through Codex with local editing, terminal tests, and browser verification. ## 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) - [ ] 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 - [ ] 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 - [ ] I will address all Greptile and reviewer comments before requesting merge
This commit is contained in:
1 parent
5a956b724b
commit
28c44fa2a1
4 files changed
+15
-10
No files matched your search
@@ -27,6 +27,7 @@ type Props = {
|
||||
name: string;
|
||||
hideName?: boolean;
|
||||
defaultAccountDialog?: boolean;
|
||||
inlineOpenAiSubscription?: boolean;
|
||||
onOtherModels?: () => void;
|
||||
advancedProviders?: ReactNode;
|
||||
nameForMethod?: (method: AiAuthMethod) => string;
|
||||
@@ -47,7 +48,7 @@ export function AiConnectionCredentialStep(props: Props) {
|
||||
return <SubscriptionConnectionStep {...props} />;
|
||||
}
|
||||
|
||||
function SubscriptionConnectionStep({ defaultAccountDialog, 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, inlineOpenAiSubscription, 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("");
|
||||
@@ -134,7 +135,7 @@ function SubscriptionConnectionStep({ defaultAccountDialog, onOtherModels, advan
|
||||
onBack={onCancel}
|
||||
onConnected={() => {}}
|
||||
testConnection={async () => false}
|
||||
managedAccount={{ draft: dialogFields ? { method: draftMethod, setMethod: setDraftMethod, apiKey: draftKey, setApiKey: setDraftKey } : undefined, preparingEnvironment: loading, 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, 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); } }}
|
||||
/>}
|
||||
</div>;
|
||||
}
|
||||
|
||||
@@ -318,6 +318,7 @@ export function AiProviderSetup({
|
||||
</>
|
||||
) : !advanced ? (
|
||||
<AiConnectionCredentialStep
|
||||
inlineOpenAiSubscription={providerGrid && nativeProvider === "openai"}
|
||||
companyId={companyId}
|
||||
provider={nativeProvider}
|
||||
connectionId={reconnect?.id}
|
||||
|
||||
@@ -66,7 +66,7 @@ afterEach(() => {
|
||||
host.remove();
|
||||
});
|
||||
|
||||
function renderConnection(adapterType: "antigravity_runtime" | "claude_local" | "codex_local", localEnvironment: boolean, defaultAccountDialog = false, onComplete = vi.fn()) {
|
||||
function renderConnection(adapterType: "antigravity_runtime" | "claude_local" | "codex_local", localEnvironment: boolean, presentation: boolean | "other-models" = false, onComplete = vi.fn()) {
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
const provider = adapterType === "antigravity_runtime" ? "google" : adapterType === "claude_local" ? "anthropic" : "openai";
|
||||
flushSync(() => {
|
||||
@@ -82,7 +82,8 @@ function renderConnection(adapterType: "antigravity_runtime" | "claude_local" |
|
||||
onConnected={() => {}}
|
||||
testConnection={async () => true}
|
||||
managedAccount={{
|
||||
defaultAccountDialog,
|
||||
defaultAccountDialog: presentation === true,
|
||||
inlineOpenAiSubscription: presentation === "other-models",
|
||||
intent: {
|
||||
provider,
|
||||
method: "subscription",
|
||||
@@ -101,14 +102,15 @@ function renderConnection(adapterType: "antigravity_runtime" | "claude_local" |
|
||||
|
||||
describe("Connect account dialog", () => {
|
||||
it.each([
|
||||
["claude_local", "Waiting for code…"],
|
||||
["codex_local", "Waiting…"],
|
||||
] as const)("keeps %s sign-in in the panel", async (adapter, waiting) => {
|
||||
["claude_local", "Waiting for code…", true],
|
||||
["codex_local", "Waiting…", true],
|
||||
["codex_local", "Waiting…", "other-models"],
|
||||
] as const)("keeps %s sign-in in the panel", async (adapter, waiting, presentation) => {
|
||||
mocks.healthGet.mockResolvedValue({ localAiLoginSupported: true });
|
||||
mocks.checkLocalLogin.mockResolvedValue({
|
||||
status: "sign_in_required", authorizationUrl: "https://example.test/login", code: "TEST-CODE",
|
||||
});
|
||||
renderConnection(adapter, true, true);
|
||||
renderConnection(adapter, true, presentation);
|
||||
const button = (label: string) => Array.from(host.querySelectorAll("button")).find(b => b.textContent === label);
|
||||
const open = vi.spyOn(window, "open").mockReturnValue(null);
|
||||
try {
|
||||
|
||||
@@ -77,6 +77,7 @@ export function AgentProviderConnection({
|
||||
/** Connections supplies its access intent; presentation and login controllers stay shared. */
|
||||
managedAccount?: {
|
||||
defaultAccountDialog?: boolean;
|
||||
inlineOpenAiSubscription?: boolean;
|
||||
preparingEnvironment?: boolean;
|
||||
draft?: {
|
||||
method: "subscription" | "api";
|
||||
@@ -306,7 +307,7 @@ export function AgentProviderConnection({
|
||||
const localLoginAction = localLoginPrimary.action;
|
||||
const wizardCard = managedAccount?.defaultAccountDialog &&
|
||||
(adapterType === "claude_local" || adapterType === "codex_local");
|
||||
const inlineLogin = Boolean(wizardCard && opened && method === "subscription");
|
||||
const inlineLogin = Boolean((wizardCard || managedAccount?.inlineOpenAiSubscription) && opened && method === "subscription");
|
||||
const localReady = inlineLogin && !needsLogin && canUseLocalLogin && localLogin.status === "ready";
|
||||
const autoSaved = useRef(false);
|
||||
useEffect(() => {
|
||||
@@ -317,7 +318,7 @@ export function AgentProviderConnection({
|
||||
void connect();
|
||||
}
|
||||
}, [localReady, managedAccount?.disabled, connect]);
|
||||
const providerMark = wizardCard
|
||||
const providerMark = wizardCard || inlineLogin
|
||||
? <ModelSourceMark type={adapterType} Fallback={Loader2} />
|
||||
: <AdapterMark type={adapterType} />;
|
||||
const switchMode = (next: ModelConnectionMode) => {
|
||||
|
||||
Reference in new issue
Block a user