diff --git a/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStrip.fixture.tsx b/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStrip.fixture.tsx
index cf5266e2f0d..42604db7add 100644
--- a/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStrip.fixture.tsx
+++ b/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStrip.fixture.tsx
@@ -11,7 +11,10 @@ import {
type CloudStripActions
} from './CloudAgentSignInStrip'
import { cloudAgentStripModel } from './cloud-agent-strip-model'
-import { cloudAgentSetupStripModel } from './cloud-agent-setup-strip-model'
+import {
+ cloudAgentAwaitingStartStripModel,
+ cloudAgentSetupStripModel
+} from './cloud-agent-setup-strip-model'
import type { OrcaCloudAgentSetup } from '../../../../shared/orca-cloud-agents/orca-cloud-agents-wire'
import { cloudRestartAttemptModel, cloudRunningStripModel } from './cloud-running-strip-model'
import type { CloudAgentRestartAttempt } from '@/lib/orca-cloud/cloud-agent-restart-attempt'
@@ -272,3 +275,59 @@ export const notSetUpBrowserCodeGapNarrow = fixture({
setUp: { setup: { phase: 'browser', startedAt: 0, canReopen: false, code: 'rejected' } },
width: 420
})
+
+/** V3-01: restored after a restart; the account covers Claude; the first prompt waits. */
+export const awaitingStartCovered = defineFixture({
+ width: 940,
+ render: () =>
+})
+/** V3-01: restored; Orca couldn't read the sign-in after restarting. */
+export const awaitingStartUnread = defineFixture({
+ width: 940,
+ render: () =>
+})
+/** V3-01: a restored expired hold, renewed: no auto-start, Start waits. */
+export const awaitingStartRenewed = defineFixture({
+ width: 940,
+ render: () =>
+})
+export const awaitingStartUnreadNarrow = defineFixture({
+ width: 460,
+ render: () =>
+})
+
+function AwaitingPane({
+ awaiting,
+ queuedPrompt,
+ width = 900
+}: {
+ awaiting: 'covered' | 'unread' | 'renewed'
+ queuedPrompt: boolean
+ width?: number
+}): React.JSX.Element {
+ return (
+
+ )
+}
diff --git a/src/renderer/src/components/agent-sign-in-strip/cloud-agent-setup-strip-model.ts b/src/renderer/src/components/agent-sign-in-strip/cloud-agent-setup-strip-model.ts
index f7ca5a47f0b..549ff3d28f6 100644
--- a/src/renderer/src/components/agent-sign-in-strip/cloud-agent-setup-strip-model.ts
+++ b/src/renderer/src/components/agent-sign-in-strip/cloud-agent-setup-strip-model.ts
@@ -222,3 +222,60 @@ export function cloudAgentSetupStripModel(args: {
}
}
}
+
+/**
+ * V3-01: a launch put back after a restart that only needs the person's Start: the account covers
+ * the agent, Orca couldn't read it, or an expired sign-in was just renewed. Neutral, never "isn't
+ * set up"; Start launches it (a start that then finds no account holds as "isn't set up" again).
+ */
+export function cloudAgentAwaitingStartStripModel(args: {
+ agent: HostAgentSignInAgent
+ awaiting: 'covered' | 'unread' | 'renewed'
+ /** A first prompt waits with the launch. */
+ queuedPrompt: boolean
+ t: Translate
+}): CloudStripModel {
+ const { t } = args
+ const agent = HOST_AGENT_SIGN_IN_AGENT_NAME[args.agent]
+ const title =
+ args.awaiting === 'covered'
+ ? t('agentSignInStrip.awaitingCoveredTitle', '{{agent}} is set up', { agent })
+ : args.awaiting === 'renewed'
+ ? t('agentSignInStrip.renewed', '{{agent}} sign-in renewed', { agent })
+ : t('agentSignInStrip.awaitingUnreadTitle', '{{agent}} hasn’t started', { agent })
+ const detail =
+ args.awaiting === 'unread'
+ ? t(
+ 'agentSignInStrip.awaitingUnreadDetail',
+ 'Orca couldn’t check your sign-in after restarting. Start {{agent}} to try.',
+ { agent }
+ )
+ : args.awaiting === 'covered'
+ ? args.queuedPrompt
+ ? t(
+ 'agentSignInStrip.awaitingCoveredPromptDetail',
+ 'Orca restarted before {{agent}} started. Your first prompt is kept.',
+ { agent }
+ )
+ : t(
+ 'agentSignInStrip.awaitingCoveredDetail',
+ 'Orca restarted before {{agent}} started.',
+ { agent }
+ )
+ : ''
+ return {
+ status: 'setup',
+ title,
+ detail,
+ description: null,
+ code: null,
+ paste: null,
+ otherWays: false,
+ primary: {
+ label: t('agentSignInStrip.startAgent', 'Start {{agent}}', { agent }),
+ narrowLabel: t('agentSignInStrip.start', 'Start'),
+ action: { kind: 'start' }
+ },
+ announcement: detail ? `${title}. ${detail}` : title
+ }
+}
diff --git a/src/renderer/src/components/agent-sign-in-strip/cloud-chat-banners.test.tsx b/src/renderer/src/components/agent-sign-in-strip/cloud-chat-banners.test.tsx
index 702ae64b270..c437665c201 100644
--- a/src/renderer/src/components/agent-sign-in-strip/cloud-chat-banners.test.tsx
+++ b/src/renderer/src/components/agent-sign-in-strip/cloud-chat-banners.test.tsx
@@ -255,6 +255,9 @@ describe('the chat composer while a cloud launch is held', () => {
expect(cloudChatHoldHint({ agent: 'claude', reason: 'notSetUp' }, null, t)).toBe(
'Set up Claude above to start'
)
+ expect(cloudChatHoldHint({ agent: 'claude', reason: 'awaitingStart' }, null, t)).toBe(
+ 'Start Claude above to begin'
+ )
expect(cloudChatHoldHint({ agent: 'claude', reason: 'accountExpired' }, null, t)).toBe(
'Renew Claude sign-in above to start'
)
diff --git a/src/renderer/src/components/agent-sign-in-strip/use-cloud-chat-hold-hint.ts b/src/renderer/src/components/agent-sign-in-strip/use-cloud-chat-hold-hint.ts
index e4b39c0f36e..1c95c7190d4 100644
--- a/src/renderer/src/components/agent-sign-in-strip/use-cloud-chat-hold-hint.ts
+++ b/src/renderer/src/components/agent-sign-in-strip/use-cloud-chat-hold-hint.ts
@@ -22,7 +22,9 @@ export function cloudChatHoldHint(
const agent = agentName(hold.agent, t)
return hold.reason === 'notSetUp'
? t('orcaCloud.chatHold.notSetUp', 'Set up {{agent}} above to start', { agent })
- : t('orcaCloud.chatHold.expired', 'Renew {{agent}} sign-in above to start', { agent })
+ : hold.reason === 'awaitingStart'
+ ? t('orcaCloud.chatHold.awaitingStart', 'Start {{agent}} above to begin', { agent })
+ : t('orcaCloud.chatHold.expired', 'Renew {{agent}} sign-in above to start', { agent })
}
if (gate && isOrcaCloudEnvironmentId(gate.environmentId)) {
return t('orcaCloud.chatHold.signIn', 'Sign in to {{agent}} above to start', {
diff --git a/src/renderer/src/components/agent-sign-in-strip/use-cloud-held-strip.ts b/src/renderer/src/components/agent-sign-in-strip/use-cloud-held-strip.ts
index d24bc75f8d7..af85fa99da0 100644
--- a/src/renderer/src/components/agent-sign-in-strip/use-cloud-held-strip.ts
+++ b/src/renderer/src/components/agent-sign-in-strip/use-cloud-held-strip.ts
@@ -16,7 +16,10 @@ import { useOrcaCloudAgentAccounts } from '@/lib/orca-cloud/orca-cloud-agent-acc
import { agentSignInCardActions } from '../agent-sign-in/AgentSignInPanePortals'
import type { CloudStripActions } from './CloudAgentSignInStrip'
import { cloudAgentStripModel, type CloudStripModel } from './cloud-agent-strip-model'
-import { cloudAgentSetupStripModel } from './cloud-agent-setup-strip-model'
+import {
+ cloudAgentAwaitingStartStripModel,
+ cloudAgentSetupStripModel
+} from './cloud-agent-setup-strip-model'
import { cloudSetupStripActions } from './cloud-setup-strip-actions'
export type CloudHeldStrip = {
@@ -60,22 +63,31 @@ export function useCloudHeldStrip(
: 'paused'
const gateActions = agentSignInCardActions(paneKey)
// PC-3b: a launch held because the agent isn't set up runs the one-time setup in the pane.
- const setupHold = hold?.reason === 'notSetUp'
+ const awaiting = hold?.reason === 'awaitingStart' ? (hold.awaiting ?? 'unread') : null
+ // V3-01: a restored hold waiting for Start shares the setup hold's actions (Start, cancel).
+ const setupHold = hold?.reason === 'notSetUp' || awaiting !== null
const setup = accounts.setups[agent]
- const model = setupHold
- ? cloudAgentSetupStripModel({
+ const model = awaiting
+ ? cloudAgentAwaitingStartStripModel({
agent,
- setup,
- ready: accounts.load.kind === 'ready' && cloudAgentHoldReason(agent, accounts) === null,
- t
- })
- : cloudAgentStripModel({
- agent,
- reason,
- view: hold ? null : (cloudGate?.view ?? null),
- hostLabel: cloudGate?.hostLabel ?? t('agentSignInStrip.sandbox', 'the sandbox'),
+ awaiting,
+ queuedPrompt: Boolean(hold?.prompt),
t
})
+ : setupHold
+ ? cloudAgentSetupStripModel({
+ agent,
+ setup,
+ ready: accounts.load.kind === 'ready' && cloudAgentHoldReason(agent, accounts) === null,
+ t
+ })
+ : cloudAgentStripModel({
+ agent,
+ reason,
+ view: hold ? null : (cloudGate?.view ?? null),
+ hostLabel: cloudGate?.hostLabel ?? t('agentSignInStrip.sandbox', 'the sandbox'),
+ t
+ })
const holdActions: CloudStripActions | null = setupHold
? cloudSetupStripActions({
agent,
diff --git a/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.fixture.tsx b/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.fixture.tsx
index 2d2a2dfe7d0..982913affc7 100644
--- a/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.fixture.tsx
+++ b/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.fixture.tsx
@@ -6,13 +6,13 @@ import { setOrcaCloudAgentAccountsStateForTest } from '@/lib/orca-cloud/orca-clo
import { CloudAgentHeldMark } from './CloudAgentHeldMark'
// A cloud workspace row whose Claude waits on its pane's "Set up once" strip (N-03).
-function seed(): void {
+function seed(restored = false): void {
setOrcaCloudAgentAccountsStateForTest({
load: {
kind: 'ready',
status: {
credentials: {
- claude: { state: 'none' },
+ claude: { state: restored ? 'active' : 'none' },
codex: { state: 'none' },
providerEnabled: { claude: true, codex: true }
},
@@ -29,6 +29,7 @@ function seed(): void {
})
void holdCloudAgentLaunch({
decided: true,
+ restored,
paneKey: 'tab:web-terminal-g',
agent: 'claude',
prompt: null
@@ -45,21 +46,29 @@ function Row(): React.JSX.Element {
)
}
-export const sidebarRowMark = defineFixture({
- width: 340,
- render: () => {
- seed()
- return (
-
-
-
- )
- },
- interact: async (frame: HTMLElement) => {
- await new Promise((resolve) => setTimeout(resolve, 50))
- const mark = frame.querySelector('[data-cloud-agent-held]')
- mark?.dispatchEvent(new PointerEvent('pointermove', { bubbles: true }))
- mark?.dispatchEvent(new PointerEvent('pointerenter', { bubbles: true }))
- await new Promise((resolve) => setTimeout(resolve, 900))
- }
-})
+const markFixture = (restored: boolean) =>
+ defineFixture({
+ width: 340,
+ render: () => {
+ seed(restored)
+ return (
+
+
+
+ )
+ },
+ interact: async (frame: HTMLElement) => {
+ await new Promise((resolve) => setTimeout(resolve, 50))
+ const mark = frame.querySelector('[data-cloud-agent-held]')
+ mark?.dispatchEvent(new PointerEvent('pointermove', { bubbles: true }))
+ mark?.dispatchEvent(new PointerEvent('pointerenter', { bubbles: true }))
+ await new Promise((resolve) => setTimeout(resolve, 900))
+ }
+ })
+
+export const sidebarRowMark = markFixture(false)
+/**
+ * V3-01: a launch put back after a restart that only waits for Start: the muted play mark, never
+ * the amber key (the account here is covered: no "not set up").
+ */
+export const sidebarRowMarkNotStarted = markFixture(true)
diff --git a/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.tsx b/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.tsx
index e3016f06040..1c8e15bc7c4 100644
--- a/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.tsx
+++ b/src/renderer/src/components/orca-cloud/CloudAgentHeldMark.tsx
@@ -1,5 +1,6 @@
import React from 'react'
-import { KeyRound } from 'lucide-react'
+import { CirclePlay, KeyRound } from 'lucide-react'
+import { cn } from '@/lib/class-names'
import { useAppStore } from '@/store'
import { useTranslate } from '@/i18n/use-translate'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
@@ -39,10 +40,19 @@ export function CloudAgentHeldMark({
return null
}
const agent = agentName(hold.agent, t)
- const label =
- hold.reason === 'accountExpired'
+ const waiting = hold.reason === 'awaitingStart'
+ const label = waiting
+ ? t(
+ 'orcaCloud.agentHold.notStarted',
+ '{{agent}} hasn’t started. Open the workspace to start it.',
+ {
+ agent
+ }
+ )
+ : hold.reason === 'accountExpired'
? t('orcaCloud.agentHold.expired', '{{agent}} sign-in expired', { agent })
: t('orcaCloud.agentHold.notSetUp', '{{agent}} isn’t set up for Orca Cloud', { agent })
+ const Icon = waiting ? CirclePlay : KeyRound
return (
@@ -50,9 +60,13 @@ export function CloudAgentHeldMark({
role="img"
aria-label={label}
data-cloud-agent-held={hold.reason}
- className="inline-flex size-3.5 shrink-0 items-center justify-center text-status-warning-text"
+ className={cn(
+ 'inline-flex size-3.5 shrink-0 items-center justify-center',
+ // V3-01: a restored launch waiting for Start is no alarm: muted, not the amber key.
+ waiting ? 'text-muted-foreground' : 'text-status-warning-text'
+ )}
>
-
+
diff --git a/src/renderer/src/components/orca-cloud/CloudWorkspaceCard.fixture.tsx b/src/renderer/src/components/orca-cloud/CloudWorkspaceCard.fixture.tsx
index 614a4acaee4..73549ad9bb7 100644
--- a/src/renderer/src/components/orca-cloud/CloudWorkspaceCard.fixture.tsx
+++ b/src/renderer/src/components/orca-cloud/CloudWorkspaceCard.fixture.tsx
@@ -147,6 +147,11 @@ export const runningSignInExpired = card({
id: 'card-expired',
attention: { kind: 'agentExpired', agent: 'Claude', tabId: 'tab-1' }
})
+/** V3-01: a launch put back after a restart that waits for Start: neutral, below the warnings. */
+export const runningNotStarted = card({
+ id: 'card-not-started',
+ attention: { kind: 'agentNotStarted', agent: 'Claude', tabId: 'tab-1' }
+})
/** Details open: the bars, uptime and sandbox hours. */
export const detailsOpen = card({ id: 'card-details', details: true })
/** The sub-panel with the mirror off: the two switches and the .context status. */
diff --git a/src/renderer/src/components/orca-cloud/CloudWorkspaceStatusPanel.tsx b/src/renderer/src/components/orca-cloud/CloudWorkspaceStatusPanel.tsx
index 88cc03d8361..4484569d636 100644
--- a/src/renderer/src/components/orca-cloud/CloudWorkspaceStatusPanel.tsx
+++ b/src/renderer/src/components/orca-cloud/CloudWorkspaceStatusPanel.tsx
@@ -43,6 +43,7 @@ import { CloudWorkspaceCardMenu } from './CloudWorkspaceCardMenu'
import { useCloudOfflineData } from './offline/use-cloud-offline-data'
import {
cloudCardAttentionLabel,
+ cloudCardAttentionTone,
cloudCardOnComputerStatus,
cloudCardPrimary,
cloudCardStateDetail,
@@ -300,11 +301,11 @@ export function CloudWorkspaceStatusPanel({
{attention ? (
diff --git a/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.test.ts b/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.test.ts
index 3d20a63136e..fa4e97e9d59 100644
--- a/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.test.ts
+++ b/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.test.ts
@@ -7,6 +7,7 @@ import {
cloudCardStateDetail,
cloudCardUsageLine,
cloudCardAttentionLabel,
+ cloudCardAttentionTone,
mostUrgentAttention,
pickWorkspaceAgentSignIn,
signInAttention
@@ -120,3 +121,22 @@ describe('card attention for a running agent’s lapsed sign-in (n15)', () => {
expect(row([])).toBeNull()
})
})
+
+describe('a launch put back after a restart that waits for Start (V3-01)', () => {
+ const notStarted = { kind: 'agentNotStarted' as const, agent: 'Claude', tabId: 't' }
+
+ it('reads "hasn’t started" in neutral colours, never "isn’t set up" or a warning', () => {
+ expect(cloudCardAttentionLabel(notStarted, t)).toBe('Claude hasn’t started')
+ expect(cloudCardAttentionTone(notStarted).text).toBe('text-foreground')
+ expect(cloudCardAttentionTone(notStarted).dot).toContain('bg-muted-foreground')
+ expect(
+ cloudCardAttentionTone({ kind: 'agentNotSetUp', agent: 'Claude', tabId: 't' }).text
+ ).toBe('text-status-warning-text')
+ })
+
+ it('ranks below an agent that can’t start, above commits and pushes being off', () => {
+ const expired = { kind: 'agentExpired' as const, agent: 'Claude', tabId: 't' }
+ expect(mostUrgentAttention([notStarted, expired])).toBe(expired)
+ expect(mostUrgentAttention([{ kind: 'gitSetupOff' }, notStarted])).toBe(notStarted)
+ })
+})
diff --git a/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.ts b/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.ts
index 98b14731ef6..9ba51af078b 100644
--- a/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.ts
+++ b/src/renderer/src/components/orca-cloud/cloud-workspace-card-model.ts
@@ -63,6 +63,8 @@ export function cloudCardUsageLine(
export type CloudCardAttention =
| { kind: 'agentNotSetUp'; agent: string; tabId: string }
| { kind: 'agentExpired'; agent: string; tabId: string }
+ /** V3-01: a launch put back after a restart that waits for the person's Start (neutral). */
+ | { kind: 'agentNotStarted'; agent: string; tabId: string }
/** GIT-SETUP: the teammates' git identities couldn't be installed; commits and pushes are off. */
| { kind: 'gitSetupOff' }
| { kind: 'secretsMissing'; count: number }
@@ -71,6 +73,8 @@ const URGENCY: Record = {
// An agent that can't start blocks the work the workspace was made for.
agentNotSetUp: 0,
agentExpired: 1,
+ // Below an agent that can't start, above commits and pushes being off (design-squad).
+ agentNotStarted: 1.5,
// Below an agent that can't start, above missing secrets (design-squad).
gitSetupOff: 2,
secretsMissing: 3
@@ -89,6 +93,13 @@ export function mostUrgentAttention(
return best
}
+/** The row's colours: a launch waiting for Start (V3-01) is neutral info, everything else a warning. */
+export function cloudCardAttentionTone(item: CloudCardAttention): { text: string; dot: string } {
+ return item.kind === 'agentNotStarted'
+ ? { text: 'text-foreground', dot: 'size-1.5 shrink-0 rounded-full bg-muted-foreground' }
+ : { text: 'text-status-warning-text', dot: 'size-1.5 shrink-0 rounded-full bg-status-warning' }
+}
+
export function cloudCardAttentionLabel(item: CloudCardAttention, t: Translate): string {
switch (item.kind) {
case 'agentNotSetUp':
@@ -97,6 +108,10 @@ export function cloudCardAttentionLabel(item: CloudCardAttention, t: Translate):
})
case 'agentExpired':
return t('orcaCloud.agentHold.expired', '{{agent}} sign-in expired', { agent: item.agent })
+ case 'agentNotStarted':
+ return t('orcaCloud.agentHold.notStartedRow', '{{agent}} hasn’t started', {
+ agent: item.agent
+ })
case 'gitSetupOff':
return t('orcaCloudWorkspace.card.gitSetupOff', 'Commits and pushes are off')
case 'secretsMissing':
diff --git a/src/renderer/src/components/orca-cloud/use-cloud-workspace-card-state.ts b/src/renderer/src/components/orca-cloud/use-cloud-workspace-card-state.ts
index 44071dac19f..eb1ce6c172b 100644
--- a/src/renderer/src/components/orca-cloud/use-cloud-workspace-card-state.ts
+++ b/src/renderer/src/components/orca-cloud/use-cloud-workspace-card-state.ts
@@ -50,7 +50,12 @@ export function useCloudCardAttention(workspaceId: string): CloudCardAttention |
return mostUrgentAttention([
hold
? {
- kind: hold.reason === 'accountExpired' ? 'agentExpired' : 'agentNotSetUp',
+ kind:
+ hold.reason === 'accountExpired'
+ ? 'agentExpired'
+ : hold.reason === 'awaitingStart'
+ ? 'agentNotStarted'
+ : 'agentNotSetUp',
agent: agentName(hold.agent, t),
tabId: cloudAgentHoldTabId(hold.paneKey)
}
@@ -72,6 +77,7 @@ export function openCloudCardAttention(workspaceId: string, item: CloudCardAtten
switch (item.kind) {
case 'agentNotSetUp':
case 'agentExpired':
+ case 'agentNotStarted':
activateAndRevealWorktree(workspaceId)
useAppStore.getState().setActiveTab(item.tabId)
return
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 4a694aa6855..26335e4cd53 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -28238,7 +28238,9 @@
"orcaCloud": {
"agentHold": {
"notSetUp": "{{agent}} isn’t set up for Orca Cloud",
- "expired": "{{agent}} sign-in expired"
+ "expired": "{{agent}} sign-in expired",
+ "notStarted": "{{agent}} hasn’t started. Open the workspace to start it.",
+ "notStartedRow": "{{agent}} hasn’t started"
},
"chatSignIn": {
"renewAbove": "Your {{agent}} sign-in for Orca Cloud didn’t work. Renew it above, then send your message again."
@@ -28246,7 +28248,8 @@
"chatHold": {
"notSetUp": "Set up {{agent}} above to start",
"expired": "Renew {{agent}} sign-in above to start",
- "signIn": "Sign in to {{agent}} above to start"
+ "signIn": "Sign in to {{agent}} above to start",
+ "awaitingStart": "Start {{agent}} above to begin"
},
"continueOffer": {
"title": "An agent was interrupted by the restart",
@@ -28890,6 +28893,11 @@
"renewed": "{{agent}} sign-in renewed",
"renewedResume": "Restart {{agent}} to pick up where you left off.",
"renewedFresh": "Starts a new conversation.",
+ "awaitingCoveredTitle": "{{agent}} is set up",
+ "awaitingUnreadTitle": "{{agent}} hasn’t started",
+ "awaitingUnreadDetail": "Orca couldn’t check your sign-in after restarting. Start {{agent}} to try.",
+ "awaitingCoveredPromptDetail": "Orca restarted before {{agent}} started. Your first prompt is kept.",
+ "awaitingCoveredDetail": "Orca restarted before {{agent}} started.",
"renewedChat": "Your next message uses it.",
"renewedChatAnnounce": "{{agent}} sign-in renewed. Your next message uses it.",
"restart": "Restart",
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 e740c6cab65..7da3b8ffb27 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
@@ -39,7 +39,14 @@ export function cloudAgentStripReason(
}
/** Why a launch is held: account recovery, or the one-time setup (PC-3b). */
-export type CloudAgentHoldReason = 'accountExpired' | 'notSetUp'
+export type CloudAgentHoldReason =
+ | 'accountExpired'
+ | 'notSetUp'
+ /**
+ * V3-01: a hold put back after a restart whose account now covers the agent (or whose read
+ * failed): it waits for the person's Start. Never labelled "not set up" or "expired".
+ */
+ | 'awaitingStart'
/** The hold a launch needs from this accounts read; null starts it. */
export function cloudAgentHoldReason(
@@ -80,6 +87,11 @@ export type CloudAgentHold = {
agent: HostAgentSignInAgent
prompt: string | null
reason: CloudAgentHoldReason
+ /**
+ * Why an 'awaitingStart' hold waits: the account covers the agent now, Orca couldn't read it,
+ * or an expired sign-in was renewed (V3-01). Absent for every other reason.
+ */
+ awaiting?: 'covered' | 'unread' | 'renewed'
}
/** The hold key of a host-published tab (RA-1): its first pane shows the strip. */
@@ -87,9 +99,15 @@ export function cloudTabHoldKey(tabId: string): string {
return `tab:${tabId}`
}
-type HoldRequest = Omit & {
+type HoldRequest = Omit & {
/** The caller already read the account and decided to hold; skip the re-read. */
decided?: boolean
+ /**
+ * V3-01: a hold put back after a restart always waits for the person's explicit Start: a covered
+ * account (or a failed read) holds as 'awaitingStart', and an expired one that is then renewed
+ * turns 'awaitingStart' instead of starting. In-session holds keep their behaviour.
+ */
+ restored?: boolean
}
type Entry = CloudAgentHold & { release: (outcome: 'proceed' | 'cancel') => void }
@@ -101,11 +119,12 @@ const listeners = new Set<() => void>()
let holdsSnapshot: readonly CloudAgentHold[] = []
function notify(): void {
- holdsSnapshot = [...holds.values()].map(({ paneKey, agent, prompt, reason }) => ({
+ holdsSnapshot = [...holds.values()].map(({ paneKey, agent, prompt, reason, awaiting }) => ({
paneKey,
agent,
prompt,
- reason
+ reason,
+ ...(awaiting ? { awaiting } : {})
}))
for (const listener of listeners) {
listener()
@@ -215,25 +234,53 @@ async function holdReasonBeforeLaunch(
*/
export async function holdCloudAgentLaunch({
decided,
+ restored,
...hold
}: HoldRequest): Promise<'proceed' | 'cancel'> {
// The caller's read decided to hold; if it no longer does, start rather than wait on a strip.
- const reason = decided
+ const read = decided
? cloudAgentHoldReason(hold.agent, readOrcaCloudAgentAccounts())
: await holdReasonBeforeLaunch(hold.agent)
+ const reason = read ?? (restored ? 'awaitingStart' : null)
if (!reason) {
return 'proceed'
}
+ const accountsRead = readOrcaCloudAgentAccounts().load.kind === 'ready'
+ const awaiting =
+ reason === 'awaitingStart' ? (accountsRead ? ('covered' as const) : ('unread' as const)) : null
return new Promise((resolve) => {
const stop = subscribeOrcaCloudAgentAccounts(() => {
// Renewed (or a key now covers it): every pane held on recovery starts. A first-time setup
// waits for its "Start {{agent}}" click instead (PC-3b), so it never starts unasked.
- if (
- reason === 'accountExpired' &&
- cloudAgentStripReason(hold.agent, readOrcaCloudAgentAccounts()) !== 'accountExpired'
- ) {
- finish('proceed')
+ const entry = holds.get(hold.paneKey)
+ if (entry?.release !== finish || entry.reason !== 'accountExpired') {
+ return
}
+ const accounts = readOrcaCloudAgentAccounts()
+ const now = accounts.load.kind === 'ready' ? cloudAgentHoldReason(hold.agent, accounts) : null
+ if (accounts.load.kind !== 'ready' || now === 'accountExpired') {
+ return
+ }
+ if (now === 'notSetUp') {
+ // The sign-in was removed, not renewed: nothing covers the agent, so it never starts here;
+ // the hold becomes the one-time setup.
+ holds.set(hold.paneKey, { ...entry, reason: 'notSetUp' })
+ notify()
+ return
+ }
+ // Only a real renewal (the account or a key covers it) starts it; a paused or withdrawn agent
+ // (kill switch, never offered) or an unknown coverage stays held.
+ const coverage = orcaCloudAgentCoverageFromAccounts(hold.agent, accounts)?.kind
+ if (coverage !== 'account' && coverage !== 'key') {
+ return
+ }
+ if (restored) {
+ // After a restart the person starts it: renewed, it waits for Start (V3-01).
+ holds.set(hold.paneKey, { ...entry, reason: 'awaitingStart', awaiting: 'renewed' })
+ notify()
+ return
+ }
+ finish('proceed')
})
function finish(outcome: 'proceed' | 'cancel'): void {
if (holds.get(hold.paneKey)?.release !== finish) {
@@ -244,7 +291,7 @@ export async function holdCloudAgentLaunch({
notify()
resolve(outcome)
}
- holds.set(hold.paneKey, { ...hold, reason, release: finish })
+ holds.set(hold.paneKey, { ...hold, reason, ...(awaiting ? { awaiting } : {}), release: finish })
notify()
})
}
diff --git a/src/renderer/src/lib/orca-cloud/cloud-held-launch-memory.ts b/src/renderer/src/lib/orca-cloud/cloud-held-launch-memory.ts
new file mode 100644
index 00000000000..e2769be85cc
--- /dev/null
+++ b/src/renderer/src/lib/orca-cloud/cloud-held-launch-memory.ts
@@ -0,0 +1,103 @@
+// V3-01: a held Orca Cloud launch waits in a plain-shell placeholder tab on the host, and the hold
+// itself lives only in memory (cloud-agent-launch-hold). A quit loses it: the placeholder comes back
+// as a plain shell with no strip and no way to start the agent. This keeps one record per held
+// placeholder so a restart can put the hold back. Per Orca profile, on this device; never the
+// launch's env, command or secrets, only what re-planning the launch needs.
+import { useAppStore } from '@/store'
+
+export type HeldCloudLaunchRecord = {
+ environmentId: string
+ worktreeId: string
+ /** The placeholder's surface tab id (derived from the host tab id, which the host keeps). */
+ tabId: string
+ agent: 'claude' | 'codex'
+ prompt: string | null
+ cwd: string | null
+ targetGroupId: string | null
+ createdAt: number
+}
+
+const KEY_PREFIX = 'orca.cloudHeldLaunches.v1'
+/** Bounded so a long-lived profile can't grow the record without limit. */
+const MAX_RECORDS = 50
+/**
+ * A record left by a workspace or sandbox deleted while the app was closed never meets its tab
+ * again; it ages out (a restored one is also dropped once its tab doesn't come back).
+ */
+export const HELD_LAUNCH_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000
+
+function storage(): Storage | undefined {
+ return typeof localStorage === 'undefined' ? undefined : localStorage
+}
+
+function storageKey(profileId: string | null): string {
+ return `${KEY_PREFIX}:${profileId ?? 'default'}`
+}
+
+function activeProfileId(): string | null {
+ return useAppStore.getState().activeOrcaProfileId ?? null
+}
+
+function isRecord(value: unknown): value is HeldCloudLaunchRecord {
+ if (typeof value !== 'object' || value === null) {
+ return false
+ }
+ const record: Partial> = value
+ return (
+ typeof record.environmentId === 'string' &&
+ typeof record.worktreeId === 'string' &&
+ typeof record.tabId === 'string' &&
+ (record.agent === 'claude' || record.agent === 'codex') &&
+ (record.prompt === null || typeof record.prompt === 'string') &&
+ (record.cwd === null || typeof record.cwd === 'string') &&
+ (record.targetGroupId === null || typeof record.targetGroupId === 'string') &&
+ typeof record.createdAt === 'number'
+ )
+}
+
+function readAll(profileId: string | null): HeldCloudLaunchRecord[] {
+ try {
+ const raw = storage()?.getItem(storageKey(profileId))
+ const parsed: unknown = raw ? JSON.parse(raw) : []
+ const now = Date.now()
+ return Array.isArray(parsed)
+ ? parsed.filter(isRecord).filter((each) => now - each.createdAt < HELD_LAUNCH_MAX_AGE_MS)
+ : []
+ } catch {
+ return []
+ }
+}
+
+function writeAll(profileId: string | null, records: HeldCloudLaunchRecord[]): void {
+ try {
+ const kept = records.slice(-MAX_RECORDS)
+ if (kept.length === 0) {
+ storage()?.removeItem(storageKey(profileId))
+ } else {
+ storage()?.setItem(storageKey(profileId), JSON.stringify(kept))
+ }
+ } catch {
+ // Storage full or unavailable: the hold still works for this run, it just won't survive a quit.
+ }
+}
+
+/** Remember a held placeholder (replacing any record for the same tab). */
+export function rememberHeldCloudLaunch(record: HeldCloudLaunchRecord): void {
+ const profileId = activeProfileId()
+ writeAll(profileId, [...readAll(profileId).filter((each) => each.tabId !== record.tabId), record])
+}
+
+/** Forget a placeholder's record: its hold settled (Start, cancel) or its tab is gone. */
+export function forgetHeldCloudLaunch(tabId: string): void {
+ const profileId = activeProfileId()
+ const records = readAll(profileId)
+ const kept = records.filter((each) => each.tabId !== tabId)
+ if (kept.length !== records.length) {
+ writeAll(profileId, kept)
+ }
+}
+
+/** The records for one Orca Cloud environment, for the active profile. */
+export function readHeldCloudLaunches(environmentId: string): HeldCloudLaunchRecord[] {
+ return readAll(activeProfileId()).filter((each) => each.environmentId === environmentId)
+}
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
new file mode 100644
index 00000000000..9b74368274c
--- /dev/null
+++ b/src/renderer/src/lib/orca-cloud/cloud-held-launch-restore.test.ts
@@ -0,0 +1,341 @@
+// @vitest-environment happy-dom
+// V3-01: a held Orca Cloud launch survives a quit. Its placeholder is remembered (per profile), and
+// on the next start the hold is put back once the placeholder tab returns: the strip's key and the
+// original prompt come back, Start launches it, Cancel forgets it, and nothing launches unasked.
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { useAppStore } from '@/store'
+import type { CreateWebRuntimeSessionTerminalOnHostArgs } from '@/runtime/hosted-terminals/creation/terminal-create-contracts'
+
+const mocks = vi.hoisted(() => {
+ const state: {
+ coverage: 'notSetUp' | 'covered' | 'expired' | 'killSwitch'
+ /** 'loading' with a failing read: Orca couldn't check the sign-in. */
+ load: 'ready' | 'loading'
+ closed: string[]
+ listeners: Set<() => void>
+ } = {
+ coverage: 'notSetUp',
+ load: 'ready',
+ closed: [],
+ listeners: new Set()
+ }
+ return state
+})
+
+vi.mock('./orca-cloud-environment-id', () => ({
+ isOrcaCloudEnvironmentId: () => true,
+ isOrcaCloudExecutionHostId: () => true
+}))
+vi.mock('./orca-cloud-agent-accounts-store', () => ({
+ readOrcaCloudAgentAccounts: () => ({ load: { kind: mocks.load }, keyKinds: {} }),
+ ensureFreshOrcaCloudAgentAccounts: async () => {
+ if (mocks.load === 'loading') {
+ throw new Error('read failed')
+ }
+ return { load: { kind: 'ready' }, keyKinds: {} }
+ },
+ isOrcaCloudAgentAccountsFresh: () => true,
+ subscribeOrcaCloudAgentAccounts: (listener: () => void) => {
+ mocks.listeners.add(listener)
+ return () => mocks.listeners.delete(listener)
+ }
+}))
+vi.mock('./orca-cloud-agent-accounts-model', async (importOriginal) => ({
+ ...(await importOriginal