Skip to content

The agent that grows with you

fix(desktop): a guest with connected apps can always find the sign-in

alt-glitch668362f11d42
diff --git a/apps/desktop/src/app/capabilities/connectors/data/queries-rules.test.tsx b/apps/desktop/src/app/capabilities/connectors/data/queries-rules.test.tsx
index 543d3af759c..f399e9d4b1a 100644
--- a/apps/desktop/src/app/capabilities/connectors/data/queries-rules.test.tsx
+++ b/apps/desktop/src/app/capabilities/connectors/data/queries-rules.test.tsx
@@ -4,7 +4,7 @@ import type { ReactNode } from 'react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { queryClient } from '@/lib/query-client'
-import { noteFreeTierTurnComplete } from '@/store/free-tier-sign-in'
+import { $freeTierTurnCompleted, noteFreeTierTurnComplete } from '@/store/free-tier-sign-in'
import { setPrimaryGateway, setPrimaryGatewayConnectionId } from '@/store/gateway'
import { useHostedConnectors } from './queries'
@@ -80,3 +80,27 @@ describe('connector rules on the Connectors page', () => {
expect(request.mock.calls.filter(([name]) => name === 'connectors.accounts')).toHaveLength(2)
})
})
+
+// The backend arms the sign-in offer on the first list read that shows a guest an app connected
+// (an authorization past the watch, a connect by link). The page re-reads the offer timing then.
+describe('a connected app first seen on a list read', () => {
+ it('re-reads the sign-in offer timing', async () => {
+ gateway([{ ...row, connected: true }])
+ const before = $freeTierTurnCompleted.get()
+
+ mount()
+
+ await waitFor(() => expect($freeTierTurnCompleted.get()).toBe(before + 1))
+ })
+
+ it('does not when nothing is connected', async () => {
+ const request = gateway([row])
+ const before = $freeTierTurnCompleted.get()
+ const { result } = mount()
+
+ await waitFor(() => expect(result.current.phase).toBe('ready'))
+ await waitFor(() => expect(asked(request, 'connectors.policy.get')).toBe(true))
+
+ expect($freeTierTurnCompleted.get()).toBe(before)
+ })
+})
diff --git a/apps/desktop/src/app/capabilities/connectors/data/queries.ts b/apps/desktop/src/app/capabilities/connectors/data/queries.ts
index 0355e7c3f1a..7e0b694076e 100644
--- a/apps/desktop/src/app/capabilities/connectors/data/queries.ts
+++ b/apps/desktop/src/app/capabilities/connectors/data/queries.ts
@@ -7,7 +7,7 @@ import type { ProfileScope } from '@/hermes'
import { translateNow } from '@/i18n'
import { isMissingRpcMethod, isOutOfSyncRpcParams } from '@/lib/gateway-rpc'
import { queryClient } from '@/lib/query-client'
-import { $freeTierTurnCompleted } from '@/store/free-tier-sign-in'
+import { $freeTierTurnCompleted, noteFreeTierAppConnected } from '@/store/free-tier-sign-in'
import { notifyError } from '@/store/notifications'
import { hostedPhase } from '../derive'
@@ -117,6 +117,16 @@ export function useHostedConnectors(scope: ProfileScope): HostedConnectorsView {
[listed, scope]
)
+ // A list read is where the backend first sees an app this page never watched connect (an
+ // authorization past the watch, a connect by link) and arms the sign-in offer; re-read when it is due.
+ const anyConnected = list.data?.connectors.some(connector => connector.connected) ?? false
+
+ useEffect(() => {
+ if (anyConnected) {
+ noteFreeTierAppConnected()
+ }
+ }, [anyConnected])
+
const policy = useQuery({
...read('policy'),
enabled: listed,
diff --git a/apps/desktop/src/app/capabilities/connectors/hosted-notice.test.tsx b/apps/desktop/src/app/capabilities/connectors/hosted-notice.test.tsx
new file mode 100644
index 00000000000..b2827812cdf
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/connectors/hosted-notice.test.tsx
@@ -0,0 +1,22 @@
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { afterEach, describe, expect, it } from 'vitest'
+
+import { $freeTierSignIn } from '@/store/free-tier-sign-in'
+
+import { HostedNotice } from './hosted-notice'
+
+afterEach(() => {
+ cleanup()
+ $freeTierSignIn.set({ status: 'closed' })
+})
+
+describe('the Connectors line for a guest', () => {
+ it('offers a Sign in that starts the sign-in', () => {
+ render(<HostedNotice hasGuest phase="ready" />)
+
+ expect(screen.getByText('Connections stay on this computer until you sign in.')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Sign in' }))
+
+ expect($freeTierSignIn.get().status).toBe('requested')
+ })
+})
diff --git a/apps/desktop/src/app/capabilities/connectors/hosted-notice.tsx b/apps/desktop/src/app/capabilities/connectors/hosted-notice.tsx
index b86406283cc..f7ab438874b 100644
--- a/apps/desktop/src/app/capabilities/connectors/hosted-notice.tsx
+++ b/apps/desktop/src/app/capabilities/connectors/hosted-notice.tsx
@@ -4,24 +4,30 @@ import { openFreeTierSignIn } from '@/store/free-tier-sign-in'
import type { HostedPhase } from './types'
+function SignInNote({ text }: { text: string }) {
+ const { t } = useI18n()
+
+ return (
+ <p className="flex shrink-0 items-center gap-1 text-[0.7rem] text-(--ui-text-tertiary)">
+ {text}
+ <Button onClick={() => openFreeTierSignIn()} size="xs" variant="text">
+ {t.connectorsPage.page.signIn}
+ </Button>
+ </p>
+ )
+}
+
export function HostedNotice({ hasGuest, phase }: { hasGuest: boolean; phase: HostedPhase }) {
const { t } = useI18n()
const copy = t.connectorsPage.page
if (phase === 'signedOut') {
- return (
- <p className="flex shrink-0 items-center gap-1 text-[0.7rem] text-(--ui-text-tertiary)">
- {copy.signInLine}
- <Button onClick={() => openFreeTierSignIn()} size="xs" variant="text">
- {copy.signIn}
- </Button>
- </p>
- )
+ return <SignInNote text={copy.signInLine} />
}
if (phase === 'unavailable') {
return <p className="shrink-0 text-[0.7rem] text-(--ui-text-tertiary)">{copy.managedUnavailable}</p>
}
- return hasGuest ? <p className="shrink-0 text-[0.7rem] text-(--ui-text-tertiary)">{copy.freeTierNote}</p> : null
+ return hasGuest ? <SignInNote text={copy.freeTierNote} /> : null
}
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx
index c094fb8fdd6..65d4ffd8645 100644
--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx
+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx
@@ -430,6 +430,16 @@ describe('free-tier Sign in in every interface mode', () => {
expect($statusbarVisible.get()).toBe(false)
})
+ it('shows the chip to a guest with connected apps but no trial, without the free model', () => {
+ $freeTierStatus.set({ ...freeTier(false), has_guest: true })
+
+ const { leftStatusbarItems, statusbarItems } = renderStatusbarItems()
+ const chip = [...leftStatusbarItems, ...statusbarItems].find(item => item.id === 'free-tier')
+
+ expect(signInChipVisible()).toBe(true)
+ expect(chip?.title).toBe('Nous')
+ })
+
it('holds the chip while onboarding is open and brings it back after', () => {
$freeTierStatus.set(freeTier(true))
setOnboardingSurfaceActive('onboarding', true)
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
index afdc3283fed..20a6829c30e 100644
--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.tsx
@@ -525,9 +525,11 @@ export function useStatusbarItems({
// solid and set off by a gap instead of touching the label.
detail: (
<span className="inline-flex items-center gap-2">
- <span className="font-mono text-[0.625rem] text-muted-foreground/70">
- {freeTier?.model ?? FREE_TIER_MODEL}
- </span>
+ {freeTier?.available && (
+ <span className="font-mono text-[0.625rem] text-muted-foreground/70">
+ {freeTier.model || FREE_TIER_MODEL}
+ </span>
+ )}
{/* The class merger drops Badge's own leading-none behind the size's
font-size class, so the badge grows to the inherited 1.5 leading and
overhangs an 11px label. Restating it here keeps it 11.6px tall. */}
@@ -536,15 +538,15 @@ export function useStatusbarItems({
</Badge>
</span>
),
- // Shown while a free-tier identity exists and the tier is on: it names the
- // identity that carries the connectors (and inference when nothing else
- // does), and it is the persistent way in to the sign-in.
+ // Shown while a guest identity exists (the trial, or connected apps without
+ // it): it names the identity that carries the connectors (and inference on
+ // the trial), and it is the persistent way in to the sign-in.
hidden: !freeTierSignInOpen,
icon: <Codicon name="account" size="0.75rem" />,
id: 'free-tier',
label: freeTierCopy.providerName,
onSelect: () => openFreeTierSignIn(),
- title: freeTierCopy.statusLabel(freeTier?.model ?? FREE_TIER_MODEL),
+ title: freeTier?.available ? freeTierCopy.statusLabel(freeTier.model || FREE_TIER_MODEL) : freeTierCopy.providerName,
toggleLabel: copy.toggleFreeTier,
variant: 'action'
},
@@ -647,6 +649,7 @@ export function useStatusbarItems({
fileMenu.revealFileManager,
fileMenu.revealInSidebar,
offerLocalReveal,
+ freeTier?.available,
freeTier?.model,
freeTierSignInOpen,
gatewayMenuContent,
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 92b8a49d13a..37f59292daa 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -80,7 +80,7 @@ export const arOverrides = {
allApps: 'كل التطبيقات',
receiptConnected: apps => `متصلة: ${apps}`,
receiptNone: 'لم يتم ربط تطبيقات جديدة',
- receiptTimedOut: 'أُغلقت بعد 5 دقائق',
+ receiptTimedOut: 'أُغلقت بعد 10 دقائق',
finishInBrowser: 'أكمل في المتصفح',
signInFailed: 'تعذّر الاتصال. انقر لإعادة المحاولة'
}
diff --git a/apps/desktop/src/i18n/de_connector_card.ts b/apps/desktop/src/i18n/de_connector_card.ts
index 53f91599357..a0fe9e827fe 100644
--- a/apps/desktop/src/i18n/de_connector_card.ts
+++ b/apps/desktop/src/i18n/de_connector_card.ts
@@ -38,7 +38,7 @@ export const deConnectorCard: TranslationOverrides['connectors'] = {
allApps: 'Alle Apps',
receiptConnected: apps => `Verbunden: ${apps}`,
receiptNone: 'Keine neuen Apps verbunden',
- receiptTimedOut: 'Nach 5 Minuten geschlossen',
+ receiptTimedOut: 'Nach 10 Minuten geschlossen',
finishInBrowser: 'Im Browser abschließen',
signInFailed: 'Verbindung fehlgeschlagen. Zum Wiederholen klicken'
}
diff --git a/apps/desktop/src/i18n/en_connector_card.ts b/apps/desktop/src/i18n/en_connector_card.ts
index 95c3cfe6e3f..eedfae5a522 100644
--- a/apps/desktop/src/i18n/en_connector_card.ts
+++ b/apps/desktop/src/i18n/en_connector_card.ts
@@ -38,7 +38,7 @@ export const enConnectorCard: Translations['connectors'] = {
allApps: 'All apps',
receiptConnected: apps => `Connected: ${apps}`,
receiptNone: 'No new apps connected',
- receiptTimedOut: 'Closed after 5 minutes',
+ receiptTimedOut: 'Closed after 10 minutes',
finishInBrowser: 'Finish in your browser',
signInFailed: "Couldn't connect. Click to retry"
}
diff --git a/apps/desktop/src/i18n/es_connector_card.ts b/apps/desktop/src/i18n/es_connector_card.ts
index 730339c92ae..96b83724ac9 100644
--- a/apps/desktop/src/i18n/es_connector_card.ts
+++ b/apps/desktop/src/i18n/es_connector_card.ts
@@ -38,7 +38,7 @@ export const esConnectorCard: TranslationOverrides['connectors'] = {
allApps: 'Todas las apps',
receiptConnected: apps => `Conectadas: ${apps}`,
receiptNone: 'Ninguna app nueva conectada',
- receiptTimedOut: 'Cerrado tras 5 minutos',
+ receiptTimedOut: 'Cerrado tras 10 minutos',
finishInBrowser: 'Termina en tu navegador',
signInFailed: 'No se pudo conectar. Haz clic para reintentar'
}
diff --git a/apps/desktop/src/i18n/fr_connector_card.ts b/apps/desktop/src/i18n/fr_connector_card.ts
index d0a8112f653..1f0144cb425 100644
--- a/apps/desktop/src/i18n/fr_connector_card.ts
+++ b/apps/desktop/src/i18n/fr_connector_card.ts
@@ -38,7 +38,7 @@ export const frConnectorCard: TranslationOverrides['connectors'] = {
allApps: 'Toutes les apps',
receiptConnected: apps => `Connectées : ${apps}`,
receiptNone: 'Aucune nouvelle app connectée',
- receiptTimedOut: 'Fermé après 5 minutes',
+ receiptTimedOut: 'Fermé après 10 minutes',
finishInBrowser: 'Terminez dans votre navigateur',
signInFailed: 'Échec de la connexion. Cliquez pour réessayer'
}
diff --git a/apps/desktop/src/i18n/ja_connectors.ts b/apps/desktop/src/i18n/ja_connectors.ts
index 1fdd17a8336..c4defcaacf9 100644
--- a/apps/desktop/src/i18n/ja_connectors.ts
+++ b/apps/desktop/src/i18n/ja_connectors.ts
@@ -7,7 +7,7 @@ export const jaConnectors = {
allApps: 'すべてのアプリ',
receiptConnected: apps => `接続済み: ${apps}`,
receiptNone: '新しく接続したアプリはありません',
- receiptTimedOut: '5 分後に閉じました',
+ receiptTimedOut: '10 分後に閉じました',
finishInBrowser: 'ブラウザーで完了してください',
signInFailed: '接続できませんでした。クリックして再試行'
}
diff --git a/apps/desktop/src/i18n/ru_connectors.ts b/apps/desktop/src/i18n/ru_connectors.ts
index 6af28e6a533..7a252137ad4 100644
--- a/apps/desktop/src/i18n/ru_connectors.ts
+++ b/apps/desktop/src/i18n/ru_connectors.ts
@@ -7,7 +7,7 @@ export const ruConnectors = {
allApps: 'Все приложения',
receiptConnected: apps => `Подключены: ${apps}`,
receiptNone: 'Новые приложения не подключены',
- receiptTimedOut: 'Закрыто через 5 минут',
+ receiptTimedOut: 'Закрыто через 10 минут',
finishInBrowser: 'Завершите в браузере',
signInFailed: 'Не удалось подключиться. Нажмите, чтобы повторить'
}
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 20438602b95..8f4b6244942 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -81,7 +81,7 @@ export const zhHantOverrides = {
allApps: '全部應用程式',
receiptConnected: apps => `已連接:${apps}`,
receiptNone: '未連接新的應用程式',
- receiptTimedOut: '5 分鐘後已關閉',
+ receiptTimedOut: '10 分鐘後已關閉',
finishInBrowser: '請在瀏覽器中完成',
signInFailed: '連接失敗,點擊重試'
}
diff --git a/apps/desktop/src/i18n/zh_connector_card.ts b/apps/desktop/src/i18n/zh_connector_card.ts
index 34e7b70be22..e75b7330856 100644
--- a/apps/desktop/src/i18n/zh_connector_card.ts
+++ b/apps/desktop/src/i18n/zh_connector_card.ts
@@ -37,7 +37,7 @@ export const zhConnectorCard: TranslationOverrides['connectors'] = {
allApps: '全部应用',
receiptConnected: apps => `已连接:${apps}`,
receiptNone: '未连接新应用',
- receiptTimedOut: '5 分钟后已关闭',
+ receiptTimedOut: '10 分钟后已关闭',
finishInBrowser: '请在浏览器中完成',
signInFailed: '连接失败,点击重试'
}
diff --git a/apps/desktop/src/store/free-tier.ts b/apps/desktop/src/store/free-tier.ts
index 6ee7d17f2e5..c8a227ab8a1 100644
--- a/apps/desktop/src/store/free-tier.ts
+++ b/apps/desktop/src/store/free-tier.ts
@@ -25,14 +25,15 @@ export type FreeTierRequester = <T = unknown>(method: string, params?: Record<st
export const $freeTierStatus = atom<FreeTierStatus | null>(null)
/**
- * A signed-out free-tier user who should see the standing Sign in: the tier is
- * on with an identity (`available`; a sign-in replaces that identity, so it
- * reads false afterwards) and first-run onboarding does not own the
- * moment. The statusbar chip shows on it, and Simple mode keeps the statusbar up on it.
+ * A signed-out user who should see the standing Sign in: the free tier is on
+ * with an identity (`available`), or a guest identity holds connected apps
+ * without the trial (`has_guest`). A sign-in replaces the identity, so both read
+ * false afterwards. First-run onboarding must not own the moment. The statusbar
+ * chip shows on it, and Simple mode keeps the statusbar up on it.
*/
export const $freeTierSignInOpen = computed(
[$freeTierStatus, $onboardingSurfaceClear],
- (status, clear) => Boolean(status?.available) && clear
+ (status, clear) => Boolean(status?.available || status?.has_guest) && clear
)
// Fed here, beside the atom, so every importer of this store gets the same link.
diff --git a/tools/connectors/operation.py b/tools/connectors/operation.py
index 96849cf000d..90d100c7f13 100644
--- a/tools/connectors/operation.py
+++ b/tools/connectors/operation.py
@@ -15,7 +15,8 @@ from tools.connectors.contract import Actor, SettleReason, TargetState, allowed,
logger = logging.getLogger(__name__)
# Not a config key: a user-tunable wait with clamp rails was a foot-gun (PR1 shipped one, unmerged).
-OPERATION_DEADLINE_SECONDS = 300.0
+# As long as a connect link lives (10 minutes), so a slow authorization settles connected, not failed.
+OPERATION_DEADLINE_SECONDS = 600.0
class IllegalTransition(ValueError):