From 1fc2526bc2e7253e7ab0780ee23c2f07427098bd Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 Nov 2026 23:47:00 -0800 Subject: [PATCH] feat(cloud): PC-3b composer creates with the agent; the held prompt says it waits (DS-e) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Orca Cloud with an agent that isn't set up now creates WITH the agent: its launch holds on the pane's Set up once strip (#385) and never reaches /login, so the first prompt goes in once the agent is set up and started. The plain terminal fallback (onCreateWithoutAgent / noAgentRef) is gone. - The not-set-up toast shows only away from that workspace (onlyWhenAway); in it, the pane strip asks. - DS-e: the build sheet's queued prompt reads "First prompt for Claude · Sends when the workspace is ready", and "… · Sends once Claude is set up" while the agent's launch is held. --- .../components/NewWorkspaceComposerModal.tsx | 6 +- .../run-on/use-cloud-start-composer.ts | 32 ++++----- .../run-on/use-composer-cloud-start.ts | 8 --- .../orca-cloud/OrcaCloudQueuedPrompt.test.tsx | 44 ++++++++++++ .../orca-cloud/OrcaCloudQueuedPrompt.tsx | 68 +++++++++++++------ src/renderer/src/i18n/locales/en.json | 3 +- 6 files changed, 108 insertions(+), 53 deletions(-) create mode 100644 src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx diff --git a/src/renderer/src/components/NewWorkspaceComposerModal.tsx b/src/renderer/src/components/NewWorkspaceComposerModal.tsx index aa6734edefe..b2633063864 100644 --- a/src/renderer/src/components/NewWorkspaceComposerModal.tsx +++ b/src/renderer/src/components/NewWorkspaceComposerModal.tsx @@ -212,11 +212,8 @@ function QuickTabBody({ [observation.contextKey, orcaCloud] ) - // Orca Cloud with an agent that has no account there starts a plain terminal, never the agent's - // /login: the cloud hook sets this around one create (read before the first await). - const noAgentRef = useRef(false) const handleCreate = useCallback(async (): Promise => { - const agent = noAgentRef.current ? null : quickAgent + const agent = quickAgent if (createDisabled) { return } @@ -280,7 +277,6 @@ function QuickTabBody({ handleCreate, createDisabled, quickAgentPick, - noAgentRef, recordCreatedRef, onClose }) diff --git a/src/renderer/src/components/new-workspace/run-on/use-cloud-start-composer.ts b/src/renderer/src/components/new-workspace/run-on/use-cloud-start-composer.ts index c37f84d5485..9433bb8e531 100644 --- a/src/renderer/src/components/new-workspace/run-on/use-cloud-start-composer.ts +++ b/src/renderer/src/components/new-workspace/run-on/use-cloud-start-composer.ts @@ -32,10 +32,13 @@ import { isOrcaCloudAccountAgent } from '../../../../../shared/orca-cloud-agents export type { CloudStartView } from './cloud-start-view' -/** The workspace started without its agent: the one prompt to set it up (design-squad journey). */ +/** + * The agent isn't set up: its pane holds on the "Set up once" strip (PC-3b), so the toast only + * names the workspace once the user has moved to another one (design-squad journey). + */ function showAgentNotStartedToast(agent: string | null, workspaceName: string): void { if (isOrcaCloudAccountAgent(agent)) { - showCloudAgentNotStartedToast(agent, workspaceName) + showCloudAgentNotStartedToast(agent, workspaceName, { onlyWhenAway: true }) } } @@ -52,7 +55,6 @@ export function useCloudStartComposer({ createReady = true, composerSnapshot, onCreate: createWorkspace, - onCreateWithoutAgent, onClose, accessOverride }: { @@ -75,8 +77,6 @@ export function useCloudStartComposer({ /** The composer as it is now, for the setup page's Back and its auto-start. */ composerSnapshot: () => ComposerModalData onCreate: () => void - /** The same create with no agent launched (the agent has no Orca Cloud account yet). */ - onCreateWithoutAgent?: () => void /** Closes the composer (setup moves to its page; a cloud-only repository started, D4). */ onClose?: () => void /** Fixtures pin the account's access. */ @@ -110,31 +110,25 @@ export function useCloudStartComposer({ }) const { steps, held: switchTeam } = useSwitchTeamSteps(rowSteps, cloudSelected) const setupNeeded = cloudSetupRequired(steps, { teamSwitch: switchTeam !== null }) - // The agent has no Orca Cloud account (the user skipped setting it up): never launch it into its - // /login. Start a plain terminal and say how to set the agent up once. + // The agent has no Orca Cloud account (the user skipped setting it up). It is still created with + // the workspace: its launch holds on the pane's "Set up once" strip and never reaches the agent's + // own /login (PC-3b, #385), and its first prompt waits for it. const agentUnset = cloudSelected && steps.some((step) => step.id === 'agent' && step.state === 'optional') const onCreateRaw = useCloudOnlyCreate({ cloudOnly, createWorkspace, prompt, - agent: agentUnset ? null : agent, + agent, profileId, onClose }) const onCreate = useCallback(() => { - if (!agentUnset) { - onCreateRaw() - return + onCreateRaw() + if (agentUnset) { + showAgentNotStartedToast(agent, prompt) } - // A GitHub-only start already leaves the agent out (above); a local project's create skips it. - if (cloudOnly.picked || !onCreateWithoutAgent) { - onCreateRaw() - } else { - onCreateWithoutAgent() - } - showAgentNotStartedToast(agent, prompt) - }, [agent, agentUnset, cloudOnly.picked, onCreateRaw, onCreateWithoutAgent, prompt]) + }, [agent, agentUnset, onCreateRaw, prompt]) const { markTouched } = useRunOnDefault({ active, diff --git a/src/renderer/src/components/new-workspace/run-on/use-composer-cloud-start.ts b/src/renderer/src/components/new-workspace/run-on/use-composer-cloud-start.ts index 6e6f291d5c1..647badf9081 100644 --- a/src/renderer/src/components/new-workspace/run-on/use-composer-cloud-start.ts +++ b/src/renderer/src/components/new-workspace/run-on/use-composer-cloud-start.ts @@ -26,7 +26,6 @@ export function useComposerCloudStart({ handleCreate, createDisabled, quickAgentPick, - noAgentRef, recordCreatedRef, onClose }: { @@ -35,8 +34,6 @@ export function useComposerCloudStart({ cardProps: ComposerCardState quickAgent: TuiAgent | null handleCreate: () => Promise - /** Set right before a create to start it with no agent. */ - noAgentRef: MutableRefObject createDisabled: boolean /** The agent pick (surface, draft) as the composer keeps it, for the setup page's snapshot. */ quickAgentPick: Omit, 'note'> @@ -47,10 +44,6 @@ export function useComposerCloudStart({ // The latest handleCreate, never a ref copied after render: a submit right after an edit must // see that edit. const runCreate = useCallback(() => void handleCreate(), [handleCreate]) - const runCreateWithoutAgent = useCallback(() => { - noAgentRef.current = true - void handleCreate() - }, [handleCreate, noAgentRef]) const composerSnapshot = useCallback( () => buildComposerSnapshot(modalData, cardProps, { ...quickAgentPick, agent: quickAgent }), [cardProps, modalData, quickAgent, quickAgentPick] @@ -70,7 +63,6 @@ export function useComposerCloudStart({ createReady: !createDisabled, composerSnapshot, onCreate: runCreate, - onCreateWithoutAgent: runCreateWithoutAgent, onClose }) useEffect(() => { diff --git a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx new file mode 100644 index 00000000000..e509a540497 --- /dev/null +++ b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx @@ -0,0 +1,44 @@ +// @vitest-environment happy-dom + +import { cleanup, render } from '@testing-library/react' +import { afterEach, describe, expect, it } from 'vitest' +import { OrcaCloudQueuedPromptView } from './OrcaCloudQueuedPrompt' + +afterEach(() => { + cleanup() +}) + +function heading(props: { held?: boolean; editable: boolean; draft?: boolean }): string { + const { container } = render( + {}} + {...props} + /> + ) + return container.querySelector('[data-orca-cloud-queued-prompt="queued"] p')?.textContent ?? '' +} + +describe('OrcaCloudQueuedPromptView heading (DS-e)', () => { + it('says the first prompt sends when the workspace is ready', () => { + expect(heading({ editable: true })).toBe( + 'First prompt for Claude · Sends when the workspace is ready' + ) + }) + + it('says it waits for the agent while the agent isn’t set up (PC-3b hold)', () => { + expect(heading({ editable: true, held: true })).toBe( + 'First prompt for Claude · Sends once Claude is set up' + ) + // Past provisioning it still waits: never "Sending to Claude next" while held. + expect(heading({ editable: false, held: true })).toBe( + 'First prompt for Claude · Sends once Claude is set up' + ) + }) + + it('keeps the draft and hand-off wording', () => { + expect(heading({ editable: true, draft: true })).toBe('Draft for Claude, typed in when ready') + expect(heading({ editable: false })).toBe('Sending to Claude next') + }) +}) diff --git a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx index 229d7a41855..9f5c0ce5528 100644 --- a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx +++ b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx @@ -11,6 +11,9 @@ import { vmCreationPromptIsDraft } from '@/lib/workspace/creation/vm-creation-queued-prompt' import { tuiAgentDisplayName } from '../../../../shared/agent-launch/catalog/tui-agent-display-names' +import { isOrcaCloudAccountAgent } from '../../../../shared/orca-cloud-agents/orca-cloud-agents-wire' +import { cloudAgentHoldReason } from '@/lib/orca-cloud/cloud-agent-launch-hold' +import { useOrcaCloudAgentAccounts } from '@/lib/orca-cloud/orca-cloud-agent-accounts-store' export type OrcaCloudQueuedPromptViewProps = { agentName: string @@ -20,15 +23,53 @@ export type OrcaCloudQueuedPromptViewProps = { editable: boolean /** The prompt is typed into the agent unsent rather than sent. */ draft?: boolean + /** The agent isn't set up for Orca Cloud: its launch, and so this prompt, wait for that (PC-3b). */ + held?: boolean onQueue: (text: string) => void } +type Translate = ReturnType + +/** The queued prompt's heading: when, and whether, it goes to the agent. */ +function queuedTitle( + t: Translate, + agent: string, + { held, editable, draft }: { held: boolean; editable: boolean; draft: boolean } +): string { + if (held) { + return t( + 'auto.components.orcaCloud.QueuedPrompt.held', + 'First prompt for {{agent}} · Sends once {{agent}} is set up', + { agent } + ) + } + if (editable) { + return draft + ? t( + 'auto.components.orcaCloud.QueuedPrompt.draftQueued', + 'Draft for {{agent}}, typed in when ready', + { agent } + ) + : t( + 'auto.components.orcaCloud.QueuedPrompt.queuedUntilReady', + 'First prompt for {{agent}} · Sends when the workspace is ready', + { agent } + ) + } + return draft + ? t('auto.components.orcaCloud.QueuedPrompt.drafting', 'Ready as a draft in {{agent}}', { + agent + }) + : t('auto.components.orcaCloud.QueuedPrompt.sending', 'Sending to {{agent}} next', { agent }) +} + /** Queue the agent's first prompt while the workspace builds; it starts with it once ready. */ export function OrcaCloudQueuedPromptView({ agentName, prompt, editable, draft: isDraftDelivery = false, + held = false, onQueue }: OrcaCloudQueuedPromptViewProps): React.JSX.Element | null { const t = useTranslate() @@ -141,25 +182,7 @@ export function OrcaCloudQueuedPromptView({