Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed app/src/components/oauth/OAuthProviderButton.tsx,app/src/components/oauth/__tes

Steven Enamakel359a2c9e2e3a
diff --git a/app/src/components/oauth/OAuthProviderButton.tsx b/app/src/components/oauth/OAuthProviderButton.tsx
index d02be68069..251d0c4c18 100644
--- a/app/src/components/oauth/OAuthProviderButton.tsx
+++ b/app/src/components/oauth/OAuthProviderButton.tsx
@@ -415,7 +415,7 @@ const OAuthProviderButton = ({
<AlertDialogContent className="max-w-md">
<AlertDialogTitle>{t('auth.profileSwitch.title')}</AlertDialogTitle>
<AlertDialogDescription>
- {t('auth.profileSwitch.body', { profileId: localProfileId ?? '' })}
+ {t('auth.profileSwitch.body').replace('{profileId}', localProfileId ?? '')}
</AlertDialogDescription>
<AlertDialogFooter>
<AlertDialogCancel>{t('common.cancel')}</AlertDialogCancel>
diff --git a/app/src/components/oauth/__tests__/OAuthProviderButton.test.tsx b/app/src/components/oauth/__tests__/OAuthProviderButton.test.tsx
index d95201ea5b..5351250f48 100644
--- a/app/src/components/oauth/__tests__/OAuthProviderButton.test.tsx
+++ b/app/src/components/oauth/__tests__/OAuthProviderButton.test.tsx
@@ -106,6 +106,37 @@ describe('OAuthProviderButton', () => {
expect(screen.getByRole('button', { name: /Connecting/ })).toBeDisabled();
});
+ it('warns before switching away from a local profile and continues only after confirmation', async () => {
+ render(<OAuthProviderButton provider={stubProvider} localProfileId="local-device" />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Google' }));
+
+ expect(screen.getByRole('alertdialog')).toBeInTheDocument();
+ expect(screen.getByText(/users\/local-device/)).toBeInTheDocument();
+ expect(screen.getByText(/sign out and choose the local session/i)).toBeInTheDocument();
+ expect(checkBackendHealthy).not.toHaveBeenCalled();
+
+ fireEvent.click(screen.getByRole('button', { name: /continue to sign in/i }));
+ await act(async () => {
+ for (let i = 0; i < 6; i++) await Promise.resolve();
+ });
+
+ expect(checkBackendHealthy).toHaveBeenCalledTimes(1);
+ expect(openUrl).toHaveBeenCalledWith(expect.stringMatching(/^https:\/\/backend\.test\/auth\/google\/login/));
+ });
+
+ it('does not show the local-profile warning for a cloud profile', async () => {
+ render(<OAuthProviderButton provider={stubProvider} localProfileId="cloud-user" />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Google' }));
+ await act(async () => {
+ for (let i = 0; i < 6; i++) await Promise.resolve();
+ });
+
+ expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument();
+ expect(checkBackendHealthy).toHaveBeenCalledTimes(1);
+ });
+
it('resets isLoading when the window regains focus', async () => {
render(<OAuthProviderButton provider={stubProvider} />);