+ )
+ })
+}
+
+/** No second factor yet: why to add one, and Set up in browser (chevron: Copy link). */
+export const off = row({ kind: 'known', mfa: 'off', setupUrl })
+
+/** Enrolled: Manage in browser, for a new authenticator or the backup codes. */
+export const on = row({ kind: 'known', mfa: 'on', setupUrl })
+
+/** A narrow settings pane: the button wraps under the text. */
+export const offNarrow = row({ kind: 'known', mfa: 'off', setupUrl }, 420)
+
+/** The chevron's menu, open on Copy link. */
+export const copyLinkMenu = defineFixture({
+ width,
+ render: () => (
+
+
+
+ ),
+ interact: async (frame) => {
+ const chevron = frame.querySelector('button[aria-haspopup="menu"]')
+ chevron?.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0 }))
+ await new Promise((resolve) => setTimeout(resolve, 50))
+ }
+})
diff --git a/src/renderer/src/components/settings/accounts/orca/AccountMfaRow.tsx b/src/renderer/src/components/settings/accounts/orca/AccountMfaRow.tsx
new file mode 100644
index 00000000000..de9dc4f2b62
--- /dev/null
+++ b/src/renderer/src/components/settings/accounts/orca/AccountMfaRow.tsx
@@ -0,0 +1,72 @@
+import { ShieldCheck } from 'lucide-react'
+import { Badge } from '@/components/ui/badge'
+import { OpenExternalSplitButton } from '@/components/open-external/OpenExternalSplitButton'
+import { useTranslate } from '@/i18n/use-translate'
+import { useAccountMfa, type AccountMfaState } from './use-account-mfa'
+
+export type AccountMfaRowViewProps = {
+ state: AccountMfaState
+ onOpenSetup: () => void
+}
+
+/** One state of the row; renders nothing until the first status read answers. */
+export function AccountMfaRowView({
+ state,
+ onOpenSetup
+}: AccountMfaRowViewProps): React.JSX.Element | null {
+ const t = useTranslate()
+ if (state.kind === 'unknown') {
+ return null
+ }
+ const on = state.mfa === 'on'
+ return (
+
+ {on
+ ? t(
+ 'auto.components.settings.orcaAccount.mfa.onDescription',
+ 'Signing in asks for a code from your authenticator app. Keep your backup codes somewhere safe.'
+ )
+ : t(
+ 'auto.components.settings.orcaAccount.mfa.offDescription',
+ 'Add an authenticator app so a stolen password is not enough to sign in. You get backup codes too.'
+ )}
+
+
+ {/* Opens the account page in the browser; the chevron copies that link instead. */}
+
+ {on
+ ? t('auto.components.settings.orcaAccount.mfa.manage', 'Manage in browser')
+ : t('auto.components.settings.orcaAccount.mfa.setUp', 'Set up in browser')}
+
+
+ )
+}
+
+/**
+ * "Two-factor authentication" under the signed-in identity. Mount it only while signed in to Orca
+ * Cloud.
+ */
+export function AccountMfaRow(): React.JSX.Element | null {
+ const mfa = useAccountMfa()
+ return
+}
diff --git a/src/renderer/src/components/settings/accounts/orca/OrcaAccountSettingsPane.tsx b/src/renderer/src/components/settings/accounts/orca/OrcaAccountSettingsPane.tsx
index 723a7654bbd..d787c7cf87e 100644
--- a/src/renderer/src/components/settings/accounts/orca/OrcaAccountSettingsPane.tsx
+++ b/src/renderer/src/components/settings/accounts/orca/OrcaAccountSettingsPane.tsx
@@ -11,6 +11,7 @@ import { useAppStore } from '@/store/index'
import { OrcaProfileSignOutConfirmDialog } from '../../../orca-profiles/OrcaProfileSignOutConfirmDialog'
import { OrcaSignInButton, OrcaSignInWaitNotice } from '../../../OrcaSignInProgress'
import { useOrcaCloudApiAvailable } from '@/hooks/useOrcaCloudApiAvailability'
+import { AccountMfaRow } from './AccountMfaRow'
import { GitHubIdentityRow } from './GitHubIdentityRow'
function accountStatusCopy(
@@ -135,6 +136,9 @@ export function OrcaAccountSettingsPane(): React.JSX.Element {
{/* The person's own GitHub for cloud commits; only signed in to Orca Cloud. */}
{connected && cloudAvailable ? : null}
+ {/* Their own second factor: status, and a link to the account page that manages it. */}
+ {connected && cloudAvailable ? : null}
+
{/* JA-16: with Orca Cloud the page is identity + Sign out only; plan, team and agents have
their own entries in the Orca Cloud group right beside it. */}
{cloudAvailable ? null : (
diff --git a/src/renderer/src/components/settings/accounts/orca/use-account-mfa.ts b/src/renderer/src/components/settings/accounts/orca/use-account-mfa.ts
new file mode 100644
index 00000000000..574d74104b5
--- /dev/null
+++ b/src/renderer/src/components/settings/accounts/orca/use-account-mfa.ts
@@ -0,0 +1,89 @@
+import { useCallback, useEffect, useState } from 'react'
+import { installWindowVisibilityInterval } from '@/lib/window-activity/window-visibility-interval'
+import type { OrcaAccountMfa } from '../../../../../../shared/orca-account-mfa'
+
+/** Re-check every few seconds after the browser opened, for at most five minutes. */
+export const ACCOUNT_MFA_POLL_MS = 3_000
+export const ACCOUNT_MFA_WATCH_MAX_MS = 5 * 60_000
+
+export type AccountMfaState =
+ /** Not read yet, every read failed, or this deployment has no MFA status: the row is hidden. */
+ { kind: 'unknown' } | ({ kind: 'known' } & OrcaAccountMfa)
+
+export type AccountMfa = {
+ state: AccountMfaState
+ /** Opens the account's security page in the browser, then watches for the change. */
+ openSetup: () => void
+}
+
+/**
+ * The signed-in person's own two-factor state (mount only while signed in to Orca Cloud). Read on
+ * mount and when the window regains focus; polled lightly after the browser was opened, since the
+ * person enrols there and comes back.
+ */
+export function useAccountMfa(): AccountMfa {
+ const [state, setState] = useState({ kind: 'unknown' })
+ const [watching, setWatching] = useState<'on' | 'off' | null>(null)
+
+ const refresh = useCallback(async (): Promise => {
+ let result: Awaited> | null
+ try {
+ result = (await window.api.orcaProfiles.accountMfa()) ?? null
+ } catch {
+ result = null
+ }
+ // A failed read keeps what the row shows; the next focus or poll tries again.
+ if (result?.status === 'ok') {
+ setState({ kind: 'known', mfa: result.mfa, setupUrl: result.setupUrl })
+ }
+ }, [])
+
+ useEffect(() => {
+ void refresh()
+ const onFocus = (): void => void refresh()
+ const onVisibility = (): void => {
+ if (document.visibilityState === 'visible') {
+ void refresh()
+ }
+ }
+ window.addEventListener('focus', onFocus)
+ document.addEventListener('visibilitychange', onVisibility)
+ return () => {
+ window.removeEventListener('focus', onFocus)
+ document.removeEventListener('visibilitychange', onVisibility)
+ }
+ }, [refresh])
+
+ // Stop watching once the state differs from what it was when the browser opened.
+ const changed = watching !== null && state.kind === 'known' && state.mfa !== watching
+ useEffect(() => {
+ if (changed) {
+ setWatching(null)
+ }
+ }, [changed])
+
+ useEffect(() => {
+ if (watching === null) {
+ return
+ }
+ const stopPolling = installWindowVisibilityInterval({
+ run: () => void refresh(),
+ intervalMs: ACCOUNT_MFA_POLL_MS
+ })
+ const expire = setTimeout(() => setWatching(null), ACCOUNT_MFA_WATCH_MAX_MS)
+ return () => {
+ stopPolling()
+ clearTimeout(expire)
+ }
+ }, [watching, refresh])
+
+ const openSetup = useCallback((): void => {
+ if (state.kind !== 'known') {
+ return
+ }
+ void window.api.shell.openUrl(state.setupUrl)
+ setWatching(state.mfa)
+ }, [state])
+
+ return { state, openSetup }
+}
diff --git a/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.fixture.tsx b/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.fixture.tsx
index ad5d0d8ea23..ab2291b3601 100644
--- a/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.fixture.tsx
+++ b/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.fixture.tsx
@@ -199,7 +199,7 @@ function list(
initialMode={mode}
initialSaved={options.saved}
onSetUpAgent={noop}
- description="Only you get these, in every Orca Cloud workspace you start."
+ description="Only you get these, in cloud workspaces you haven’t shared. Shared workspaces don’t get them."
/>
)
diff --git a/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.tsx b/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.tsx
index ca4475202fd..70d236a775e 100644
--- a/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.tsx
+++ b/src/renderer/src/components/settings/cloud-secrets/CloudSecretsPane.tsx
@@ -201,8 +201,8 @@ export function CloudSecretsPane({
) : null
}
description={t(
- 'cloudSecrets.personal.description',
- 'Only you get these, in every Orca Cloud workspace you start.'
+ 'cloudSecrets.personal.descriptionUnshared',
+ 'Only you get these, in cloud workspaces you haven’t shared. Shared workspaces don’t get them.'
)}
emptyTitle={t('cloudSecrets.personal.emptyTitle', 'No personal secrets yet')}
emptyDetail={t(
diff --git a/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.test.tsx b/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.test.tsx
index bf72ac848ff..dc8eb4fa11a 100644
--- a/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.test.tsx
+++ b/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.test.tsx
@@ -222,8 +222,8 @@ describe('without the Enterprise plan', () => {
expect(contact).toHaveLength(1)
fireEvent.click(contact[0]!)
expect(onContactSales).toHaveBeenCalledWith('https://orca.dev/enterprise')
- // The Copy link chevron sits beside it (the open-in-browser rule).
- expect(screen.getAllByRole('button', { name: 'More link options' })).toHaveLength(1)
+ // Contact sales is not a sign-in page: a plain button, no Copy link chevron (AUTH-ONLY-COPY-LINK).
+ expect(screen.queryAllByRole('button', { name: 'More link options' })).toHaveLength(0)
})
it('a team missing only the audit log keeps the button on that block, with no banner', () => {
diff --git a/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.tsx b/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.tsx
index b6ce0ee72ea..b374191a542 100644
--- a/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.tsx
+++ b/src/renderer/src/components/settings/enterprise/EnterpriseSettingsView.tsx
@@ -9,7 +9,7 @@
// singleSignOn replaces the built-in single sign-on block (sso-scim)
// policies sign-in policies, e.g. "Require MFA" (mfa)
import { ExternalLink } from 'lucide-react'
-import { OpenExternalSplitButton } from '@/components/open-external/OpenExternalSplitButton'
+import { Button } from '@/components/ui/button'
import { useTranslate } from '@/i18n/use-translate'
import { SettingsGroup } from '../section-layout/SettingsGroup'
import { EnterpriseAuditLog, type EnterpriseAuditLogProps } from './EnterpriseAuditLog'
@@ -87,15 +87,15 @@ export function EnterpriseSettingsView({
)}
- onContactSales(contact.contactUrl)}
>
{t('settings.enterprise.contactUs', 'Contact us')}
-
+
) : banner ? (
{ssoUpsellBody}
diff --git a/src/renderer/src/components/settings/enterprise/EnterpriseUpsell.tsx b/src/renderer/src/components/settings/enterprise/EnterpriseUpsell.tsx
index 4f85dd14f16..879316bb517 100644
--- a/src/renderer/src/components/settings/enterprise/EnterpriseUpsell.tsx
+++ b/src/renderer/src/components/settings/enterprise/EnterpriseUpsell.tsx
@@ -1,7 +1,7 @@
// The one locked state for everything on Settings › Enterprise: what the feature is, that it is
-// part of Enterprise, and Contact sales. The button opens the page; its chevron copies the link.
+// part of Enterprise, and Contact sales. The button opens the page (Copy link is for sign-in pages only).
import { ExternalLink } from 'lucide-react'
-import { OpenExternalSplitButton } from '@/components/open-external/OpenExternalSplitButton'
+import { Button } from '@/components/ui/button'
import { useTranslate } from '@/i18n/use-translate'
/** Where Contact sales goes when billing has not answered yet (billing's own Enterprise page). */
@@ -29,15 +29,15 @@ export function EnterpriseUpsell({
{title}
{body}
- onContactSales(contact.contactUrl)}
>
{t('auto.components.billing.enterpriseContactSales', 'Contact sales')}
-
+
)
}
diff --git a/src/renderer/src/components/sidebar/index.tsx b/src/renderer/src/components/sidebar/index.tsx
index 829cc4890ad..5b22a0a219c 100644
--- a/src/renderer/src/components/sidebar/index.tsx
+++ b/src/renderer/src/components/sidebar/index.tsx
@@ -22,6 +22,7 @@ import { lazyWithRetry } from '@/app-shell/startup/lazy-with-retry'
import { LocalGitToolchainScanBanner } from './LocalGitToolchainScanBanner'
import { SeveredTerminalDaemonBanner } from './SeveredTerminalDaemonBanner'
import { StalledTerminalDaemonBanner } from './StalledTerminalDaemonBanner'
+import { TeamMfaSidebarBanner } from '@/components/team-mfa/TeamMfaAppBanner'
import { StartupWorktreeRefreshStatus } from './StartupWorktreeRefreshStatus'
// Load the shared Activity badge/list pipeline after the sidebar shell.
@@ -193,6 +194,7 @@ function Sidebar({
/>
+ : null}
>
diff --git a/src/renderer/src/components/sidebar/worktree-list/grouping/projectless-pending-row.test.ts b/src/renderer/src/components/sidebar/worktree-list/grouping/projectless-pending-row.test.ts
new file mode 100644
index 00000000000..b2bab1da297
--- /dev/null
+++ b/src/renderer/src/components/sidebar/worktree-list/grouping/projectless-pending-row.test.ts
@@ -0,0 +1,51 @@
+// GH-CREATE-NO-ROW: a create with no project here yet (a GitHub-only Orca Cloud create) has a
+// pending row atop the list when grouped by project, as in every other grouping; a create with a
+// project still sits atop its own project.
+import { describe, expect, it } from 'vitest'
+import { repo, worktree } from './worktree-list-groups-test-fixtures'
+import { buildRows } from './build-rows.test-fixture'
+
+function rows(groupBy: 'repo' | 'none', pending: { creationId: string; repoId: string }[]) {
+ return buildRows(
+ groupBy,
+ [{ ...worktree, lastActivityAt: 1 }],
+ new Map([[repo.id, repo]]),
+ null,
+ new Set(),
+ undefined,
+ undefined,
+ 'manual',
+ {},
+ undefined,
+ false,
+ undefined,
+ [],
+ new Set(),
+ new Map(),
+ new Map(),
+ pending
+ )
+}
+
+describe('pending row for a create with no project yet', () => {
+ it('by project: sits atop the list, before the first project header', () => {
+ const list = rows('repo', [{ creationId: 'gh-1', repoId: '' }])
+ expect(list[0]).toMatchObject({ type: 'pending-creation', creationId: 'gh-1' })
+ expect(list.filter((row) => row.type === 'pending-creation')).toHaveLength(1)
+ // No blank project header for it (it used to get one, keyed "repo:").
+ expect(list.filter((row) => row.type === 'header')).toHaveLength(1)
+ })
+
+ it('by project: a create with a project still sits atop that project only', () => {
+ const list = rows('repo', [{ creationId: 'local-1', repoId: repo.id }])
+ const header = list.findIndex((row) => row.type === 'header')
+ expect(header).toBeGreaterThanOrEqual(0)
+ expect(list.findIndex((row) => row.type === 'pending-creation')).toBeGreaterThan(header)
+ expect(list.filter((row) => row.type === 'pending-creation')).toHaveLength(1)
+ })
+
+ it('ungrouped: unchanged, every pending row on top', () => {
+ const list = rows('none', [{ creationId: 'gh-1', repoId: '' }])
+ expect(list[0]).toMatchObject({ type: 'pending-creation', creationId: 'gh-1' })
+ })
+})
diff --git a/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.refusal.test.tsx b/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.refusal.test.tsx
new file mode 100644
index 00000000000..7765689b53e
--- /dev/null
+++ b/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.refusal.test.tsx
@@ -0,0 +1,64 @@
+// @vitest-environment happy-dom
+// A cloud create's billing refusal is a precondition, not an error: its sidebar status reads in
+// muted text (the glyph carries the state); a real failure stays red.
+import { cleanup, render, screen } from '@testing-library/react'
+import { afterEach, describe, expect, it } from 'vitest'
+import { useAppStore } from '@/store'
+import { githubCreateRequest } from '@/lib/orca-cloud/start-cloud-workspace-from-github'
+import type { PendingWorktreeCreation } from '@/lib/workspace/creation/pending-worktree-creation'
+import { PendingWorktreeRow } from './PendingWorktreeRow'
+
+afterEach(cleanup)
+
+function failed(
+ errorCode: string | undefined,
+ log: string,
+ error: string
+): PendingWorktreeCreation {
+ return {
+ creationId: 'c',
+ phase: 'provisioning-vm',
+ status: 'error',
+ startedAt: 1,
+ indeterminate: false,
+ loaderVisible: true,
+ error,
+ ...(errorCode ? { errorCode } : {}),
+ provisioningLog: log,
+ request: githubCreateRequest({
+ repoUrl: 'https://github.com/acme/web',
+ fullName: 'acme/web',
+ prompt: 'Fix login',
+ agent: null
+ })
+ }
+}
+
+function statusLine(entry: PendingWorktreeCreation): HTMLElement {
+ useAppStore.setState({ pendingWorktreeCreations: { c: entry }, repos: [] })
+ render()
+ const line = screen.getByText('Fix login').nextElementSibling
+ if (!(line instanceof HTMLElement)) {
+ throw new Error('no status line')
+ }
+ return line
+}
+
+describe('pending row status colour', () => {
+ it('billing refusal: muted', () => {
+ const line = statusLine(
+ failed(
+ 'cloudPlanRequired',
+ '[orca-cloud] provisioning\nOrca Cloud: included_hours_exhausted',
+ 'Orca Cloud workspaces need a plan with cloud hours.'
+ )
+ )
+ expect(line.className).toContain('text-muted-foreground')
+ expect(line.className).not.toContain('text-destructive')
+ })
+
+ it('a real failure: red', () => {
+ const line = statusLine(failed(undefined, '[orca-cloud] provisioning', 'fetch failed'))
+ expect(line.className).toContain('text-destructive')
+ })
+})
diff --git a/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.tsx b/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.tsx
index ccc90ad092d..7dff544c420 100644
--- a/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.tsx
+++ b/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRow.tsx
@@ -10,6 +10,10 @@ import {
import { translate } from '@/i18n/i18n'
import { useTranslate, type Translate } from '@/i18n/use-translate'
import { vmBuildFailureSummary } from '@/components/worktree-creation/vm-build-failure-toast'
+import {
+ classifyVmBuildFailure,
+ isBillingFailure
+} from '@/components/worktree-creation/vm-build-failure'
import type { Repo } from '../../../../../../shared/repo-types'
function statusLabel(
@@ -67,6 +71,11 @@ export function PendingWorktreeRow({
const isError = entry.status === 'error'
const isOrcaCloud = entry.request.ephemeralVmRecipe?.provider === 'orca-cloud'
+ // A billing refusal is a precondition, not an error: muted text; the glyph carries the state.
+ const refused =
+ isError &&
+ isOrcaCloud &&
+ isBillingFailure(classifyVmBuildFailure({ entry, error: entry.error ?? null, cloud: true }))
return (
{statusLabel(entry, repos, t)}
diff --git a/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRowGitHub.fixture.tsx b/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRowGitHub.fixture.tsx
new file mode 100644
index 00000000000..38ef8a2cc50
--- /dev/null
+++ b/src/renderer/src/components/sidebar/worktree-list/rows/PendingWorktreeRowGitHub.fixture.tsx
@@ -0,0 +1,62 @@
+// GH-CREATE-NO-ROW: a GitHub-only Orca Cloud create has a sidebar row while it builds, atop the list
+// (it has no project here yet), with the cloud glyph from the start; the paired workspace's rows
+// replace it on hand-off.
+import { getDefaultSettings } from '../../../../../../shared/constants'
+import { defineFixture } from '../../../../component-fixtures/component-fixture'
+import { githubCreateRequest } from '@/lib/orca-cloud/start-cloud-workspace-from-github'
+import type { PendingWorktreeCreation } from '@/lib/workspace/creation/pending-worktree-creation'
+import { PendingWorktreeRow } from './PendingWorktreeRow'
+
+const T0 = 1_700_000_000_000
+
+function creation(
+ creationId: string,
+ patch: Partial = {}
+): PendingWorktreeCreation {
+ return {
+ creationId,
+ phase: 'provisioning-vm',
+ status: 'creating',
+ startedAt: T0,
+ indeterminate: false,
+ loaderVisible: true,
+ provisioningLog: '[orca-cloud] provisioning\n[orca-cloud] plan-clone',
+ provisioningLogStamps: [T0, T0 + 400],
+ request: githubCreateRequest({
+ repoUrl: 'https://github.com/nwparker/orca-sandbox-push-test',
+ fullName: 'nwparker/orca-sandbox-push-test',
+ prompt: 'Add a push test',
+ agent: 'claude',
+ composerRepoId: 'repo'
+ }),
+ ...patch
+ }
+}
+
+const rows = {
+ building: creation('building'),
+ opening: creation('opening', { phase: 'creating' }),
+ failed: creation('failed', {
+ status: 'error',
+ error: 'Orca Cloud workspaces need a plan with cloud hours.',
+ errorCode: 'cloudPlanRequired',
+ provisioningLog: '[orca-cloud] provisioning\nOrca Cloud: included_hours_exhausted'
+ })
+}
+
+/** The sidebar's top while three GitHub-only creates are in flight: building, opening, refused. */
+export const githubOnlyPendingRows = defineFixture({
+ width: 320,
+ store: {
+ settings: getDefaultSettings('/home/fixture'),
+ pendingWorktreeCreations: rows,
+ activePendingCreationId: 'building'
+ },
+ render: () => (
+
+ {active === null
+ ? t(
+ 'auto.components.teamMfa.rowOff',
+ 'Members without it lose access to this team’s workspaces after the date you pick, until they set it up. They get an email now and reminders before the date.'
+ )
+ : enforced
+ ? t(
+ 'auto.components.teamMfa.rowEnforced',
+ 'Required since {{value0}}. Members without it can’t use this team until they set it up.',
+ { value0: mfaDeadlineDate(active.enforceAt, locale) }
+ )
+ : t(
+ 'auto.components.teamMfa.rowScheduled',
+ 'Required from {{value0}}. {{value1}}.',
+ {
+ value0: mfaDeadlineDate(active.enforceAt, locale),
+ value1: mfaCountdownLabel(active.enforceAt, now, t)
+ }
+ )}
+
+ {t(
+ 'auto.components.teamMfa.nowWarning',
+ '{{count}} members don’t have it yet and will lose access to this team right away.',
+ {
+ count: pendingCount,
+ defaultValue_one:
+ '{{count}} member doesn’t have it yet and will lose access to this team right away.'
+ }
+ )}
+
+ ) : null}
+
+ {active !== null ? (
+
+
+
+ {pendingCount === 0
+ ? t('auto.components.teamMfa.allSet', 'Every member has it set up.')
+ : t('auto.components.teamMfa.pendingCount', '{{count}} members still need it', {
+ count: pendingCount,
+ defaultValue_one: '{{count}} member still needs it'
+ })}
+
+ {notice.emailed
+ ? t('auto.components.teamMfa.reminded', 'Reminder sent to {{count}} members.', {
+ count: notice.recipients,
+ defaultValue_one: 'Reminder sent to {{count}} member.'
+ })
+ : t(
+ 'auto.components.teamMfa.remindedNoEmail',
+ 'Reminder recorded, but email delivery is off on this server, so nothing was sent.'
+ )}
+
+ ) : null}
+
+ )
+}
diff --git a/src/renderer/src/components/team-mfa/TeamMfa.fixture.tsx b/src/renderer/src/components/team-mfa/TeamMfa.fixture.tsx
new file mode 100644
index 00000000000..ee234a16b22
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/TeamMfa.fixture.tsx
@@ -0,0 +1,176 @@
+import { defineFixture } from '../../component-fixtures/component-fixture'
+import type {
+ OrcaTeamMfaPendingMember,
+ OrcaTeamMfaPolicy
+} from '../../../../shared/orca-team-mfa-policy'
+import { CloudToastCard } from '@/components/orca-cloud/cloud-toast-stack'
+import { RequireMfaRow, type RequireMfaRowProps } from './RequireMfaRow'
+import { TeamMfaBanner } from './TeamMfaBanner'
+import { TeamMfaBlockedScreen } from './TeamMfaBlockedScreen'
+
+const NOW = Date.UTC(2026, 10, 18, 15)
+const DAY = 86_400_000
+const setupUrl = 'https://cloud.orca.dev/v1/account/security'
+const noop = (): void => {}
+const width = 760
+
+function frame(children: React.ReactNode, frameWidth = width) {
+ return defineFixture({
+ width: frameWidth,
+ render: () =>
+ )
+ })
+
+export const sidebarTwoWeeks = sidebar(14, 280)
+/** Three days or fewer: the warning look. */
+export const sidebarThreeDays = sidebar(3, 280)
+export const sidebarOneDay = sidebar(1, 280)
+/** After the deadline: no access until set up. */
+export const sidebarBlocked = sidebar(-2, 280)
+/** The narrowest sidebar. */
+export const sidebarBlockedNarrow = sidebar(-2, 220)
+
+// ---- The one-time toast, for people who keep the sidebar collapsed ----
+
+export const toast = frame(
+ ,
+ 420
+)
+
+// ---- Blocked screen: after the deadline ----
+
+const blocked = (props: { checking?: boolean; stillMissing?: boolean; personal?: boolean }) =>
+ frame(
+
+ )
+
+export const blockedScreen = blocked({})
+export const blockedChecking = blocked({ checking: true })
+/** "I've set it up" found no MFA yet. */
+export const blockedStillMissing = blocked({ stillMissing: true })
+
+// ---- Settings, Enterprise, Multi-factor authentication ----
+
+const pendingMembers: OrcaTeamMfaPendingMember[] = [
+ { userId: 'u-ada', email: 'ada@acme.dev', displayName: 'Ada Lovelace', mfa: 'pending' },
+ { userId: 'u-grace', email: 'grace@acme.dev', displayName: 'Grace Hopper', mfa: 'pending' },
+ { userId: null, email: 'linus@acme.dev', mfa: 'pending' }
+]
+
+const off: OrcaTeamMfaPolicy = {
+ policy: null,
+ self: 'on',
+ setupUrl,
+ manage: { available: true, pendingMembers: 3 }
+}
+const scheduled: OrcaTeamMfaPolicy = {
+ ...off,
+ policy: { enforceAt: NOW + 6 * DAY, setAt: NOW - 8 * DAY }
+}
+
+const row = (props: Partial) =>
+ frame(
+
+ )
+
+/** Not required yet: pick when, then Require MFA. */
+export const rowOff = row({})
+/** The admin has no MFA themselves: the change is held back until they add it. */
+export const rowAdminNeedsOwnMfa = row({ policy: { ...off, self: 'off' } })
+/** Scheduled: the date, the countdown, who is pending, and Remind. */
+export const rowScheduled = row({ policy: scheduled, pending: pendingMembers })
+/** Past the deadline: pending members have no access. */
+export const rowEnforced = row({
+ policy: { ...off, policy: { enforceAt: NOW - 2 * DAY, setAt: NOW - 16 * DAY } },
+ pending: pendingMembers.map((member) => ({ ...member, mfa: 'blocked' as const }))
+})
+export const rowEveryoneSet = row({
+ policy: { ...scheduled, manage: { available: true, pendingMembers: 0 } },
+ pending: []
+})
+export const rowSaving = row({ policy: scheduled, pending: pendingMembers, busy: true })
+export const rowReminded = row({
+ policy: scheduled,
+ pending: pendingMembers,
+ notice: { kind: 'reminded', recipients: 3, emailed: true }
+})
+/** The server is in log mode: say plainly that no email went out. */
+export const rowRemindedNoEmail = row({
+ policy: scheduled,
+ pending: pendingMembers,
+ notice: { kind: 'reminded', recipients: 3, emailed: false }
+})
+export const rowError = row({
+ policy: scheduled,
+ pending: pendingMembers,
+ notice: { kind: 'error', message: 'Couldn’t save the change. Try again.' }
+})
diff --git a/src/renderer/src/components/team-mfa/TeamMfaAppBanner.tsx b/src/renderer/src/components/team-mfa/TeamMfaAppBanner.tsx
new file mode 100644
index 00000000000..4d2a862bb06
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/TeamMfaAppBanner.tsx
@@ -0,0 +1,75 @@
+import { useEffect } from 'react'
+import { hideCloudToast, showCloudToast } from '@/components/orca-cloud/cloud-toast-stack'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
+import { claimMfaToast, mfaDeadlineDate } from './team-mfa-copy'
+import { useTeamMfaGate } from './TeamMfaGate'
+
+/**
+ * The MFA notice in the sidebar's banner stack, for the active team: a countdown while there is
+ * still time, and "no access until you set it up" after the deadline. Renders nothing for a
+ * personal account, a team with no policy, or a member who already has MFA, which is almost
+ * everyone.
+ *
+ * The sidebar can be collapsed, so this is a reminder, not the enforcement surface: a refused
+ * team resource shows TeamMfaRefused in its own place whether or not the sidebar is visible.
+ */
+export function TeamMfaSidebarBanner(): React.JSX.Element | null {
+ const gate = useTeamMfaGate()
+ const t = useTranslate()
+ const locale = useIntlLocale()
+ const toast = gate.pendingToast
+ const orgId = toast?.orgId
+ const enforceAt = toast?.enforceAt
+ // One toast per team and deadline, for people who keep the sidebar collapsed. Not tied to any
+ // workspace, so it shows wherever they are; the sidebar card stays as the lasting reminder.
+ useEffect(() => {
+ if (!toast || orgId === undefined || enforceAt === undefined) {
+ return
+ }
+ if (!claimMfaToast(readLocalStorage(), orgId, enforceAt)) {
+ return
+ }
+ const id = `team-mfa:${orgId}`
+ showCloudToast(id, {
+ priority: 'action',
+ lines: [
+ {
+ key: 'mfa',
+ text: t('auto.components.teamMfa.toast', '{{value0}} requires MFA from {{value1}}.', {
+ value0: toast.teamName,
+ value1: mfaDeadlineDate(enforceAt, locale)
+ }),
+ action: {
+ label: t('auto.components.teamMfa.setUp', 'Set up MFA'),
+ primary: true,
+ // A plain button: toasts no longer carry a Copy link chevron (AUTH-ONLY-COPY-LINK).
+ // The sidebar card and Settings, Account keep the split button.
+ onClick: () => {
+ void window.api.shell.openUrl(toast.setupUrl)
+ hideCloudToast(id)
+ }
+ }
+ }
+ ]
+ })
+ // Deliberately keyed on the team and deadline only: copy or locale changes must not re-show.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [orgId, enforceAt])
+ return gate.sidebarBanner
+}
+
+function readLocalStorage(): Storage | null {
+ try {
+ return window.localStorage
+ } catch {
+ return null
+ }
+}
+
+/**
+ * In place of a team resource the server refused with `mfa_required`: the setup screen, or (when
+ * the policy cannot be read to fill it in) nothing, so the caller's own error copy shows.
+ */
+export function TeamMfaRefused(): React.JSX.Element | null {
+ return useTeamMfaGate({ forceBlocked: true }).blocked
+}
diff --git a/src/renderer/src/components/team-mfa/TeamMfaBanner.tsx b/src/renderer/src/components/team-mfa/TeamMfaBanner.tsx
new file mode 100644
index 00000000000..6f57b82ef1a
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/TeamMfaBanner.tsx
@@ -0,0 +1,125 @@
+import { ShieldAlert } from 'lucide-react'
+import { InlineError } from '@/components/ui/inline-error'
+import { cn } from '@/lib/class-names'
+import { OpenExternalSplitButton } from '@/components/open-external/OpenExternalSplitButton'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
+import { BANNER_BODY_TEXT, BANNER_TONE } from '@/components/ui/banner-tone'
+import { mfaCountdownLabel, mfaDeadlineDate, mfaSoonTitle, mfaUrgency } from './team-mfa-copy'
+
+export type TeamMfaBannerProps = {
+ teamName: string
+ /** Epoch ms from which the team is closed to members without MFA. */
+ enforceAt: number
+ now: number
+ setupUrl: string
+ onSetUp: () => void
+ /** The deadline has passed and the team is closed to this person until they set MFA up. */
+ blocked?: boolean
+ /** `sidebar`: the narrow stacked layout of the sidebar's banner stack. */
+ variant?: 'inline' | 'sidebar'
+ className?: string
+}
+
+/**
+ * Shown to a member whose team requires MFA and who has none yet, until the deadline: how long
+ * is left and the way to set it up. After the deadline the blocked screen takes over.
+ */
+export function TeamMfaBanner({
+ teamName,
+ enforceAt,
+ now,
+ setupUrl,
+ onSetUp,
+ blocked = false,
+ variant = 'inline',
+ className
+}: TeamMfaBannerProps): React.JSX.Element {
+ const t = useTranslate()
+ const locale = useIntlLocale()
+ const urgency = mfaUrgency(enforceAt, now, blocked)
+ const title =
+ urgency === 'soon'
+ ? mfaSoonTitle(teamName, enforceAt, now, t)
+ : blocked
+ ? t(
+ 'auto.components.teamMfa.bannerBlockedTitle',
+ '{{value0}} requires two-factor authentication',
+ { value0: teamName }
+ )
+ : t(
+ 'auto.components.teamMfa.bannerTitle',
+ '{{value0}} requires two-factor authentication. {{value1}}.',
+ { value0: teamName, value1: mfaCountdownLabel(enforceAt, now, t) }
+ )
+ const detail = blocked
+ ? t(
+ 'auto.components.teamMfa.bannerBlockedBody',
+ 'You can’t use this team’s workspaces until you set it up. Your personal account isn’t affected.'
+ )
+ : t(
+ 'auto.components.teamMfa.bannerBody',
+ 'Set it up by {{value0}}. After that you can’t use this team’s workspaces until you do.',
+ { value0: mfaDeadlineDate(enforceAt, locale) }
+ )
+ const action = (
+
+ {t('auto.components.teamMfa.setUp', 'Set up MFA')}
+
+ )
+ if (variant === 'sidebar') {
+ // Same shape as the other banners in the sidebar stack (StalledTerminalDaemonBanner): the
+ // column is narrow, so the action sits under the text.
+ return (
+
+
+
+
+
{title}
+
+ {detail}
+
+ {action}
+
+
+
+ )
+ }
+ return (
+
+ )
+}
diff --git a/src/renderer/src/components/team-mfa/TeamMfaBlockedScreen.tsx b/src/renderer/src/components/team-mfa/TeamMfaBlockedScreen.tsx
new file mode 100644
index 00000000000..f89665070ec
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/TeamMfaBlockedScreen.tsx
@@ -0,0 +1,93 @@
+import { Loader2, ShieldAlert } from 'lucide-react'
+import { Button } from '@/components/ui/button'
+import { OpenExternalSplitButton } from '@/components/open-external/OpenExternalSplitButton'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
+import { mfaDeadlineDate } from './team-mfa-copy'
+
+export type TeamMfaBlockedScreenProps = {
+ teamName: string
+ enforceAt: number
+ setupUrl: string
+ /** A re-check is running (after "I've set it up", or on returning from the browser). */
+ checking: boolean
+ /** The last re-check still found no MFA. */
+ stillMissing: boolean
+ onSetUp: () => void
+ onRecheck: () => void
+ /** Switch to the personal account, which the team's policy does not affect. */
+ onUsePersonal?: () => void
+}
+
+/**
+ * In place of a team's content once its MFA deadline has passed for a member without MFA: what
+ * happened, the one thing to do, and a way to keep working outside the team meanwhile.
+ */
+export function TeamMfaBlockedScreen({
+ teamName,
+ enforceAt,
+ setupUrl,
+ checking,
+ stillMissing,
+ onSetUp,
+ onRecheck,
+ onUsePersonal
+}: TeamMfaBlockedScreenProps): React.JSX.Element {
+ const t = useTranslate()
+ const locale = useIntlLocale()
+ return (
+
+
+
+
+
+
+ {t(
+ 'auto.components.teamMfa.blockedTitle',
+ 'Set up two-factor authentication to use {{value0}}',
+ { value0: teamName }
+ )}
+
+
+ {t(
+ 'auto.components.teamMfa.blockedBody',
+ '{{value0}} has required it for all members since {{value1}}. Your workspaces and files are safe, and open again as soon as you add an authenticator app.',
+ { value0: teamName, value1: mfaDeadlineDate(enforceAt, locale) }
+ )}
+
+
+
+
+ {t('auto.components.teamMfa.setUp', 'Set up MFA')}
+
+ {
+ if (!checking) {
+ onRecheck()
+ }
+ }}
+ >
+ {checking ? : null}
+ {t('auto.components.teamMfa.recheck', 'I’ve set it up')}
+
+
+
+ {stillMissing && !checking
+ ? t(
+ 'auto.components.teamMfa.stillMissing',
+ 'Your account still has no two-factor authentication. Finish the setup in your browser, then try again.'
+ )
+ : null}
+
+ {onUsePersonal ? (
+
+ {t('auto.components.teamMfa.usePersonal', 'Use my personal account for now')}
+
+ ) : null}
+
+ )
+}
diff --git a/src/renderer/src/components/team-mfa/TeamMfaGate.tsx b/src/renderer/src/components/team-mfa/TeamMfaGate.tsx
new file mode 100644
index 00000000000..b7cdf9657ef
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/TeamMfaGate.tsx
@@ -0,0 +1,90 @@
+import { useState } from 'react'
+import { useAppStore } from '@/store'
+import { TeamMfaBanner } from './TeamMfaBanner'
+import { TeamMfaBlockedScreen } from './TeamMfaBlockedScreen'
+import { teamMfaSurface } from './team-mfa-copy'
+import { useTeamMfaPolicy } from './use-team-mfa-policy'
+
+/**
+ * The active team's MFA requirement, for a surface that shows the team's cloud content.
+ *
+ * - `banner`: render above the content while the member still has time.
+ * - `blocked`: render in place of the content once the server refused the team's resources.
+ * `forceBlocked` is that refusal (`mfa_required`); the policy read alone also blocks when the
+ * server says so, so the screen shows without waiting for a failed request.
+ *
+ * Renders nothing for a personal account, a team with no policy, a member who has MFA, or a
+ * server without the policy API.
+ */
+export function useTeamMfaGate(options: { forceBlocked?: boolean } = {}): {
+ banner: React.JSX.Element | null
+ blocked: React.JSX.Element | null
+ /** The sidebar notice: the countdown, or "no access" once blocked. */
+ sidebarBanner: React.JSX.Element | null
+ /** Set while the member still has time: what the one-time toast needs. */
+ pendingToast: { orgId: string; teamName: string; enforceAt: number; setupUrl: string } | null
+} {
+ const cloud = useAppStore((state) => state.orcaProfileAuthStatus?.cloud)
+ const selectOrg = useAppStore((state) => state.selectOrcaProfileOrg)
+ const orgId = cloud?.activeOrgId ?? null
+ const teamName = cloud?.activeOrgName ?? ''
+ const { policy, checking, refresh } = useTeamMfaPolicy(orgId)
+ const [now] = useState(() => Date.now())
+ const [stillMissing, setStillMissing] = useState(false)
+
+ if (!orgId || !policy?.policy) {
+ return { banner: null, blocked: null, sidebarBanner: null, pendingToast: null }
+ }
+ const surface = teamMfaSurface(policy)
+ const openSetup = (): void => {
+ void window.api.shell.openUrl(policy.setupUrl)
+ }
+
+ // The server's refusal wins over a policy read that has not caught up, unless that read now
+ // says the member has MFA (they just set it up; the next request will go through).
+ const isBlocked = surface === 'blocked' || (options.forceBlocked === true && policy.self !== 'on')
+ const line = (blocked: boolean, variant: 'inline' | 'sidebar' = 'inline'): React.JSX.Element => (
+
+ )
+ if (isBlocked) {
+ return {
+ banner: null,
+ sidebarBanner: line(true, 'sidebar'),
+ pendingToast: null,
+ blocked: (
+ {
+ void refresh().then((next) => {
+ // Null: the read failed; say nothing rather than claim MFA is still missing.
+ setStillMissing(next !== null && next.self !== 'on')
+ })
+ }}
+ onUsePersonal={() => void selectOrg(null)}
+ />
+ )
+ }
+ }
+ const pending = surface === 'banner'
+ return {
+ banner: pending ? line(false) : null,
+ sidebarBanner: pending ? line(false, 'sidebar') : null,
+ pendingToast: pending
+ ? { orgId, teamName, enforceAt: policy.policy.enforceAt, setupUrl: policy.setupUrl }
+ : null,
+ blocked: null
+ }
+}
diff --git a/src/renderer/src/components/team-mfa/team-mfa-copy.ts b/src/renderer/src/components/team-mfa/team-mfa-copy.ts
new file mode 100644
index 00000000000..f5cc4296d33
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/team-mfa-copy.ts
@@ -0,0 +1,121 @@
+// Copy and small rules shared by the MFA banner, the blocked screen and the Enterprise row. Pure,
+// so the views and their tests agree on every boundary.
+import type { Translate } from '@/i18n/use-translate'
+import type { OrcaTeamMfaGrace, OrcaTeamMfaPolicy } from '../../../../shared/orca-team-mfa-policy'
+
+const DAY_MS = 24 * 60 * 60 * 1000
+
+/** Whole days left, rounded up; 0 once the deadline has passed. Matches the server and the emails. */
+export function mfaDaysLeft(enforceAt: number, now: number): number {
+ return Math.max(0, Math.ceil((enforceAt - now) / DAY_MS))
+}
+
+/**
+ * What the person should see for this team:
+ * - `banner`: the team requires MFA, they have none, and there is still time.
+ * - `blocked`: the deadline passed; the team is closed to them until they set it up.
+ * - `none`: nothing to show (no policy, they have MFA, or their state is unknown).
+ * Only the server's `blocked` blocks: the desktop never decides that from the clock.
+ */
+export function teamMfaSurface(policy: OrcaTeamMfaPolicy | null): 'none' | 'banner' | 'blocked' {
+ if (!policy?.policy) {
+ return 'none'
+ }
+ if (policy.self === 'blocked') {
+ return 'blocked'
+ }
+ return policy.self === 'pending' ? 'banner' : 'none'
+}
+
+/** From this many days before the deadline the notice stops being quiet (design-squad). */
+export const MFA_URGENT_DAYS = 3
+
+/**
+ * How loud the notice is: quiet with more than three days left, a warning in the last three,
+ * and blocked only on the server's word (never from the clock).
+ */
+export type TeamMfaUrgency = 'quiet' | 'soon' | 'blocked'
+
+export function mfaUrgency(enforceAt: number, now: number, blocked: boolean): TeamMfaUrgency {
+ if (blocked) {
+ return 'blocked'
+ }
+ return mfaDaysLeft(enforceAt, now) <= MFA_URGENT_DAYS ? 'soon' : 'quiet'
+}
+
+/** "Acme requires MFA in 2 days": the title once the deadline is close. */
+export function mfaSoonTitle(
+ teamName: string,
+ enforceAt: number,
+ now: number,
+ t: Translate
+): string {
+ const days = mfaDaysLeft(enforceAt, now)
+ if (days <= 0) {
+ return t('auto.components.teamMfa.soonTitleNow', '{{value0}} requires MFA now', {
+ value0: teamName
+ })
+ }
+ return t('auto.components.teamMfa.soonTitle', '{{value0}} requires MFA in {{count}} days', {
+ value0: teamName,
+ count: days,
+ defaultValue_one: '{{value0}} requires MFA in {{count}} day'
+ })
+}
+
+/**
+ * The one-time toast is shown once per team and deadline, so a changed date announces itself
+ * again and a restart does not repeat it.
+ */
+export function mfaToastSeenKey(orgId: string, enforceAt: number): string {
+ return `orca.teamMfa.toastSeen:${orgId}:${enforceAt}`
+}
+
+/** True the first time for a deadline; records it. A storage failure shows it rather than hide it. */
+export function claimMfaToast(
+ storage: Pick | null,
+ orgId: string,
+ enforceAt: number
+): boolean {
+ const key = mfaToastSeenKey(orgId, enforceAt)
+ try {
+ if (storage?.getItem(key) === '1') {
+ return false
+ }
+ storage?.setItem(key, '1')
+ } catch {
+ // Private mode or a full quota: showing it again next launch is the lesser problem.
+ }
+ return true
+}
+
+/** "6 days left", "1 day left", "Due now". i18next plurals, never ternaries on the count. */
+export function mfaCountdownLabel(enforceAt: number, now: number, t: Translate): string {
+ const days = mfaDaysLeft(enforceAt, now)
+ if (days <= 0) {
+ return t('auto.components.teamMfa.dueNow', 'Due now')
+ }
+ return t('auto.components.teamMfa.daysLeft', '{{count}} days left', {
+ count: days,
+ defaultValue_one: '{{count}} day left'
+ })
+}
+
+export function mfaDeadlineDate(enforceAt: number, locale: string): string {
+ return new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric', year: 'numeric' }).format(
+ enforceAt
+ )
+}
+
+export function mfaGraceLabel(grace: OrcaTeamMfaGrace, t: Translate): string {
+ switch (grace) {
+ case 'now':
+ return t('auto.components.teamMfa.graceNow', 'Immediately')
+ case 7:
+ return t('auto.components.teamMfa.grace7', 'In 7 days')
+ case 14:
+ return t('auto.components.teamMfa.grace14', 'In 14 days')
+ case 30:
+ return t('auto.components.teamMfa.grace30', 'In 30 days')
+ }
+}
diff --git a/src/renderer/src/components/team-mfa/team-mfa.test.tsx b/src/renderer/src/components/team-mfa/team-mfa.test.tsx
new file mode 100644
index 00000000000..34bc8f81f65
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/team-mfa.test.tsx
@@ -0,0 +1,317 @@
+// @vitest-environment happy-dom
+import { cleanup, fireEvent, render } from '@testing-library/react'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { translate } from '@/i18n/i18n'
+import type { OrcaTeamMfaPolicy } from '../../../../shared/orca-team-mfa-policy'
+import { RequireMfaRow, type RequireMfaRowProps } from './RequireMfaRow'
+import { TeamMfaBanner } from './TeamMfaBanner'
+import { TeamMfaBlockedScreen } from './TeamMfaBlockedScreen'
+import {
+ claimMfaToast,
+ mfaCountdownLabel,
+ mfaDaysLeft,
+ mfaSoonTitle,
+ mfaUrgency,
+ teamMfaSurface
+} from './team-mfa-copy'
+import { describeError, describeInlineError } from '../cloud-workspaces/cloud-workspace-errors'
+
+afterEach(cleanup)
+
+const DAY = 86_400_000
+const NOW = Date.UTC(2026, 10, 18, 15)
+const setupUrl = 'https://cloud.orca.dev/v1/account/security'
+
+const policy = (over: Partial = {}): OrcaTeamMfaPolicy => ({
+ policy: { enforceAt: NOW + 6 * DAY, setAt: NOW - DAY },
+ self: 'pending',
+ setupUrl,
+ ...over
+})
+
+describe('countdown', () => {
+ it('rounds up to whole days and stops at zero', () => {
+ expect(mfaDaysLeft(NOW + 7 * DAY, NOW)).toBe(7)
+ expect(mfaDaysLeft(NOW + 6 * DAY + 1, NOW)).toBe(7)
+ expect(mfaDaysLeft(NOW + DAY / 2, NOW)).toBe(1)
+ expect(mfaDaysLeft(NOW, NOW)).toBe(0)
+ expect(mfaDaysLeft(NOW - DAY, NOW)).toBe(0)
+ })
+
+ it('reads as days left, one day left, then due now', () => {
+ expect(mfaCountdownLabel(NOW + 6 * DAY, NOW, translate)).toBe('6 days left')
+ expect(mfaCountdownLabel(NOW + DAY, NOW, translate)).toBe('1 day left')
+ expect(mfaCountdownLabel(NOW, NOW, translate)).toBe('Due now')
+ })
+})
+
+describe('what the member sees', () => {
+ it('is the banner while pending and the blocked screen only on the server’s word', () => {
+ expect(teamMfaSurface(policy())).toBe('banner')
+ expect(teamMfaSurface(policy({ self: 'blocked' }))).toBe('blocked')
+ // Past the deadline by the local clock, but the server still says pending: not blocked.
+ expect(teamMfaSurface(policy({ policy: { enforceAt: NOW - DAY, setAt: NOW - 8 * DAY } }))).toBe(
+ 'banner'
+ )
+ })
+
+ it('is nothing with MFA on, an unknown state, or no policy', () => {
+ expect(teamMfaSurface(policy({ self: 'on' }))).toBe('none')
+ expect(teamMfaSurface(policy({ self: 'unknown' }))).toBe('none')
+ expect(teamMfaSurface(policy({ policy: null, self: 'off' }))).toBe('none')
+ expect(teamMfaSurface(policy({ policy: null, self: 'blocked' }))).toBe('none')
+ expect(teamMfaSurface(null)).toBe('none')
+ })
+})
+
+describe('banner', () => {
+ it('names the team, the countdown and the date, and offers the setup action', () => {
+ const onSetUp = vi.fn()
+ const { container, getByRole } = render(
+
+ )
+ expect(container.textContent).toContain('Acme requires two-factor authentication. 6 days left.')
+ expect(container.textContent).toContain('November 24, 2026')
+ fireEvent.click(getByRole('button', { name: 'Set up MFA' }))
+ expect(onSetUp).toHaveBeenCalledTimes(1)
+ })
+})
+
+describe('blocked screen', () => {
+ const screen = (props: { checking?: boolean; stillMissing?: boolean } = {}) => {
+ const handlers = { onSetUp: vi.fn(), onRecheck: vi.fn(), onUsePersonal: vi.fn() }
+ const view = render(
+
+ )
+ return { ...view, ...handlers }
+ }
+
+ it('says what to do, not a generic error, and keeps the personal account reachable', () => {
+ const view = screen()
+ expect(view.container.textContent).toContain('Set up two-factor authentication to use Acme')
+ expect(view.container.textContent).toContain('Your workspaces and files are safe')
+ fireEvent.click(view.getByRole('button', { name: 'Set up MFA' }))
+ fireEvent.click(view.getByRole('button', { name: 'I’ve set it up' }))
+ fireEvent.click(view.getByRole('button', { name: 'Use my personal account for now' }))
+ expect(view.onSetUp).toHaveBeenCalledTimes(1)
+ expect(view.onRecheck).toHaveBeenCalledTimes(1)
+ expect(view.onUsePersonal).toHaveBeenCalledTimes(1)
+ })
+
+ it('ignores a second re-check while one runs, and says when MFA is still missing', () => {
+ const checking = screen({ checking: true })
+ fireEvent.click(checking.getByRole('button', { name: 'I’ve set it up' }))
+ expect(checking.onRecheck).not.toHaveBeenCalled()
+ cleanup()
+ expect(screen({ stillMissing: true }).container.textContent).toContain(
+ 'Your account still has no two-factor authentication'
+ )
+ })
+})
+
+describe('Require MFA row', () => {
+ const manage = { available: true, pendingMembers: 2 }
+ const row = (props: Partial = {}) => {
+ const handlers = {
+ onRequire: vi.fn(),
+ onTurnOff: vi.fn(),
+ onRemind: vi.fn(),
+ onSetUpOwn: vi.fn()
+ }
+ const view = render(
+
+ )
+ return { ...view, ...handlers }
+ }
+
+ it('requires MFA with the chosen grace period, 14 days by default', () => {
+ const view = row()
+ fireEvent.click(view.getByRole('button', { name: 'Require MFA' }))
+ expect(view.onRequire).toHaveBeenCalledWith(14)
+ })
+
+ it('holds the change back from an admin without MFA, and points them to setup', () => {
+ const view = row({ policy: policy({ policy: null, self: 'off', manage }) })
+ fireEvent.click(view.getByRole('button', { name: 'Require MFA' }))
+ expect(view.onRequire).not.toHaveBeenCalled()
+ expect(view.container.textContent).toContain(
+ 'Set up two-factor authentication on your own account first'
+ )
+ fireEvent.click(view.getByRole('button', { name: 'Set up MFA' }))
+ expect(view.onSetUpOwn).toHaveBeenCalledTimes(1)
+ })
+
+ it('holds turning it off back from an admin without MFA too', () => {
+ const view = row({ policy: policy({ self: 'pending', manage }) })
+ fireEvent.click(view.getByRole('button', { name: 'Stop requiring' }))
+ expect(view.onTurnOff).not.toHaveBeenCalled()
+ })
+
+ it('shows the date, who is pending, and reminds everyone or one member', () => {
+ const view = row({
+ policy: policy({ self: 'on', manage }),
+ pending: [
+ { userId: 'u-ada', email: 'ada@acme.dev', displayName: 'Ada Lovelace', mfa: 'pending' },
+ { userId: null, email: 'linus@acme.dev', mfa: 'pending' }
+ ]
+ })
+ expect(view.container.textContent).toContain('Required from November 24, 2026. 6 days left.')
+ expect(view.container.textContent).toContain('2 members still need it')
+ fireEvent.click(view.getByRole('button', { name: 'Remind everyone' }))
+ expect(view.onRemind).toHaveBeenLastCalledWith()
+ // A member who never signed in to Orca has no id to remind by; only Ada gets a button.
+ const single = view.getAllByRole('button', { name: 'Remind' })
+ expect(single).toHaveLength(1)
+ fireEvent.click(single[0]!)
+ expect(view.onRemind).toHaveBeenLastCalledWith('u-ada')
+ })
+
+ it('says members have no access once the deadline passed', () => {
+ const view = row({
+ policy: policy({
+ self: 'on',
+ manage,
+ policy: { enforceAt: NOW - DAY, setAt: NOW - 8 * DAY }
+ }),
+ pending: [{ userId: 'u-ada', email: 'ada@acme.dev', mfa: 'blocked' }]
+ })
+ expect(view.container.textContent).toContain('Required since November 17, 2026')
+ expect(view.container.textContent).toContain('No access')
+ })
+
+ it('says plainly when a reminder was recorded but not emailed', () => {
+ const view = row({
+ policy: policy({ self: 'on', manage }),
+ notice: { kind: 'reminded', recipients: 2, emailed: false }
+ })
+ expect(view.container.textContent).toContain('nothing was sent')
+ expect(view.container.textContent).not.toContain('Reminder sent')
+ })
+})
+
+describe('the server refusal in cloud workspace errors', () => {
+ it('says to set up MFA, never to sign in again', () => {
+ for (const explain of [describeError, describeInlineError]) {
+ const message = explain('unauthorized', 'mfa_required', translate)
+ expect(message).toContain('requires two-factor authentication')
+ expect(message).not.toMatch(/sign in/i)
+ }
+ // Any other unauthorized answer is still the sign-in message.
+ expect(describeInlineError('unauthorized', undefined, translate)).not.toContain('two-factor')
+ })
+})
+
+describe('banner after the deadline', () => {
+ it('says there is no access until MFA is set up, and that the personal account is fine', () => {
+ const { container, getByRole } = render(
+ {}}
+ blocked
+ variant="sidebar"
+ />
+ )
+ // An alert once blocked; a quiet status while there is still time.
+ expect(container.querySelector('[data-team-mfa-banner="blocked"]')?.getAttribute('role')).toBe(
+ 'alert'
+ )
+ expect(container.textContent).toContain('Acme requires two-factor authentication')
+ expect(container.textContent).toContain('until you set it up')
+ expect(container.textContent).toContain('Your personal account isn’t affected')
+ expect(container.textContent).not.toContain('days left')
+ expect(getByRole('button', { name: 'Set up MFA' })).toBeTruthy()
+ })
+})
+
+describe('escalation', () => {
+ it('is quiet with more than three days left, a warning in the last three, blocked on the server', () => {
+ expect(mfaUrgency(NOW + 14 * DAY, NOW, false)).toBe('quiet')
+ expect(mfaUrgency(NOW + 3 * DAY + 1, NOW, false)).toBe('quiet')
+ expect(mfaUrgency(NOW + 3 * DAY, NOW, false)).toBe('soon')
+ expect(mfaUrgency(NOW + DAY, NOW, false)).toBe('soon')
+ // Past the deadline by the clock but not blocked by the server: still only a warning.
+ expect(mfaUrgency(NOW - DAY, NOW, false)).toBe('soon')
+ expect(mfaUrgency(NOW + 14 * DAY, NOW, true)).toBe('blocked')
+ })
+
+ it('names the days in the title once it is close', () => {
+ expect(mfaSoonTitle('Acme', NOW + 2 * DAY, NOW, translate)).toBe('Acme requires MFA in 2 days')
+ expect(mfaSoonTitle('Acme', NOW + DAY, NOW, translate)).toBe('Acme requires MFA in 1 day')
+ expect(mfaSoonTitle('Acme', NOW - 1, NOW, translate)).toBe('Acme requires MFA now')
+ })
+
+ it('marks the sidebar card with its urgency', () => {
+ const card = (daysLeft: number, blocked = false): string | null | undefined =>
+ render(
+ {}}
+ blocked={blocked}
+ />
+ )
+ .container.querySelector('[data-team-mfa-banner]')
+ ?.getAttribute('data-team-mfa-banner')
+ expect(card(14)).toBe('quiet')
+ cleanup()
+ expect(card(2)).toBe('soon')
+ cleanup()
+ expect(card(-2, true)).toBe('blocked')
+ })
+})
+
+describe('one-time toast', () => {
+ const memory = (): Pick => {
+ const map = new Map()
+ return {
+ getItem: (key) => map.get(key) ?? null,
+ setItem: (key, value) => void map.set(key, value)
+ }
+ }
+
+ it('shows once per team and deadline, and again when the date changes', () => {
+ const storage = memory()
+ expect(claimMfaToast(storage, 'org_1', 100)).toBe(true)
+ expect(claimMfaToast(storage, 'org_1', 100)).toBe(false)
+ expect(claimMfaToast(storage, 'org_1', 200)).toBe(true)
+ expect(claimMfaToast(storage, 'org_2', 100)).toBe(true)
+ })
+
+ it('shows rather than hides when storage is unavailable', () => {
+ expect(claimMfaToast(null, 'org_1', 100)).toBe(true)
+ const broken = {
+ getItem: () => {
+ throw new Error('denied')
+ },
+ setItem: () => {}
+ }
+ expect(claimMfaToast(broken, 'org_1', 100)).toBe(true)
+ })
+})
diff --git a/src/renderer/src/components/team-mfa/use-team-mfa-policy.ts b/src/renderer/src/components/team-mfa/use-team-mfa-policy.ts
new file mode 100644
index 00000000000..3b162b77502
--- /dev/null
+++ b/src/renderer/src/components/team-mfa/use-team-mfa-policy.ts
@@ -0,0 +1,70 @@
+import { useCallback, useEffect, useRef, useState } from 'react'
+import type { OrcaTeamMfaPolicy } from '../../../../shared/orca-team-mfa-policy'
+
+export type TeamMfaPolicyState = {
+ /** Null until a read answers, when signed out of a team, or when the server has no policy API. */
+ policy: OrcaTeamMfaPolicy | null
+ /** A read is running. */
+ checking: boolean
+ /** Re-reads now; resolves with what the server said (null when it could not be read). */
+ refresh: () => Promise
+}
+
+/**
+ * The active team's "require MFA" policy and the person's own state in it. Read when the team
+ * changes and when the window regains focus: the person sets MFA up in the browser and comes back.
+ * A failed read keeps the last answer, so a flaky network neither hides the banner nor blocks.
+ */
+export function useTeamMfaPolicy(orgId: string | null): TeamMfaPolicyState {
+ const [policy, setPolicy] = useState(null)
+ const [checking, setChecking] = useState(false)
+ // Answers for a team the person has since switched away from are dropped.
+ const current = useRef(orgId)
+ current.current = orgId
+
+ const refresh = useCallback(async (): Promise => {
+ if (!orgId) {
+ return null
+ }
+ setChecking(true)
+ let result: Awaited> | null
+ try {
+ result = (await window.api.orcaProfiles.teamMfaPolicy({ orgId })) ?? null
+ } catch {
+ result = null
+ }
+ if (current.current !== orgId) {
+ return null
+ }
+ setChecking(false)
+ if (result?.status !== 'ok') {
+ return null
+ }
+ const { status: _status, ...next } = result
+ setPolicy(next)
+ return next
+ }, [orgId])
+
+ useEffect(() => {
+ setPolicy(null)
+ setChecking(false)
+ if (!orgId) {
+ return
+ }
+ void refresh()
+ const onFocus = (): void => void refresh()
+ const onVisibility = (): void => {
+ if (document.visibilityState === 'visible') {
+ void refresh()
+ }
+ }
+ window.addEventListener('focus', onFocus)
+ document.addEventListener('visibilitychange', onVisibility)
+ return () => {
+ window.removeEventListener('focus', onFocus)
+ document.removeEventListener('visibilitychange', onVisibility)
+ }
+ }, [orgId, refresh])
+
+ return { policy, checking, refresh }
+}
diff --git a/src/renderer/src/components/worktree-creation/VmBuildFailureActions.copy-links.test.tsx b/src/renderer/src/components/worktree-creation/VmBuildFailureActions.copy-links.test.tsx
deleted file mode 100644
index 11c26b6d3af..00000000000
--- a/src/renderer/src/components/worktree-creation/VmBuildFailureActions.copy-links.test.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-// @vitest-environment happy-dom
-// COPY-LINK-RULE on the build sheet: "How to push to GitHub" is a split button whose chevron copies
-// GitHub's guide; "Contact support" lives in the More menu, so a "Copy support link" item sits
-// right below it.
-import { cleanup, render, screen, waitFor } from '@testing-library/react'
-import userEvent from '@testing-library/user-event'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-
-const toast = vi.hoisted(() => ({ success: vi.fn(), error: vi.fn() }))
-vi.mock('sonner', () => ({ toast }))
-
-import { TooltipProvider } from '@/components/ui/tooltip'
-import { FailureActionRow, type VmBuildFailureActions } from './VmBuildFailureActions'
-import type { VmBuildFailure } from './vm-build-failure'
-import { ORCA_SUPPORT_URL, PUSH_TO_GITHUB_URL } from './vm-build-repo-actions'
-import { translate } from '@/i18n/i18n'
-
-const writeClipboardText = vi.fn<(text: string) => Promise>()
-
-beforeEach(() => {
- writeClipboardText.mockReset().mockResolvedValue(undefined)
- Object.assign(window, { api: { ...window.api, ui: { writeClipboardText } } })
-})
-afterEach(cleanup)
-
-const actions = (): VmBuildFailureActions => ({
- onFixWithAgent: vi.fn(),
- onRetry: vi.fn(),
- onEditRecipe: vi.fn(),
- onOpenAnyway: vi.fn(),
- onStartAgain: vi.fn(),
- onDismiss: vi.fn(),
- onSeePlans: vi.fn(),
- onOpenBilling: vi.fn(),
- onCreateLocally: vi.fn(),
- onSignIn: vi.fn(),
- onShowWorkspaces: vi.fn(),
- onContactSupport: vi.fn(),
- onConnectGitHub: vi.fn(),
- onPushToGitHub: vi.fn()
-})
-
-function row(failure: VmBuildFailure, handlers: VmBuildFailureActions) {
- return render(
-
-
-
- )
-}
-
-describe('build sheet external links (COPY-LINK-RULE)', () => {
- it('"How to push to GitHub" opens as before, and its chevron copies the guide without opening', async () => {
- const handlers = actions()
- row({ kind: 'noGithubRemote' }, handlers)
- const user = userEvent.setup()
- await user.click(screen.getByRole('button', { name: 'How to push to GitHub' }))
- expect(handlers.onPushToGitHub).toHaveBeenCalledOnce()
- expect(writeClipboardText).not.toHaveBeenCalled()
-
- await user.click(screen.getByRole('button', { name: 'More link options' }))
- await user.click(await screen.findByRole('menuitem', { name: 'Copy link' }))
- await waitFor(() => expect(writeClipboardText).toHaveBeenCalledWith(PUSH_TO_GITHUB_URL))
- expect(handlers.onPushToGitHub).toHaveBeenCalledOnce()
- })
-
- it('"Copy support link" sits right below "Contact support" and copies without opening', async () => {
- const handlers = actions()
- row({ kind: 'snapshotMissing' }, handlers)
- const user = userEvent.setup()
- await user.click(screen.getByRole('button', { name: /More/ }))
- const items = (await screen.findAllByRole('menuitem')).map((item) => item.textContent)
- expect(items).toEqual(['Contact support', 'Copy support link'])
- await user.click(screen.getByRole('menuitem', { name: 'Copy support link' }))
- await waitFor(() => expect(writeClipboardText).toHaveBeenCalledWith(ORCA_SUPPORT_URL))
- expect(handlers.onContactSupport).not.toHaveBeenCalled()
- })
-})
diff --git a/src/renderer/src/components/worktree-creation/VmBuildFailureActions.tsx b/src/renderer/src/components/worktree-creation/VmBuildFailureActions.tsx
index ebcdb906b98..5c9b7e92704 100644
--- a/src/renderer/src/components/worktree-creation/VmBuildFailureActions.tsx
+++ b/src/renderer/src/components/worktree-creation/VmBuildFailureActions.tsx
@@ -7,7 +7,6 @@ import {
Github,
Loader2,
LifeBuoy,
- Link2,
LogIn,
Monitor,
PanelLeft,
@@ -23,13 +22,6 @@ import {
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
import type { Translate } from '@/i18n/use-translate'
-import { OpenExternalSplitButton } from '@/components/open-external/OpenExternalSplitButton'
-import {
- copyExternalLink,
- type ExternalLinkSource
-} from '@/components/open-external/copy-external-link'
-import { ORCA_SUPPORT_URL, PUSH_TO_GITHUB_URL } from './vm-build-repo-actions'
-import { gitHubInstallLinkSource } from '@/lib/orca-cloud/github-link-sources'
import type { VmBuildFailure } from './vm-build-failure'
import { cloneFailedActions, type CloneAccessHandlers } from './clone-access-actions'
@@ -66,8 +58,6 @@ type Action = {
pending?: boolean
/** Outline even when first: a way around the problem, not its fix. */
secondary?: boolean
- /** Opens this page in the browser: a chevron beside it offers "Copy link". */
- link?: ExternalLinkSource
/** A More-menu row that leaves Orca for the browser: marked like the Help menu's. */
external?: boolean
}
@@ -245,17 +235,6 @@ function failureActions(
icon: ,
onClick: actions.onContactSupport,
external: true
- },
- // A menu row can't carry the split's chevron: the same page, copied for another browser
- // (COPY-LINK-RULE, as "Copy GitHub link" under "Add a GitHub repository…").
- {
- key: 'copySupportLink',
- label: t(
- 'auto.components.worktree.creation.VmBuildFailureCard.copySupportLink',
- 'Copy support link'
- ),
- icon: ,
- onClick: () => void copyExternalLink(ORCA_SUPPORT_URL)
}
]
}
@@ -275,9 +254,7 @@ function failureActions(
),
icon: connectingGitHub ? : ,
onClick: actions.onConnectGitHub,
- pending: connectingGitHub,
- // The same install page connectOrcaCloudGitHub opens (no repository preselected).
- link: gitHubInstallLinkSource()
+ pending: connectingGitHub
},
tryAgain
],
@@ -293,8 +270,7 @@ function failureActions(
'How to push to GitHub'
),
icon: ,
- onClick: actions.onPushToGitHub,
- link: PUSH_TO_GITHUB_URL
+ onClick: actions.onPushToGitHub
},
// After pushing, the same create works without leaving the sheet.
tryAgain
@@ -345,37 +321,21 @@ export function FailureActionRow({
const destroys = vmKept
return (
- {primary.map((action, index) =>
- action.link ? (
- (action.pending ? undefined : action.onClick())}
- disabled={action.disabled}
- aria-disabled={action.pending || undefined}
- aria-busy={action.pending || undefined}
- >
- {action.icon}
- {action.label}
-
- ) : (
-
- {action.icon}
- {action.label}
-
- )
- )}
+ {primary.map((action, index) => (
+
+ {action.icon}
+ {action.label}
+
+ ))}
{more.length > 0 ? (
diff --git a/src/renderer/src/components/worktree-creation/VmBuildSheetCopyLinks.fixture.tsx b/src/renderer/src/components/worktree-creation/VmBuildSheetCopyLinks.fixture.tsx
deleted file mode 100644
index dbf931dff20..00000000000
--- a/src/renderer/src/components/worktree-creation/VmBuildSheetCopyLinks.fixture.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-// COPY-LINK-RULE on the build sheet: "How to push to GitHub" as a split button (its chevron menu
-// open), and "Copy support link" right below "Contact support" in the More menu.
-import { defineFixture } from '../../component-fixtures/component-fixture'
-import {
- CLOUD_RECIPE,
- FAILED_LOG,
- T0,
- entry,
- seedFixtureRepo,
- sheet
-} from './vm-build-sheet-fixture-support'
-
-const settle = (): Promise => new Promise((resolve) => setTimeout(resolve, 120))
-
-// Radix menus open on pointerdown, not click.
-function openMenu(selector: string) {
- return async (frame: HTMLElement): Promise => {
- frame
- .querySelector(selector)
- ?.dispatchEvent(
- new PointerEvent('pointerdown', { bubbles: true, button: 0, pointerType: 'mouse' })
- )
- await settle()
- }
-}
-
-function failed(errorCode: string, error: string, log: string) {
- return {
- value: entry(
- { status: 'error', errorCode, provisioningLog: log, errorAt: T0 + 2_000 },
- CLOUD_RECIPE
- ),
- error
- }
-}
-
-const noRemote = failed(
- 'cloudNoGithubRemote',
- 'Orca Cloud clones your code from GitHub, and this repository has no GitHub remote.',
- ''
-)
-const snapshot = failed('recipeExited', 'Recipe exited with code 1.', FAILED_LOG)
-
-/** "How to push to GitHub" with its chevron open: Copy link. */
-export const pushToGitHubCopyLink = defineFixture({
- width: 760,
- setup: () => seedFixtureRepo(null),
- render: () => sheet(noRemote.value, noRemote.error, T0 + 2_000),
- interact: openMenu('button[aria-label="More link options"]')
-})
-
-/** "Contact support" in More, with "Copy support link" right below it. */
-export const contactSupportCopyLink = defineFixture({
- width: 760,
- setup: () => seedFixtureRepo(),
- render: () => sheet(snapshot.value, snapshot.error, T0 + 2_000),
- interact: openMenu('[data-vm-build-sheet] button[aria-haspopup="menu"]')
-})
diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json
index c8cdcaf698d..bf4e4552086 100644
--- a/src/renderer/src/i18n/en-runtime-required.json
+++ b/src/renderer/src/i18n/en-runtime-required.json
@@ -242,18 +242,10 @@
"blockedWorkspaces_one": "{{count}} cloud workspace still exists. Delete it first.",
"blockedWorkspaces_other": "{{count}} cloud workspaces still exist. Delete them first."
},
- "inviteSeatAddsMonth_one": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seat ({{price}}/mo, prorated) will be added.",
- "inviteSeatAddsMonth_other": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seats ({{price}}/mo, prorated) will be added.",
- "inviteSeatAddsUnpriced_one": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seat will be added, prorated.",
- "inviteSeatAddsUnpriced_other": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seats will be added, prorated.",
- "inviteSeatAddsYear_one": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seat ({{price}}/yr, prorated) will be added.",
- "inviteSeatAddsYear_other": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seats ({{price}}/yr, prorated) will be added.",
"invitedCount_one": "{{count}} invited",
"invitedCount_other": "{{count}} invited",
"memberCount_one": "{{count}} member",
"memberCount_other": "{{count}} members",
- "openSeatsClause_one": "You have {{count}} open seat",
- "openSeatsClause_other": "You have {{count}} open seats",
"seatCount_one": "{{count}} seat",
"seatCount_other": "{{count}} seats",
"sendInvites_one": "Send {{count}} invite",
@@ -1370,6 +1362,18 @@
"unavailableCount_one": "{{count}} unavailable",
"unavailableCount_other": "{{count}} unavailable"
},
+ "teamMfa": {
+ "daysLeft_one": "{{count}} day left",
+ "daysLeft_other": "{{count}} days left",
+ "nowWarning_one": "{{count}} member doesn’t have it yet and will lose access to this team right away.",
+ "nowWarning_other": "{{count}} members don’t have it yet and will lose access to this team right away.",
+ "pendingCount_one": "{{count}} member still needs it",
+ "pendingCount_other": "{{count}} members still need it",
+ "reminded_one": "Reminder sent to {{count}} member.",
+ "reminded_other": "Reminder sent to {{count}} members.",
+ "soonTitle_one": "{{value0}} requires MFA in {{count}} day",
+ "soonTitle_other": "{{value0}} requires MFA in {{count}} days"
+ },
"teammates": {
"daySandboxHours_one": "{{hours}} sandbox hour",
"daySandboxHours_other": "{{hours}} sandbox hours"
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index fb0c78f0b1a..3ec565adf7d 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -4714,8 +4714,7 @@
"trialLimitBodyCount_other": "Your trial can run {{count}} sandboxes at once. Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.",
"teamLimitBodyNoSeatCount_one": "Your team can run {{count}} sandbox at once. Put it to sleep or delete it, then try again. Nothing was created, and you weren’t charged.",
"teamLimitBodyNoSeatCount_other": "Your team can run {{count}} sandboxes at once. Put one to sleep or delete it, then try again. Nothing was created, and you weren’t charged.",
- "trialLimitTitle": "You’re at your trial’s limit of running sandboxes",
- "copySupportLink": "Copy support link"
+ "trialLimitTitle": "You’re at your trial’s limit of running sandboxes"
},
"VmBuildLog": {
"jumpToError": "Jump to first error",
@@ -14079,6 +14078,15 @@
"keywordSignOut": "sign out",
"keywordRelay": "relay",
"keywordCloud": "cloud",
+ "mfa": {
+ "title": "Two-factor authentication",
+ "on": "On",
+ "off": "Off",
+ "onDescription": "Signing in asks for a code from your authenticator app. Keep your backup codes somewhere safe.",
+ "offDescription": "Add an authenticator app so a stolen password is not enough to sign in. You get backup codes too.",
+ "manage": "Manage in browser",
+ "setUp": "Set up in browser"
+ },
"github": {
"disconnectTitle": "Disconnect GitHub?",
"disconnectBody": "Commits in cloud workspaces will use Orca Cloud's name again.",
@@ -21254,7 +21262,6 @@
"dismiss": "Dismiss",
"enterEmail": "Enter a teammate’s email",
"inviteLabel": "Invite teammates",
- "inviteNoPlan": "Invites are free. Seats are billed once your team picks a plan.",
"invitePlaceholder2": "alex@company.com, sam@company.com",
"inviteSentBody": "They join, and take a seat, when they accept.",
"inviteSentMany": "{{value0}} invites sent",
@@ -21274,6 +21281,10 @@
"makeOwnerTitle": "Make {{value0}} an owner?",
"members": "Members",
"membersList": "Team members and invites",
+ "mfaOn": "MFA on",
+ "mfaOff": "MFA off",
+ "mfaPending": "MFA pending",
+ "mfaPendingBy": "MFA due {{value0}}",
"nextInvoice": "Next invoice (est.)",
"nextInvoiceOn": "{{value0}} · {{value1}}",
"notAnEmail": "Not an email address",
@@ -21310,7 +21321,6 @@
"createdNotSwitched": "{{value0}} was created, but Orca couldn’t switch to it.",
"invitedCount_one": "{{count}} invited",
"invitedCount_other": "{{count}} invited",
- "invitePaymentFailed2": "New seats are charged once the failed payment is fixed.",
"memberCount_one": "{{count}} member",
"memberCount_other": "{{count}} members",
"seatCount_one": "{{count}} seat",
@@ -21351,22 +21361,10 @@
"deletedToast2": "{{value0}} was deleted"
},
"leaveLastOwnerOrDelete": "You’re the only owner. Make someone else an owner first, or delete the team.",
- "planBillingLink": "Plan & billing",
"perSeat": "Per seat",
"perSeatMonthValue": "{{value0}}/mo",
"seatRulesShort": "New members above your paid seats are charged now, prorated. Removed seats stay paid until renewal.",
- "openSeatsNone": "You have no open seats",
- "openSeatsClause_one": "You have {{count}} open seat",
- "openSeatsClause_other": "You have {{count}} open seats",
- "inviteSeatUnknown": "Each invite uses a seat once accepted.",
- "inviteSeatOpen": "Each invite uses a seat once accepted. {{openSeats}}.",
- "inviteSeatCovered": "Each invite uses a seat once accepted. {{openSeats}}, so no seats will be added.",
- "inviteSeatAddsUnpriced_one": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seat will be added, prorated.",
- "inviteSeatAddsUnpriced_other": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seats will be added, prorated.",
- "inviteSeatAddsYear_one": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seat ({{price}}/yr, prorated) will be added.",
- "inviteSeatAddsYear_other": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seats ({{price}}/yr, prorated) will be added.",
- "inviteSeatAddsMonth_one": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seat ({{price}}/mo, prorated) will be added.",
- "inviteSeatAddsMonth_other": "Each invite uses a seat once accepted. {{openSeats}}, so {{count}} more seats ({{price}}/mo, prorated) will be added."
+ "inviteSeatRule": "Each invite uses a seat once accepted."
},
"manageBilling": "Manage billing",
"comparePlans": "Compare plans",
@@ -21709,7 +21707,8 @@
"errorTrialSandboxLimit_one": "Your trial can run {{count}} sandbox at once. Put it to sleep or delete it, then try again.",
"errorTrialSandboxLimit_other": "Your trial can run {{count}} sandboxes at once. Put one to sleep or delete it, then try again.",
"errorTeamSandboxLimitNoSeat_one": "Your team can run {{count}} sandbox at once. Put it to sleep or delete it, then try again.",
- "errorTeamSandboxLimitNoSeat_other": "Your team can run {{count}} sandboxes at once. Put one to sleep or delete it, then try again."
+ "errorTeamSandboxLimitNoSeat_other": "Your team can run {{count}} sandboxes at once. Put one to sleep or delete it, then try again.",
+ "sharedPersonalSecretsNote": "Your personal cloud secrets aren’t used in shared workspaces. Shared and repository secrets still are."
},
"orcaCloud": {
"QueuedPrompt": {
@@ -21786,6 +21785,52 @@
},
"NewWorkspaceComposerFooter": {
"create": "Create"
+ },
+ "teamMfa": {
+ "dueNow": "Due now",
+ "daysLeft_one": "{{count}} day left",
+ "daysLeft_other": "{{count}} days left",
+ "graceNow": "Immediately",
+ "grace7": "In 7 days",
+ "grace14": "In 14 days",
+ "grace30": "In 30 days",
+ "bannerTitle": "{{value0}} requires two-factor authentication. {{value1}}.",
+ "bannerBody": "Set it up by {{value0}}. After that you can’t use this team’s workspaces until you do.",
+ "bannerBlockedTitle": "{{value0}} requires two-factor authentication",
+ "soonTitleNow": "{{value0}} requires MFA now",
+ "soonTitle_one": "{{value0}} requires MFA in {{count}} day",
+ "soonTitle_other": "{{value0}} requires MFA in {{count}} days",
+ "toast": "{{value0}} requires MFA from {{value1}}.",
+ "bannerBlockedBody": "You can’t use this team’s workspaces until you set it up. Your personal account isn’t affected.",
+ "setUp": "Set up MFA",
+ "blockedTitle": "Set up two-factor authentication to use {{value0}}",
+ "blockedBody": "{{value0}} has required it for all members since {{value1}}. Your workspaces and files are safe, and open again as soon as you add an authenticator app.",
+ "recheck": "I’ve set it up",
+ "stillMissing": "Your account still has no two-factor authentication. Finish the setup in your browser, then try again.",
+ "usePersonal": "Use my personal account for now",
+ "rowTitle": "Require two-factor authentication",
+ "rowOff": "Members without it lose access to this team’s workspaces after the date you pick, until they set it up. They get an email now and reminders before the date.",
+ "rowEnforced": "Required since {{value0}}. Members without it can’t use this team until they set it up.",
+ "rowScheduled": "Required from {{value0}}. {{value1}}.",
+ "graceLabel": "When to start requiring it",
+ "require": "Require MFA",
+ "turnOff": "Stop requiring",
+ "ownMfaTitle": "Set up two-factor authentication on your own account first",
+ "ownMfaBody": "Only someone who already has it can change this, so nobody locks the team out.",
+ "nowWarning_one": "{{count}} member doesn’t have it yet and will lose access to this team right away.",
+ "nowWarning_other": "{{count}} members don’t have it yet and will lose access to this team right away.",
+ "allSet": "Every member has it set up.",
+ "pendingCount_one": "{{count}} member still needs it",
+ "pendingCount_other": "{{count}} members still need it",
+ "remindAll": "Remind everyone",
+ "pendingList": "Members without MFA",
+ "memberBlocked": "No access",
+ "memberPending": "Pending",
+ "remindOne": "Remind",
+ "reminded_one": "Reminder sent to {{count}} member.",
+ "reminded_other": "Reminder sent to {{count}} members.",
+ "remindedNoEmail": "Reminder recorded, but email delivery is off on this server, so nothing was sent.",
+ "requiredInline": "Your team requires two-factor authentication. Set it up in Settings, Account to use its cloud workspaces."
}
},
"i18n": {
@@ -24028,7 +24073,6 @@
"privateLabel": "Private",
"menuGroup": "Orca Cloud",
"addRepositoryMenu": "Add a GitHub repository…",
- "copyAddRepositoryLink": "Copy GitHub link",
"waitingForGitHubAccess": "Waiting for GitHub access…",
"noNewRepositoryYet": "No new repository yet.",
"checkAgain": "Check again",
@@ -28167,9 +28211,9 @@
},
"setUpAgent": "Set up an agent",
"personal": {
- "description": "Only you get these, in every Orca Cloud workspace you start.",
"emptyTitle": "No personal secrets yet",
- "emptyDetail": "Add one or paste a .env file. New terminals and agents in your cloud workspaces get them as environment variables."
+ "emptyDetail": "Add one or paste a .env file. New terminals and agents in your cloud workspaces get them as environment variables.",
+ "descriptionUnshared": "Only you get these, in cloud workspaces you haven’t shared. Shared workspaces don’t get them."
},
"org": {
"description": "Everyone on your team gets these in their Orca Cloud workspaces.",
@@ -28403,6 +28447,9 @@
"setUpNotStarted": "{{agent}} is set up. Open the workspace to start it.",
"notStartedRow": "{{agent}} hasn’t started"
},
+ "chatSend": {
+ "renewAbove": "Renew {{agent}} sign-in above to send"
+ },
"chatSignIn": {
"renewAbove": "Your {{agent}} sign-in for Orca Cloud didn’t work. Renew it above, then send your message again."
},
@@ -28676,7 +28723,8 @@
"codeLabel": "Code from claude.ai",
"deviceStep": "Enter this code on auth.openai.com. The sign-in is saved on {{host}}.",
"codePlaceholder": "Paste the code"
- }
+ },
+ "recipeEnvNarrowed": "This recipe's create script gets only the variables its passEnv allows."
},
"cloudSecretsAsk": {
"scopeLabel": "Scope for {{name}}",
@@ -29004,6 +29052,10 @@
"nothingNeedsAttention": "Nothing needs attention."
},
"agentSignInStrip": {
+ "renewInSettings": "Renew in Settings",
+ "finishRenewing": "Finish renewing",
+ "expiredHeldDetail": "Renew to start {{agent}}.",
+ "expiredHeldAnnounce": "Your {{agent}} sign-in expired. Renew to start {{agent}}.",
"rowNeedsSignIn": "Needs sign-in",
"rowNeedsSignInTooltip": "Set up once for Orca Cloud",
"rowExpired": "Sign-in expired",
@@ -29023,9 +29075,7 @@
"useMySignIn": "Use my {{agent}} sign-in",
"signIn": "Sign in",
"expired": "Your {{agent}} sign-in expired",
- "expiredDetail": "Sign in once to fix every workspace.",
"renew": "Renew",
- "expiredAnnounce": "Your {{agent}} sign-in expired. Renew it once to fix every workspace.",
"waiting": "Approve on {{site}}",
"openAgain": "Open again",
"waitingAnnounce": "Waiting for you to approve in your browser.",
diff --git a/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.test.ts b/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.test.ts
index 3fc90b01ee6..53edf0cd0b2 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.test.ts
+++ b/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.test.ts
@@ -79,16 +79,35 @@ describe('cloud agent launch hold', () => {
expect(cloudAgentLaunchNeedsHold('claude')).toBe(true)
})
- it('holds an expired launch until Renew fixes the account, then every held pane goes', async () => {
+ it('CHAT-RENEW-INPLACE (B): a renewal never launches; every held pane waits for its own Start', async () => {
setOrcaCloudAgentAccountsStateForTest(accounts({ state: 'expired' }))
- const first = holdCloudAgentLaunch({ paneKey: 'tab:a', agent: 'claude', prompt: 'fix it' })
- const second = holdCloudAgentLaunch({ paneKey: 'tab:b', agent: 'claude', prompt: null })
+ let firstOutcome = 'pending'
+ let secondOutcome = 'pending'
+ void holdCloudAgentLaunch({ paneKey: 'tab:a', agent: 'claude', prompt: 'fix it' }).then(
+ (o) => (firstOutcome = o)
+ )
+ void holdCloudAgentLaunch({ paneKey: 'tab:b', agent: 'claude', prompt: null }).then(
+ (o) => (secondOutcome = o)
+ )
await vi.waitFor(() => expect(readCloudAgentHold('tab:b')).not.toBeNull())
expect(readCloudAgentHold('tab:a')).toMatchObject({ prompt: 'fix it' })
setOrcaCloudAgentAccountsStateForTest(accounts({ state: 'active' }))
- await expect(first).resolves.toBe('proceed')
- await expect(second).resolves.toBe('proceed')
- expect(readCloudAgentHold('tab:a')).toBeNull()
+ for (let i = 0; i < 3; i += 1) {
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ }
+ for (const key of ['tab:a', 'tab:b']) {
+ expect(readCloudAgentHold(key)).toMatchObject({
+ reason: 'awaitingStart',
+ awaiting: 'renewed'
+ })
+ }
+ expect([firstOutcome, secondOutcome]).toEqual(['pending', 'pending'])
+ // Start in one tab launches that one; the other keeps waiting.
+ releaseCloudAgentHold('tab:a', 'proceed')
+ await vi.waitFor(() => expect(firstOutcome).toBe('proceed'))
+ expect(secondOutcome).toBe('pending')
+ expect(readCloudAgentHold('tab:b')).toMatchObject({ awaiting: 'renewed' })
+ releaseCloudAgentHold('tab:b', 'cancel')
})
it('cancel releases only that pane', async () => {
diff --git a/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.ts b/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.ts
index a3aa2cfb59f..fbe3faed7c0 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.ts
+++ b/src/renderer/src/lib/orca-cloud/cloud-agent-launch-hold.ts
@@ -112,11 +112,7 @@ type HoldRequest = Omit & {
restored?: boolean
}
-type Entry = CloudAgentHold & {
- release: (outcome: 'proceed' | 'cancel') => void
- /** Renewed or covered, it waits for the person's Start instead of starting (restored, or setup). */
- askFirst: boolean
-}
+type Entry = CloudAgentHold & { release: (outcome: 'proceed' | 'cancel') => void }
const holds = new Map()
/** Each live hold's outcome, so a second launch for the same key joins it instead of holding twice. */
@@ -298,8 +294,7 @@ async function placeCloudAgentHold({
...hold,
reason,
...(awaiting ? { awaiting } : {}),
- release: finish,
- askFirst: Boolean(restored) || reason !== 'accountExpired'
+ release: finish
})
notify()
})
@@ -315,14 +310,7 @@ function redecide(entry: Entry, accounts: OrcaCloudAgentAccountsState): void {
const now = cloudAgentHoldReason(entry.agent, accounts)
if (now !== null) {
if (now !== entry.reason) {
- // A removed sign-in becomes the one-time setup, which never starts unasked (PC-3b), even
- // for a hold placed on an expired sign-in in this session.
- holds.set(entry.paneKey, {
- ...entry,
- reason: now,
- awaiting: undefined,
- askFirst: entry.askFirst || now === 'notSetUp'
- })
+ holds.set(entry.paneKey, { ...entry, reason: now, awaiting: undefined })
notify()
}
return
@@ -339,11 +327,9 @@ function redecide(entry: Entry, accounts: OrcaCloudAgentAccountsState): void {
}
return
}
- if (!entry.askFirst) {
- // Renewed in this session: every pane held on recovery starts.
- entry.release('proceed')
- return
- }
+ // CHAT-RENEW-INPLACE (team-lead, B): covered again, every held launch waits for its Start, in
+ // this session or restored, in every tab: "{{agent}} sign-in renewed · Start {{agent}}" after a
+ // renewal, "is set up · Start" after the one-time setup. Nothing launches unasked.
const awaiting = entry.reason === 'notSetUp' ? 'setUp' : 'renewed'
holds.set(entry.paneKey, { ...entry, reason: 'awaitingStart', awaiting })
notify()
@@ -373,12 +359,7 @@ export async function startCloudAgentHold(paneKey: string): Promise<'started' |
const coverage = orcaCloudAgentCoverageFromAccounts(entry.agent, accounts)?.kind
if (now !== null || (coverage !== 'account' && coverage !== 'key')) {
if (now !== null && now !== entry.reason) {
- holds.set(paneKey, {
- ...entry,
- reason: now,
- awaiting: undefined,
- askFirst: entry.askFirst || now === 'notSetUp'
- })
+ holds.set(paneKey, { ...entry, reason: now, awaiting: undefined })
notify()
}
return 'held'
diff --git a/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist-match.ts b/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist-match.ts
new file mode 100644
index 00000000000..0dd790595d0
--- /dev/null
+++ b/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist-match.ts
@@ -0,0 +1,21 @@
+// Allowlist matching for the cloud glossary lint. Entries match by file + term + a snippet of the
+// string, never by line number, so unrelated edits that shift lines don't make entries stale.
+
+export type GlossaryHit = { file: string; line: number; term: string; text: string }
+export type AllowEntry = { path: string; term: string; match: string; reason: string }
+
+export function isAllowed(hit: GlossaryHit, entry: AllowEntry): boolean {
+ return (
+ hit.file === entry.path &&
+ hit.term === entry.term &&
+ entry.match.length > 0 &&
+ hit.text.includes(entry.match)
+ )
+}
+
+/** Entries that no longer match any hit, or that have no reason. */
+export function staleAllowEntries(hits: GlossaryHit[], allow: AllowEntry[]): AllowEntry[] {
+ return allow.filter(
+ (entry) => !entry.reason?.trim() || !hits.some((hit) => isAllowed(hit, entry))
+ )
+}
diff --git a/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist.json b/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist.json
index be8d9dfdedb..0a777170fa2 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist.json
+++ b/src/renderer/src/lib/orca-cloud/cloud-glossary-allowlist.json
@@ -1,128 +1,128 @@
[
{
"path": "src/renderer/src/components/cloud-environment/EnvironmentForm.tsx",
- "line": 127,
"term": "container",
+ "match": "Reads Conductor and Dev Container setup from a local project.",
"reason": "Dev Containers spec name"
},
{
"path": "src/renderer/src/components/settings/virtual-machines/runtimes/CloudVmSetupGuide.tsx",
- "line": 20,
"term": "VM",
+ "match": "Cloud VMs",
"reason": "BYOC recipe VMs (experimental), not Orca Cloud"
},
{
"path": "src/renderer/src/components/worktree-creation/VmBuildFailureActions.tsx",
- "line": 418,
"term": "VM",
+ "match": "Delete VM",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/VmBuildFailureCard.tsx",
- "line": 161,
"term": "VM",
+ "match": "The VM is running until you choose.",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/VmDeleteConfirmDialog.tsx",
- "line": 38,
"term": "VM",
+ "match": "Delete this VM?",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/VmDeleteConfirmDialog.tsx",
- "line": 49,
"term": "VM",
+ "match": "The VM and anything on it are destroyed, and the workspace isn’t created.",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/VmDeleteConfirmDialog.tsx",
- "line": 63,
"term": "VM",
+ "match": "Delete VM",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts",
- "line": 55,
"term": "VM",
+ "match": "The VM is up, but some environment checks need attention",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts",
- "line": 59,
"term": "VM",
+ "match": "The VM is up, but {{count}} environment checks failed",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-failure-copy.ts",
- "line": 62,
"term": "VM",
+ "match": "The VM is up, but {{count}} environment check failed",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-recipe-failure-copy.ts",
- "line": 15,
"term": "VM",
+ "match": "The VM recipe failed",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-recipe-failure-copy.ts",
- "line": 19,
"term": "VM",
+ "match": "Your VM recipe stopped with an error before the VM was ready.",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-recipe-failure-copy.ts",
- "line": 25,
"term": "VM",
+ "match": "Couldn’t create the workspace on the VM",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-recipe-failure-copy.ts",
- "line": 29,
"term": "VM",
+ "match": "The VM started, but creating the workspace on it stopped with an error.",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-sheet-copy.ts",
- "line": 10,
"term": "VM",
+ "match": "Provision VM",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-sheet-copy.ts",
- "line": 69,
"term": "VM",
+ "match": "Building your VM workspace",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-sheet-copy.ts",
- "line": 74,
"term": "VM",
+ "match": "Your VM workspace is ready",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-sheet-copy.ts",
- "line": 79,
"term": "VM",
+ "match": "Your VM workspace needs attention",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/worktree-creation/vm-build-sheet-copy.ts",
- "line": 84,
"term": "VM",
+ "match": "Couldn’t build your VM workspace",
"reason": "recipe-VM branch; cloud branch says sandbox"
},
{
"path": "src/renderer/src/components/orca-cloud/use-cloud-terminal-error-override.ts",
- "line": 13,
"term": "VM",
+ "match": "This workspace's VM is asleep",
"reason": "match pattern for older builds' saved terminal errors; never rendered"
},
{
"path": "src/renderer/src/components/orca-cloud/use-cloud-terminal-error-override.ts",
- "line": 14,
"term": "VM",
+ "match": "This workspace's VM could not wake up",
"reason": "match pattern for older builds' saved terminal errors; never rendered"
}
]
diff --git a/src/renderer/src/lib/orca-cloud/cloud-glossary-lint.test.ts b/src/renderer/src/lib/orca-cloud/cloud-glossary-lint.test.ts
index 8078f45efef..acf3f226132 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-glossary-lint.test.ts
+++ b/src/renderer/src/lib/orca-cloud/cloud-glossary-lint.test.ts
@@ -7,6 +7,12 @@ import ts from 'typescript-api'
import { globSync } from 'glob'
import { describe, expect, it } from 'vitest'
import allowlist from './cloud-glossary-allowlist.json'
+import {
+ isAllowed,
+ staleAllowEntries,
+ type AllowEntry,
+ type GlossaryHit
+} from './cloud-glossary-allowlist-match'
const ROOT = path.resolve(__dirname, '../../../../..')
@@ -88,8 +94,7 @@ const TEXT_ATTRIBUTES = new Set([
])
const TRANSLATE_CALLEES = new Set(['t', 'translate'])
-type Hit = { file: string; line: number; term: string; text: string; rule: Rule }
-type AllowEntry = { path: string; line: number; term: string; reason: string }
+type Hit = GlossaryHit & { rule: Rule }
function stringValue(node: ts.Node): string | null {
if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) {
@@ -240,8 +245,6 @@ function findHits(): Hit[] {
}
const ALLOW: AllowEntry[] = allowlist
-const allowKey = (e: { path: string; line: number; term: string }): string =>
- `${e.path}:${e.line}:${e.term}`
describe('cloud glossary lint', () => {
const hits = findHits()
@@ -251,17 +254,16 @@ describe('cloud glossary lint', () => {
})
it('every allowlist entry has a reason and still matches a string', () => {
- const live = new Set(hits.map((h) => allowKey({ path: h.file, line: h.line, term: h.term })))
- const problems = ALLOW.filter((e) => !e.reason?.trim() || !live.has(allowKey(e))).map(
- (e) => `stale or unexplained allowlist entry: ${allowKey(e)}`
+ const problems = staleAllowEntries(hits, ALLOW).map(
+ (e) =>
+ `stale or unexplained allowlist entry: ${e.path} "${e.term}" match ${JSON.stringify(e.match)}`
)
expect(problems).toEqual([])
})
it('cloud strings use glossary words', () => {
- const allowed = new Set(ALLOW.map(allowKey))
const failures = hits
- .filter((h) => !allowed.has(allowKey({ path: h.file, line: h.line, term: h.term })))
+ .filter((h) => !ALLOW.some((e) => isAllowed(h, e)))
.map(
(h) =>
`cloud glossary: "${h.term}" at ${h.file}:${h.line}; use "${h.rule.use}" (glossary row: ${h.rule.row}). ` +
@@ -270,3 +272,43 @@ describe('cloud glossary lint', () => {
expect(failures).toEqual([])
})
})
+
+describe('allowlist matching', () => {
+ const file = 'src/renderer/src/components/worktree-creation/vm-build-sheet-copy.ts'
+ const entry: AllowEntry = {
+ path: file,
+ term: 'VM',
+ match: 'Your VM workspace is ready',
+ reason: 'recipe-VM branch'
+ }
+ const hit = (over: Partial = {}): GlossaryHit => ({
+ file,
+ line: 74,
+ term: 'VM',
+ text: 'Your VM workspace is ready',
+ ...over
+ })
+
+ it('still allows the same string after it moves to another line', () => {
+ expect(isAllowed(hit({ line: 74 }), entry)).toBe(true)
+ expect(isAllowed(hit({ line: 112 }), entry)).toBe(true)
+ })
+
+ it('does not allow a different string with the same term in the same file', () => {
+ expect(isAllowed(hit({ text: 'Delete this VM?' }), entry)).toBe(false)
+ })
+
+ it('does not allow the same snippet in a different file', () => {
+ expect(isAllowed(hit({ file: 'src/renderer/src/lib/other-cloud.ts' }), entry)).toBe(false)
+ })
+
+ it('reports an entry with no matching hit as stale', () => {
+ expect(staleAllowEntries([hit({ text: 'Delete this VM?' })], [entry])).toEqual([entry])
+ expect(staleAllowEntries([hit()], [entry])).toEqual([])
+ })
+
+ it('reports an entry with an empty reason', () => {
+ const unexplained = { ...entry, reason: ' ' }
+ expect(staleAllowEntries([hit()], [unexplained])).toEqual([unexplained])
+ })
+})
diff --git a/src/renderer/src/lib/orca-cloud/cloud-held-launch-restore.test.ts b/src/renderer/src/lib/orca-cloud/cloud-held-launch-restore.test.ts
index 3fb5e2eee4a..a90d42b945e 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-held-launch-restore.test.ts
+++ b/src/renderer/src/lib/orca-cloud/cloud-held-launch-restore.test.ts
@@ -291,7 +291,7 @@ describe('after a restart', () => {
})
describe('in session (not restored)', () => {
- it('in-session (not restored), an expired hold still starts on Renew as before', async () => {
+ it('CHAT-RENEW-INPLACE (B): in session, a renewed hold waits for Start: no create until Start', async () => {
mocks.coverage = 'expired'
setTabs([TAB])
const create = vi.fn(async (args: CreateWebRuntimeSessionTerminalOnHostArgs) =>
@@ -307,6 +307,13 @@ describe('in session (not restored)', () => {
for (const listener of mocks.listeners) {
listener()
}
+ await flush()
+ expect(readCloudAgentHold(cloudTabHoldKey(TAB))).toMatchObject({
+ reason: 'awaitingStart',
+ awaiting: 'renewed'
+ })
+ expect(create).not.toHaveBeenCalledWith(expect.objectContaining({ agent: 'claude' }))
+ releaseCloudAgentHold(cloudTabHoldKey(TAB), 'proceed')
await launch
expect(create).toHaveBeenLastCalledWith(expect.objectContaining({ agent: 'claude' }))
})
@@ -332,7 +339,7 @@ describe('in session (not restored)', () => {
expect(create).toHaveBeenCalledTimes(1)
})
- it('a paused (kill switch) agent never starts the expired hold; a real renewal does', async () => {
+ it('a paused (kill switch) agent never starts the expired hold; a real renewal waits for Start (B)', async () => {
mocks.coverage = 'expired'
setTabs([TAB])
const create = vi.fn(async (args: CreateWebRuntimeSessionTerminalOnHostArgs) =>
@@ -354,6 +361,10 @@ describe('in session (not restored)', () => {
for (const listener of mocks.listeners) {
listener()
}
+ await flush()
+ expect(readCloudAgentHold(cloudTabHoldKey(TAB))).toMatchObject({ awaiting: 'renewed' })
+ expect(create).toHaveBeenCalledTimes(1)
+ releaseCloudAgentHold(cloudTabHoldKey(TAB), 'proceed')
await launch
expect(create).toHaveBeenLastCalledWith(expect.objectContaining({ agent: 'claude' }))
})
diff --git a/src/renderer/src/lib/orca-cloud/cloud-web-host-launch-hold.test.ts b/src/renderer/src/lib/orca-cloud/cloud-web-host-launch-hold.test.ts
index e3912c0893a..81f6767e34e 100644
--- a/src/renderer/src/lib/orca-cloud/cloud-web-host-launch-hold.test.ts
+++ b/src/renderer/src/lib/orca-cloud/cloud-web-host-launch-hold.test.ts
@@ -219,7 +219,7 @@ describe('createWithCloudAgentHold (the one hold for every Orca Cloud agent laun
expect(readCloudAgentHold(key)).toBeNull()
})
- it('expired: holds, then starts on Renew', async () => {
+ it('expired: holds; Renew turns it to "renewed · Start", and Start launches it (B)', async () => {
setOrcaCloudAgentAccountsStateForTest(accounts({ state: 'revoked' }))
const create = hostCreate()
const args = { ...CREATE_AGENT, prompt: 'fix the bug' }
@@ -231,9 +231,14 @@ describe('createWithCloudAgentHold (the one hold for every Orca Cloud agent laun
prompt: 'fix the bug'
})
setOrcaCloudAgentAccountsStateForTest(accounts({ state: 'active' }))
+ await flush()
+ // A renewal never launches by itself (team-lead, B): it waits for Start.
+ expect(readCloudAgentHold(key)).toMatchObject({ reason: 'awaitingStart', awaiting: 'renewed' })
+ expect(create).toHaveBeenCalledOnce()
+ releaseCloudAgentHold(key, 'proceed')
await expect(result).resolves.toBe(AGENT)
- // Renew's auto-start: the original args, no focus taken (the tab may be in the background).
- expect(create).toHaveBeenLastCalledWith(args)
+ // The person's Start: the original args, with its tab brought forward.
+ expect(create).toHaveBeenLastCalledWith({ ...args, activate: true })
})
it('cancel leaves the plain shell and never starts the agent', async () => {
diff --git a/src/renderer/src/lib/orca-cloud/github-link-sources.ts b/src/renderer/src/lib/orca-cloud/github-link-sources.ts
index 33030df09d7..40709c97956 100644
--- a/src/renderer/src/lib/orca-cloud/github-link-sources.ts
+++ b/src/renderer/src/lib/orca-cloud/github-link-sources.ts
@@ -1,19 +1,9 @@
-// "Copy link" for the GitHub handoffs: the same single-use page Connect GitHub (App install) and
-// Connect your GitHub (OAuth) open, minted the same way in main but returned instead of opened.
+// "Copy link" for connecting your GitHub identity (OAuth sign-in): the same single-use page Connect
+// your GitHub opens, minted the same way in main but returned instead of opened. Copy link is for
+// sign-in pages only; the GitHub App install keeps a plain button.
import { requireLink, type ExternalLinkSource } from '@/components/open-external/copy-external-link'
import { cloudWorkspaceApi } from './orca-cloud-workspace-store'
-/** The GitHub App install page; with a repository, GitHub preselects it (and a setup session returns). */
-export function gitHubInstallLinkSource(args?: {
- repoUrl?: string
- setupSessionId?: string
-}): ExternalLinkSource {
- return async () => {
- const result = await cloudWorkspaceApi()?.gitHubInstallLink(args)
- return requireLink(result?.ok ? result.value : null)
- }
-}
-
/** GitHub's OAuth page for connecting the person's own GitHub identity. */
export function gitHubUserConnectLinkSource(): ExternalLinkSource {
return async () => {
diff --git a/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-git-setup.test.ts b/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-git-setup.test.ts
index 0e6b72d3618..911e85d51a9 100644
--- a/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-git-setup.test.ts
+++ b/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-git-setup.test.ts
@@ -47,7 +47,6 @@ function stub(
connectGitHub: vi.fn(unused),
getGitHubUser: vi.fn(unused),
connectGitHubUser: vi.fn(unused),
- gitHubInstallLink: vi.fn(unused),
gitHubUserConnectLink: vi.fn(unused),
disconnectGitHubUser: vi.fn(unused),
getRepoAccess: vi.fn(unused),
diff --git a/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-wake.test.ts b/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-wake.test.ts
index 2eaf4be43a6..f6c889b15f4 100644
--- a/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-wake.test.ts
+++ b/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store-wake.test.ts
@@ -37,7 +37,6 @@ function stub(
connectGitHub: vi.fn(unused),
getGitHubUser: vi.fn(unused),
connectGitHubUser: vi.fn(unused),
- gitHubInstallLink: vi.fn(unused),
gitHubUserConnectLink: vi.fn(unused),
disconnectGitHubUser: vi.fn(unused),
getRepoAccess: vi.fn(unused),
diff --git a/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store.test.ts b/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store.test.ts
index 2cb54706641..8b440d8b65f 100644
--- a/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store.test.ts
+++ b/src/renderer/src/lib/orca-cloud/orca-cloud-workspace-store.test.ts
@@ -42,7 +42,6 @@ function stubApi(overrides: Partial = {}): OrcaCloudWorks
connectGitHub: vi.fn(async () => ok(null)),
getGitHubUser: vi.fn(async () => ok({ connected: false as const })),
connectGitHubUser: vi.fn(async () => ok(null)),
- gitHubInstallLink: vi.fn(async () => ok('https://github.com/apps/x/installations/new')),
gitHubUserConnectLink: vi.fn(async () => ok('https://github.com/login/oauth/authorize')),
disconnectGitHubUser: vi.fn(async () => ok({ connected: false as const })),
getRepoAccess: vi.fn(async () =>
diff --git a/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.cancel.test.ts b/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.cancel.test.ts
new file mode 100644
index 00000000000..216791fa2c3
--- /dev/null
+++ b/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.cancel.test.ts
@@ -0,0 +1,117 @@
+// @vitest-environment happy-dom
+// GH-CREATE-CANCEL and GH-CREATE-NO-ROW for a GitHub-only Orca Cloud create: Cancel at any step
+// leaves no workspace (the sandbox is deleted, which drops the pairing too), and a create that
+// opens hands its pending row off to the paired server's rows, which stay hidden until then.
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { useAppStore } from '@/store'
+
+type OpenOptions = { onHost?: (hostId: string) => void }
+type OpenOutcome = { ok: true; worktreeId: string | null; hostId?: string }
+
+const mocks = vi.hoisted(() => ({
+ open: vi.fn<(workspace: unknown, options?: OpenOptions) => Promise>(),
+ launch: vi.fn()
+}))
+
+vi.mock('@/components/cloud-workspaces/open-cloud-workspace', () => ({
+ openCloudWorkspace: mocks.open
+}))
+vi.mock('@/lib/agent-session/launch/new-tab/launch-agent-in-new-tab', () => ({
+ launchAgentInNewTabWithOutcome: mocks.launch
+}))
+
+import { startCloudWorkspaceFromGitHub } from './start-cloud-workspace-from-github'
+import { resetGitHubCreateKeysForTest } from './github-cloud-create-key'
+
+const createFromGitHub = vi.fn<(args: unknown) => Promise>()
+const destroy = vi.fn(async () => ({ ok: true, value: undefined }))
+
+beforeEach(() => {
+ resetGitHubCreateKeysForTest()
+ useAppStore.setState({ pendingWorktreeCreations: {}, activePendingCreationId: null })
+ createFromGitHub.mockResolvedValue({ ok: true, value: { sandboxId: 'sbx_1' } })
+ mocks.open.mockResolvedValue({ ok: true, worktreeId: null })
+ Object.assign(window, {
+ api: {
+ ...window.api,
+ orcaCloudWorkspace: { createFromGitHub },
+ cloudWorkspaces: {
+ get: vi.fn(async (id: string) => ({ ok: true, value: { id } })),
+ destroy,
+ localWorkspaces: vi.fn(async () => []),
+ environmentBindings: vi.fn(async () => ({}))
+ },
+ ephemeralVm: {
+ onProvisionEvent: () => () => {},
+ cancelProvision: vi.fn(async () => ({ cancelled: true })),
+ // Cancel's cleanup looks for this create's runtime records; a GitHub-only create has none.
+ listRuntimes: vi.fn(async () => [])
+ }
+ }
+ })
+})
+
+afterEach(() => {
+ vi.clearAllMocks()
+})
+
+const REQUEST = {
+ repoUrl: 'https://github.com/acme/web',
+ fullName: 'acme/web',
+ prompt: '',
+ agent: null,
+ composerRepoId: 'repo-1'
+}
+
+const creationId = (): string =>
+ Object.keys(useAppStore.getState().pendingWorktreeCreations)[0] ?? ''
+const cancel = (): void => useAppStore.getState().removePendingWorktreeCreation(creationId())
+
+describe('Cancel leaves no workspace (GH-CREATE-CANCEL)', () => {
+ it('cancelled after the sandbox started, before it opened: deleted, never opened', async () => {
+ createFromGitHub.mockImplementationOnce(async () => {
+ cancel()
+ return { ok: true, value: { sandboxId: 'sbx_1' } }
+ })
+ expect(await startCloudWorkspaceFromGitHub(REQUEST)).toBe(false)
+ expect(mocks.open).not.toHaveBeenCalled()
+ expect(destroy).toHaveBeenCalledWith('sbx_1')
+ })
+
+ it('cancelled while it opened: the sandbox is deleted (its pairing and row go with it)', async () => {
+ mocks.open.mockImplementationOnce(async (_workspace, options) => {
+ options?.onHost?.('runtime:p')
+ cancel()
+ return { ok: true, worktreeId: 'w1', hostId: 'runtime:p' }
+ })
+ expect(await startCloudWorkspaceFromGitHub(REQUEST)).toBe(false)
+ expect(destroy).toHaveBeenCalledWith('sbx_1')
+ expect(useAppStore.getState().pendingWorktreeCreations).toEqual({})
+ })
+
+ it('cancelled while the create was in flight: main reclaims it; nothing opens here', async () => {
+ createFromGitHub.mockImplementationOnce(async () => {
+ cancel()
+ return { ok: false, code: 'failed', message: 'Cancelled.' }
+ })
+ expect(await startCloudWorkspaceFromGitHub(REQUEST)).toBe(false)
+ expect(window.api.ephemeralVm.cancelProvision).toHaveBeenCalled()
+ expect(mocks.open).not.toHaveBeenCalled()
+ })
+})
+
+describe('pending row hand-off (GH-CREATE-NO-ROW)', () => {
+ it('records the paired server while opening, and the hand-off drops the pending row', async () => {
+ let pairingHostIdDuringOpen: string | undefined
+ mocks.open.mockImplementationOnce(async (_workspace, options) => {
+ options?.onHost?.('runtime:p')
+ pairingHostIdDuringOpen =
+ useAppStore.getState().pendingWorktreeCreations[creationId()]?.pairingHostId
+ return { ok: true, worktreeId: null }
+ })
+ expect(await startCloudWorkspaceFromGitHub(REQUEST)).toBe(true)
+ expect(pairingHostIdDuringOpen).toBe('runtime:p')
+ expect(useAppStore.getState().pendingWorktreeCreations).toEqual({})
+ expect(destroy).not.toHaveBeenCalled()
+ })
+})
diff --git a/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.ts b/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.ts
index 982b05ebc14..dd3fdd7000e 100644
--- a/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.ts
+++ b/src/renderer/src/lib/orca-cloud/start-cloud-workspace-from-github.ts
@@ -9,6 +9,7 @@
import { useAppStore } from '@/store'
import { translate } from '@/i18n/i18n'
import { openCloudWorkspace } from '@/components/cloud-workspaces/open-cloud-workspace'
+import { refreshCloudWorktreeBindings } from '@/components/cloud-workspaces/cloud-workspace-identity'
import { createNonSecureContextUuid } from '../../../../shared/non-secure-context-uuid'
import { isTuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent-config'
import { ORCA_CLOUD_RECIPE_ID } from '../../../../shared/hosted-sandbox/orca-cloud-recipe-id'
@@ -87,7 +88,12 @@ export function startCloudWorkspaceFromGitHub(request: StartFromGitHubRequest):
})
store.setActiveView('terminal')
store.setSidebarOpen(true)
- return runGitHubCloudCreate(creationId)
+ return runTracked(creationId)
+}
+
+/** Cancel's "Deleting the sandbox…" waits for every step that may still own a sandbox. */
+function runTracked(creationId: string): Promise {
+ return trackOrcaCloudCreateStep(creationId, runGitHubCloudCreate(creationId))
}
/** The sheet's Retry (and the plans page's retry after checkout) for a GitHub-only create. */
@@ -114,7 +120,7 @@ export function retryGitHubCloudCreate(creationId: string): void {
})
store.setActivePendingWorktreeCreation(creationId)
store.setActiveView('terminal')
- void runGitHubCloudCreate(creationId)
+ void runTracked(creationId)
}
function current(creationId: string) {
@@ -186,13 +192,27 @@ async function runGitHubCloudCreate(creationId: string): Promise {
return false
}
if (!current(creationId)) {
- // Cancelled while it started: main stopped the create and deleted what it had made.
- startedSandboxes.delete(creationId)
+ // GH-CREATE-CANCEL: cancelled after the sandbox started but before it opened.
+ await discardSandbox(creationId, sandboxId)
return false
}
useAppStore.getState().updatePendingWorktreeCreation(creationId, { phase: 'creating' })
const workspace = await window.api.cloudWorkspaces.get(sandboxId).catch(() => null)
- const opened = workspace?.ok ? await openCloudWorkspace(workspace.value) : null
+ const opened = workspace?.ok
+ ? await openCloudWorkspace(workspace.value, {
+ // GH-CREATE-NO-ROW: that server's rows wait behind the pending row until the hand-off.
+ onHost: (hostId) =>
+ useAppStore
+ .getState()
+ .updatePendingWorktreeCreation(creationId, { pairingHostId: hostId })
+ })
+ : null
+ if (!current(creationId)) {
+ // GH-CREATE-CANCEL: cancelled while it opened. Opening can't be stopped half way, so the
+ // sandbox is deleted, which also drops this computer's pairing and its row.
+ await discardSandbox(creationId, sandboxId)
+ return false
+ }
if (!opened?.ok) {
// The sandbox exists from here on: Retry opens it and never creates it again.
return fail(
@@ -219,3 +239,14 @@ async function runGitHubCloudCreate(creationId: string): Promise {
})
return true
}
+
+/** A cancelled create's sandbox: deleted, so nothing keeps running (or billing) behind the cancel. */
+async function discardSandbox(creationId: string, sandboxId: string): Promise {
+ startedSandboxes.delete(creationId)
+ forgetGitHubCreateKey(creationId)
+ const result = await window.api.cloudWorkspaces.destroy(sandboxId).catch(() => null)
+ if (!result?.ok) {
+ console.warn('[orca-cloud] cancelled GitHub create: could not delete sandbox', sandboxId)
+ }
+ void refreshCloudWorktreeBindings().catch(() => undefined)
+}
diff --git a/src/renderer/src/lib/orca-cloud/use-orca-cloud-repo-access.ts b/src/renderer/src/lib/orca-cloud/use-orca-cloud-repo-access.ts
index d07a6a21b45..04e74e0aa00 100644
--- a/src/renderer/src/lib/orca-cloud/use-orca-cloud-repo-access.ts
+++ b/src/renderer/src/lib/orca-cloud/use-orca-cloud-repo-access.ts
@@ -3,14 +3,12 @@
// network call; everything else comes from the control plane's GET /v1/github/repo-access (N2),
// cached 5 minutes. While a repository is waiting (an install in the browser, or an org owner's
// approval, D2), `poll` re-checks on the spec's cadence: every 2 s for 3 minutes, then every 10 s.
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { useCallback, useEffect, useRef, useState } from 'react'
import { useAppStore } from '@/store'
import { normalizeGitRemoteUrl } from '../../../../shared/git/remotes/git-remote-identity'
import type { HostedGithubRepoAccessResponse } from '../../../../shared/hosted-sandbox/hosted-github-wire'
import type { Repo } from '../../../../shared/repo-types'
-import type { ExternalLinkSource } from '@/components/open-external/copy-external-link'
import { cloudWorkspaceApi } from './orca-cloud-workspace-store'
-import { gitHubInstallLinkSource } from './github-link-sources'
import { useOrcaCloudIdentityKey } from './orca-cloud-identity'
export type OrcaCloudRepoAccessState =
@@ -139,12 +137,7 @@ export function useOrcaCloudRepoAccess(
/** Fired once when a repository that was waiting becomes reachable (D2's "access granted"). */
onGranted?: () => void
} = {}
-): OrcaCloudRepoAccess & {
- refresh: () => void
- openInstall: () => Promise
- /** "Copy link" for openInstall: the same single-use install page, minted without opening. */
- installLink: ExternalLinkSource | null
-} {
+): OrcaCloudRepoAccess & { refresh: () => void; openInstall: () => Promise } {
const repo = useAppStore((s) =>
repoId ? s.repos.find((entry) => entry.id === repoId) : undefined
)
@@ -218,14 +211,6 @@ export function useOrcaCloudRepoAccess(
return Boolean(result?.ok)
}, [repoUrl, setupSessionId])
- const installLink = useMemo(
- () =>
- repoUrl
- ? gitHubInstallLinkSource({ repoUrl, ...(setupSessionId ? { setupSessionId } : {}) })
- : null,
- [repoUrl, setupSessionId]
- )
-
return {
state: enabled || !repoUrl ? state : 'unknown',
...(current?.installUrl ? { installUrl: current.installUrl } : {}),
@@ -235,7 +220,6 @@ export function useOrcaCloudRepoAccess(
repoUrl,
loading: enabled && current === undefined,
refresh,
- openInstall,
- installLink
+ openInstall
}
}
diff --git a/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.test.ts b/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.test.ts
index 3e296c962c2..39cc60b4eff 100644
--- a/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.test.ts
+++ b/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.test.ts
@@ -125,3 +125,26 @@ describe('paired workspaces scoped by account (PAIRED-ACCOUNT-FILTER)', () => {
expect(hostsFor('team-two', paired()).hiddenHostIds.has('runtime:gh')).toBe(false)
})
})
+
+describe('GH-CREATE-NO-ROW hand-off', () => {
+ it('hides the server a GitHub-only create is pairing to until its pending row hands off', () => {
+ const pairing = (pairingHostId?: string) =>
+ // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the selector reads only these fields.
+ ({
+ runtimeEnvironments: [{ id: 'p', name: 'web (cloud)', orcaCloudPaired: true }],
+ orcaProfileAuthStatus: { cloud: { userId: 'u1' } },
+ pendingWorktreeCreations: {
+ gh: {
+ creationId: 'gh',
+ request: { githubSource: { fullName: 'acme/web' } },
+ ...(pairingHostId ? { pairingHostId } : {})
+ }
+ }
+ }) as unknown as Pick
+ const hidden = (state: Pick) => [
+ ...parseOrcaCloudHostScopeKey(selectOrcaCloudHostScopeKey(state)).hiddenHostIds
+ ]
+ expect(hidden(pairing())).toEqual([])
+ expect(hidden(pairing('runtime:p'))).toEqual(['runtime:p'])
+ })
+})
diff --git a/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.ts b/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.ts
index ac77b801dd3..538b4601197 100644
--- a/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.ts
+++ b/src/renderer/src/lib/orca-cloud/use-sidebar-hidden-checkouts.ts
@@ -13,7 +13,12 @@ import { isOrcaCloudRuntimeEnvironment } from '../../../../shared/remote-runtime
import type { Repo } from '../../../../shared/repo-types'
type CloudScopeState = Pick &
- Partial>
+ Partial<
+ Pick<
+ AppState,
+ 'orcaProfileAuthStatus' | 'cloudAccountIdByEnvironmentId' | 'pendingWorktreeCreations'
+ >
+ >
/**
* Every Orca Cloud server this desktop runs, `+host` when the active team owns it and `-host`
@@ -30,7 +35,12 @@ type CloudScopeState = Pick &
export function selectOrcaCloudHostScopeKey(state: CloudScopeState): string {
const active = orcaCloudAccountId(state.orcaProfileAuthStatus?.cloud)
const owners = state.cloudAccountIdByEnvironmentId ?? {}
- return (state.runtimeEnvironments ?? [])
+ // GH-CREATE-NO-ROW: a GitHub-only create's pending row stands for its server's rows until the
+ // hand-off removes it; both change in one store update, so the row never shows twice.
+ const handingOff = Object.values(state.pendingWorktreeCreations ?? {}).flatMap((entry) =>
+ entry.request.githubSource && entry.pairingHostId ? [`-${entry.pairingHostId}`] : []
+ )
+ const scoped = (state.runtimeEnvironments ?? [])
.filter((environment) => isOrcaCloudRuntimeEnvironment(environment))
.flatMap((environment) => {
const hostId = toRuntimeExecutionHostId(environment.id)
@@ -41,7 +51,7 @@ export function selectOrcaCloudHostScopeKey(state: CloudScopeState): string {
const inTeam = active !== null && owners[environment.id] === active
return [`${inTeam ? '+' : '-'}${hostId}`]
})
- .join('\n')
+ return [...scoped, ...handingOff].join('\n')
}
export function parseOrcaCloudHostScopeKey(key: string): {
diff --git a/src/renderer/src/lib/workspace/creation/pending-worktree-creation.ts b/src/renderer/src/lib/workspace/creation/pending-worktree-creation.ts
index 6b8a9f043b4..d7b4b35f343 100644
--- a/src/renderer/src/lib/workspace/creation/pending-worktree-creation.ts
+++ b/src/renderer/src/lib/workspace/creation/pending-worktree-creation.ts
@@ -195,6 +195,8 @@ export type PendingWorktreeCreation = {
resumedAt?: number
/** VM creates: the provisioned VM's runtime environment, known once it answers. */
vmEnvironmentId?: string
+ /** GitHub-only Orca Cloud create: the server it is pairing to; its rows wait for the hand-off. */
+ pairingHostId?: string
// Local git checkout meter; absent when git emits none or creation runs over SSH/runtime.
checkoutProgress?: WorktreeCheckoutProgress
/** Phases entered so far with their start times, so the chat checklist can time each step. */
diff --git a/src/renderer/src/store/slices/worktrees/create/pending-worktree-creation.ts b/src/renderer/src/store/slices/worktrees/create/pending-worktree-creation.ts
index 177eb7bf2f6..3ac855a0cf8 100644
--- a/src/renderer/src/store/slices/worktrees/create/pending-worktree-creation.ts
+++ b/src/renderer/src/store/slices/worktrees/create/pending-worktree-creation.ts
@@ -149,13 +149,7 @@ export function createRemovePendingWorktreeCreation(
.catch(() => undefined)
}
const cleanup = cleanUpCancelledVm(creationId, removedEntry.request, get)
- // A GitHub-only create past its start is opening a sandbox that stays; nothing is deleted.
- const opening = Boolean(removedEntry.request.githubSource) && removedEntry.phase === 'creating'
- if (
- removedEntry.status === 'creating' &&
- isOrcaCloudCreateRequest(removedEntry.request) &&
- !opening
- ) {
+ if (removedEntry.status === 'creating' && isOrcaCloudCreateRequest(removedEntry.request)) {
beginOrcaCloudCancelCleanup(creationId, cleanup ? [cleanup] : [], {
runtimeId: removedEntry.request.ephemeralVmRuntimeId,
createStartedAt: removedEntry.startedAt,
diff --git a/src/renderer/src/store/slices/worktrees/worktree-slice-contract.ts b/src/renderer/src/store/slices/worktrees/worktree-slice-contract.ts
index f55349c25be..8fc823291c3 100644
--- a/src/renderer/src/store/slices/worktrees/worktree-slice-contract.ts
+++ b/src/renderer/src/store/slices/worktrees/worktree-slice-contract.ts
@@ -186,6 +186,7 @@ export type WorktreeSlice = {
pausedMs?: number
resumedAt?: number
vmEnvironmentId?: string
+ pairingHostId?: string
checkoutProgress?: PendingWorktreeCreation['checkoutProgress']
worktreeId?: string
heldChatMessage?: string
diff --git a/src/renderer/src/web/preload-api/web-orca-profiles-api.ts b/src/renderer/src/web/preload-api/web-orca-profiles-api.ts
index 4fa1c22b21e..43bede4c5ae 100644
--- a/src/renderer/src/web/preload-api/web-orca-profiles-api.ts
+++ b/src/renderer/src/web/preload-api/web-orca-profiles-api.ts
@@ -65,6 +65,11 @@ export function createWebOrcaProfilesApi(): Partial {
status: 'unconfigured',
auth: await webOrcaProfileAuthStatus()
}),
+ accountMfa: async () => ({ status: 'unconfigured' }),
+ teamMfaPolicy: async () => ({ status: 'unconfigured' }),
+ teamMfaPolicySet: async () => ({ status: 'unconfigured' }),
+ teamMfaPending: async () => ({ status: 'unconfigured' }),
+ teamMfaRemind: async () => ({ status: 'unconfigured' }),
orgMembersList: async () => ({ status: 'unconfigured' }),
orgMemberInvite: async () => ({ status: 'unconfigured' }),
orgInviteRevoke: async () => ({ status: 'unconfigured' }),
@@ -85,8 +90,6 @@ export function createWebOrcaProfilesApi(): Partial {
cloudSetupGet: async () => ({ status: 'unconfigured' }),
cloudSetupLink: async () => ({ status: 'unconfigured' }),
billingOpenPortal: async () => ({ status: 'unconfigured' }),
- billingPortalLink: async () => ({ status: 'unconfigured' }),
- billingCheckoutLink: async () => ({ status: 'unconfigured' }),
billingTeamPlans: async () => ({ status: 'unconfigured' }),
billingUsageHistory: async () => ({ status: 'unconfigured' }),
billingSetOverage: async () => ({ status: 'unconfigured' }),
diff --git a/src/shared/ephemeral-vm-recipe-env.ts b/src/shared/ephemeral-vm-recipe-env.ts
index 0f4f7bf5ec5..22a52e1c30e 100644
--- a/src/shared/ephemeral-vm-recipe-env.ts
+++ b/src/shared/ephemeral-vm-recipe-env.ts
@@ -1,5 +1,6 @@
// Recipe scripts run locally and inherit Orca's environment. These helpers let a recipe opt into a
// narrower environment (`passEnv`) and let the UI name the credential-like variables a recipe sees.
+import { AGENT_CREDENTIAL_NAMES } from './agent-credentials/agent-credential-names'
/** Variables every recipe keeps even with `passEnv`, so shells and provider CLIs still start. */
export const RECIPE_BASE_ENV_NAMES: readonly string[] = [
@@ -63,6 +64,36 @@ export function isCredentialLikeEnvName(name: string): boolean {
)
}
+const AGENT_CREDENTIAL_NAME_SET = new Set(Object.values(AGENT_CREDENTIAL_NAMES).flat())
+const CREDENTIAL_SEGMENTS = new Set([
+ 'KEY',
+ 'KEYS',
+ 'APIKEY',
+ 'TOKEN',
+ 'TOKENS',
+ 'SECRET',
+ 'SECRETS',
+ 'CREDENTIAL',
+ 'CREDENTIALS',
+ 'PAT'
+])
+const CREDENTIAL_SUBSTRINGS = /PASSWORD|PASSWD|SECRET|TOKEN|PRIVATE_KEY|API_?KEY/
+
+/** The host panel's classifier: agent credential names, plus key/token/secret-shaped segments. */
+export function looksLikeCredentialEnvName(name: string): boolean {
+ const upper = name.toUpperCase()
+ return (
+ AGENT_CREDENTIAL_NAME_SET.has(upper) ||
+ CREDENTIAL_SUBSTRINGS.test(upper) ||
+ upper.split(/[_\-.]/).some((segment) => CREDENTIAL_SEGMENTS.has(segment))
+ )
+}
+
+/** The one rule every recipe env warning uses, so the host panel and Settings name the same variables. */
+export function isRecipeCredentialEnvName(name: string): boolean {
+ return looksLikeCredentialEnvName(name) || isCredentialLikeEnvName(name)
+}
+
/** `passEnv` entries are exact names or a prefix ending in `*` (e.g. `AWS_*`). */
export function isRecipeEnvNamePassed(
name: string,
@@ -104,7 +135,7 @@ export function buildRecipeInheritedEnv(
/** Sorted credential-like names with a non-empty value in `source`. Never returns values. */
export function listCredentialLikeEnvNames(source: NodeJS.ProcessEnv): string[] {
return Object.entries(source)
- .filter(([name, value]) => Boolean(value) && isCredentialLikeEnvName(name))
+ .filter(([name, value]) => Boolean(value) && isRecipeCredentialEnvName(name))
.map(([name]) => name)
.sort((a, b) => a.localeCompare(b))
}
diff --git a/src/shared/ephemeral-vm-recipe-forwarded-env.test.ts b/src/shared/ephemeral-vm-recipe-forwarded-env.test.ts
index 303830a7f88..314ffaa98a6 100644
--- a/src/shared/ephemeral-vm-recipe-forwarded-env.test.ts
+++ b/src/shared/ephemeral-vm-recipe-forwarded-env.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, it } from 'vitest'
+import { listCredentialLikeEnvNames } from './ephemeral-vm-recipe-env'
import { summarizeRecipeForwardedEnv } from './ephemeral-vm-recipe-forwarded-env'
describe('summarizeRecipeForwardedEnv', () => {
@@ -23,10 +24,53 @@ describe('summarizeRecipeForwardedEnv', () => {
'GITHUB_TOKEN',
'openai_api_key'
],
- other: ['HOME', 'KEYCHAIN_PATH', 'PATH']
+ other: ['HOME', 'KEYCHAIN_PATH', 'PATH'],
+ narrowed: false
})
expect(JSON.stringify(summary)).not.toMatch(
/ghp_secret_value|aws-secret-value|hunter2|sk-lower/
)
})
+
+ const env = { AWS_SECRET_ACCESS_KEY: 'aws', OPENAI_API_KEY: 'sk', PATH: '/usr/bin' }
+
+ it("summarizes only what the recipe's passEnv lets through", () => {
+ expect(summarizeRecipeForwardedEnv(env, ['AWS_*'], 'linux')).toEqual({
+ count: 2,
+ keyLike: ['AWS_SECRET_ACCESS_KEY'],
+ other: ['PATH'],
+ narrowed: true
+ })
+ })
+
+ it('summarizes the whole env without passEnv', () => {
+ expect(summarizeRecipeForwardedEnv(env, undefined, 'linux')).toEqual({
+ count: 3,
+ keyLike: ['AWS_SECRET_ACCESS_KEY', 'OPENAI_API_KEY'],
+ other: ['PATH'],
+ narrowed: false
+ })
+ })
+
+ it('names the same credentials as the Settings credentials notice', () => {
+ const sample = {
+ OPENAI_API_KEY: 'v',
+ GITHUB_TOKEN: 'v',
+ AWS_REGION: 'v',
+ MY_PASSWORD: 'v',
+ ANTHROPIC_AUTH_TOKEN: 'v',
+ PRIVATE_KEY_PATH: 'v',
+ PATH: 'v'
+ }
+ const keyLike = summarizeRecipeForwardedEnv(sample).keyLike
+ expect(keyLike).toEqual(listCredentialLikeEnvNames(sample))
+ expect(keyLike).toEqual([
+ 'ANTHROPIC_AUTH_TOKEN',
+ 'AWS_REGION',
+ 'GITHUB_TOKEN',
+ 'MY_PASSWORD',
+ 'OPENAI_API_KEY',
+ 'PRIVATE_KEY_PATH'
+ ])
+ })
})
diff --git a/src/shared/ephemeral-vm-recipe-forwarded-env.ts b/src/shared/ephemeral-vm-recipe-forwarded-env.ts
index 2f083e23e8c..352f234b127 100644
--- a/src/shared/ephemeral-vm-recipe-forwarded-env.ts
+++ b/src/shared/ephemeral-vm-recipe-forwarded-env.ts
@@ -1,46 +1,30 @@
-import { AGENT_CREDENTIAL_NAMES } from './agent-credentials/agent-credential-names'
+import { buildRecipeInheritedEnv, isRecipeCredentialEnvName } from './ephemeral-vm-recipe-env'
-/** Names only: recipe create scripts get this computer's whole env, so values never leave main. */
+/** Names only: the env a recipe's scripts inherit (passEnv-narrowed or whole); values never leave main. */
export type RecipeForwardedEnvSummary = {
count: number
- /** Sorted names that look like credentials (key/token/secret/password, or an agent credential). */
+ /** Sorted names that look like credentials (isRecipeCredentialEnvName). */
keyLike: string[]
/** Every other forwarded name, sorted. */
other: string[]
+ /** True when the recipe's passEnv narrowed the env; false means this computer's whole env. */
+ narrowed: boolean
}
-const AGENT_CREDENTIAL_NAME_SET = new Set(Object.values(AGENT_CREDENTIAL_NAMES).flat())
-const CREDENTIAL_SEGMENTS = new Set([
- 'KEY',
- 'KEYS',
- 'APIKEY',
- 'TOKEN',
- 'TOKENS',
- 'SECRET',
- 'SECRETS',
- 'CREDENTIAL',
- 'CREDENTIALS',
- 'PAT'
-])
-const CREDENTIAL_SUBSTRINGS = /PASSWORD|PASSWD|SECRET|TOKEN|PRIVATE_KEY|API_?KEY/
-
-export function looksLikeCredentialEnvName(name: string): boolean {
- // Windows env names are case-insensitive; match them the way agents would read them.
- const upper = name.toUpperCase()
- return (
- AGENT_CREDENTIAL_NAME_SET.has(upper) ||
- CREDENTIAL_SUBSTRINGS.test(upper) ||
- upper.split(/[_\-.]/).some((segment) => CREDENTIAL_SEGMENTS.has(segment))
- )
-}
-
-export function summarizeRecipeForwardedEnv(env: NodeJS.ProcessEnv): RecipeForwardedEnvSummary {
+/** Summarizes what buildRecipeEnv would inherit: the whole env, or only what `passEnv` allows. */
+export function summarizeRecipeForwardedEnv(
+ source: NodeJS.ProcessEnv,
+ passEnv?: readonly string[],
+ platform: NodeJS.Platform = process.platform
+): RecipeForwardedEnvSummary {
+ const env = buildRecipeInheritedEnv(source, passEnv, platform)
const names = Object.keys(env)
.filter((name) => name.length > 0 && env[name] !== undefined)
.sort((a, b) => a.localeCompare(b))
return {
count: names.length,
- keyLike: names.filter(looksLikeCredentialEnvName),
- other: names.filter((name) => !looksLikeCredentialEnvName(name))
+ keyLike: names.filter(isRecipeCredentialEnvName),
+ other: names.filter((name) => !isRecipeCredentialEnvName(name)),
+ narrowed: passEnv !== undefined
}
}
diff --git a/src/shared/hosted-sandbox/cloud-workspace-api.ts b/src/shared/hosted-sandbox/cloud-workspace-api.ts
index 0d520260483..5578ec63c7a 100644
--- a/src/shared/hosted-sandbox/cloud-workspace-api.ts
+++ b/src/shared/hosted-sandbox/cloud-workspace-api.ts
@@ -97,11 +97,6 @@ export type OrcaCloudWorkspaceApi = {
repoUrl?: string
setupSessionId?: string
}) => Promise>
- /** "Copy link" for connectGitHub: the same single-use GitHub install page, minted but not opened. */
- gitHubInstallLink: (args?: {
- repoUrl?: string
- setupSessionId?: string
- }) => Promise>
/** Whether the signed-in person connected their own GitHub (cloud commit attribution). */
getGitHubUser: () => Promise>
/** Opens GitHub's OAuth page in the browser so the person connects their own GitHub identity. */
@@ -148,7 +143,6 @@ export const ORCA_CLOUD_WORKSPACE_CHANNELS = {
listCloudWorkspaceIds: 'orcaCloudWorkspace:listIds',
getConfig: 'orcaCloudWorkspace:getConfig',
connectGitHub: 'orcaCloudWorkspace:connectGitHub',
- gitHubInstallLink: 'orcaCloudWorkspace:gitHubInstallLink',
getGitHubUser: 'orcaCloudWorkspace:getGitHubUser',
connectGitHubUser: 'orcaCloudWorkspace:connectGitHubUser',
gitHubUserConnectLink: 'orcaCloudWorkspace:gitHubUserConnectLink',
diff --git a/src/shared/orca-account-mfa.ts b/src/shared/orca-account-mfa.ts
new file mode 100644
index 00000000000..2274d9784eb
--- /dev/null
+++ b/src/shared/orca-account-mfa.ts
@@ -0,0 +1,27 @@
+// The signed-in person's own two-factor state for their Orca account. The identity provider owns
+// the factor; Orca only reads whether one is set and where to manage it.
+export type OrcaAccountMfa = {
+ mfa: 'on' | 'off'
+ /** Opens the account's security page in the browser. Checked in main: Orca Cloud's own origin. */
+ setupUrl: string
+}
+
+export type OrcaAccountMfaResult =
+ | ({ status: 'ok' } & OrcaAccountMfa)
+ /** `unsupported`: this Orca Cloud deployment (or local dev auth) has no MFA status. */
+ | { status: 'unconfigured' | 'reconnect-required' | 'unsupported' }
+ | { status: 'failed'; error: string }
+
+/**
+ * A team member's two-factor state as owners and admins see it. Absent for everyone else, and
+ * for a member the provider said nothing about. 'pending': a team policy requires it by the
+ * member's `mfaDeadline` and they have not set it up.
+ */
+export type OrcaOrgMemberMfa = 'on' | 'off' | 'pending'
+
+/** The two-factor fields of a team member (OrcaOrgMember in orca-profiles.ts). */
+export type OrcaOrgMemberMfaFields = {
+ mfa?: OrcaOrgMemberMfa
+ /** Epoch ms the member must have MFA by; only with `mfa: 'pending'`. */
+ mfaDeadline?: number
+}
diff --git a/src/shared/orca-profiles.ts b/src/shared/orca-profiles.ts
index 7704c8aee72..1f8d3daf904 100644
--- a/src/shared/orca-profiles.ts
+++ b/src/shared/orca-profiles.ts
@@ -1,3 +1,4 @@
+import type { OrcaOrgMemberMfaFields } from './orca-account-mfa'
import './constants'
import { ORCA_BROWSER_PARTITION } from './browser/browser-session-partition'
import type { ExecutionHostId } from './execution-host'
@@ -250,7 +251,8 @@ export type RefreshCurrentOrcaProfileAuthResult =
// Mirror the server’s fixed role enum so UI options cannot drift from accepted API values.
export type OrcaOrgRole = 'owner' | 'admin' | 'member'
-export type OrcaOrgMember = {
+// Two-factor state (owners and admins only) lives in OrcaOrgMemberMfaFields.
+export type OrcaOrgMember = OrcaOrgMemberMfaFields & {
// Provisioned teammates without sign-in have no userId; disable mutations requiring that key.
userId: string | null
email: string
diff --git a/src/shared/orca-team-mfa-policy.ts b/src/shared/orca-team-mfa-policy.ts
new file mode 100644
index 00000000000..7e86956b4ed
--- /dev/null
+++ b/src/shared/orca-team-mfa-policy.ts
@@ -0,0 +1,66 @@
+// A team's "require MFA" policy (Enterprise). The auth service owns it; the desktop reads the
+// deadline and the person's own state for the banner and the blocked screen, and owners and
+// admins set it from Settings, Enterprise.
+
+/** Enforce now, or after a grace period in days. Mirrors the server's fixed choices. */
+export const ORCA_TEAM_MFA_GRACE_CHOICES = ['now', 7, 14, 30] as const
+export type OrcaTeamMfaGrace = (typeof ORCA_TEAM_MFA_GRACE_CHOICES)[number]
+
+/**
+ * The person's own state in this team:
+ * - `pending`: the team requires MFA, they have none, the deadline has not passed.
+ * - `blocked`: the deadline passed; the team's workspaces and settings are closed to them.
+ * - `unknown`: the identity provider did not say; never treated as blocked.
+ */
+export type OrcaTeamMfaSelfState = 'on' | 'off' | 'pending' | 'blocked' | 'unknown'
+
+export type OrcaTeamMfaPolicy = {
+ /** Null when the team has no policy in force. */
+ policy: { enforceAt: number; setAt: number } | null
+ self: OrcaTeamMfaSelfState
+ /** The account's security page, on Orca Cloud's own origin (checked in main). */
+ setupUrl: string
+ /** Owners and admins only. */
+ manage?: {
+ /** The team's plan includes MFA enforcement. */
+ available: boolean
+ pendingMembers: number
+ /** A stored policy the plan no longer covers: it enforces nothing. */
+ inactiveEnforceAt?: number
+ }
+}
+
+export type OrcaTeamMfaPendingMember = {
+ userId: string | null
+ email: string
+ displayName?: string
+ mfa: 'pending' | 'blocked' | 'off'
+}
+
+type Unavailable =
+ | { status: 'unconfigured' | 'reconnect-required' | 'unsupported' | 'forbidden' | 'rate-limited' }
+ | { status: 'failed'; error: string }
+
+export type OrcaTeamMfaPolicyResult = ({ status: 'ok' } & OrcaTeamMfaPolicy) | Unavailable
+
+export type OrcaTeamMfaPolicySetResult =
+ | { status: 'ok'; policy: { enforceAt: number; setAt: number } | null; pendingMembers: number }
+ /** The person changing the policy has no MFA themselves; the policy read has the setup link. */
+ | { status: 'actor-needs-mfa' }
+ /** The team's plan does not include MFA enforcement. */
+ | { status: 'not-entitled' }
+ | Unavailable
+
+export type OrcaTeamMfaPendingResult =
+ | { status: 'ok'; members: OrcaTeamMfaPendingMember[] }
+ | Unavailable
+
+export type OrcaTeamMfaRemindResult =
+ /** `delivery: 'log'` means the server recorded the reminder but sent no email. */
+ | { status: 'ok'; recipients: number; delivery: 'log' | 'test-inbox' | 'unknown' }
+ | { status: 'no-policy' | 'not-found' }
+ | Unavailable
+
+export type OrcaTeamMfaPolicyArgs = { orgId: string }
+export type OrcaTeamMfaPolicySetArgs = { orgId: string; enforce: OrcaTeamMfaGrace | 'off' }
+export type OrcaTeamMfaRemindArgs = { orgId: string; userId?: string }
diff --git a/src/shared/sidebar-list/sidebar-row-plan.ts b/src/shared/sidebar-list/sidebar-row-plan.ts
index 68dbcda8e62..195a5d30651 100644
--- a/src/shared/sidebar-list/sidebar-row-plan.ts
+++ b/src/shared/sidebar-list/sidebar-row-plan.ts
@@ -212,8 +212,10 @@ export function planSidebarRows(inputs: SidebarRowPlanInputs) {
const naturalWorktrees = orderedGroups.flatMap(([, group]) => group.items)
const render = (collapsedGroups: Set): Row[] => {
const result: Row[] = []
- if (groupBy !== 'repo') {
- for (const creation of pendingCreations) {
+ // By project, a create sits atop its own project; one with no project here yet (a GitHub-only
+ // Orca Cloud create, GH-CREATE-NO-ROW) sits atop the list, as in every other grouping.
+ for (const creation of pendingCreations) {
+ if (groupBy !== 'repo' || !repoMap.has(creation.repoId)) {
result.push(buildPendingCreationRow(creation, repoMap))
}
}
diff --git a/src/shared/sidebar-list/worktree-grouping.ts b/src/shared/sidebar-list/worktree-grouping.ts
index ad1d8dd639b..387aa316f96 100644
--- a/src/shared/sidebar-list/worktree-grouping.ts
+++ b/src/shared/sidebar-list/worktree-grouping.ts
@@ -71,7 +71,8 @@ export function buildOrderedGroups(args: {
([repoId, candidate]) => [repoId, candidate.repo] as const
)
],
- pendingRepoIds: pendingByRepo.keys(),
+ // A create with no project here yet sits atop the list instead (GH-CREATE-NO-ROW).
+ pendingRepoIds: [...pendingByRepo.keys()].filter((repoId) => repoMap.has(repoId)),
repoOrder,
projectOrderBy
})