From ffe1d633edc5eef7c60658fc12228e79dae2dbc1 Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 11 Nov 2026 12:17:08 -0800 Subject: [PATCH] fix(cloud): N-04 held copy in the queued prompt's editing hint, decided from the first frame --- .../OrcaCloudQueuedPrompt.fixture.tsx | 7 +- .../orca-cloud/OrcaCloudQueuedPrompt.test.tsx | 74 ++++++++++++++++++- .../orca-cloud/OrcaCloudQueuedPrompt.tsx | 16 ++-- src/renderer/src/i18n/locales/en.json | 1 + 4 files changed, 91 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.fixture.tsx b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.fixture.tsx index 3ffca653341..8fdc1dcc16a 100644 --- a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.fixture.tsx +++ b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.fixture.tsx @@ -6,7 +6,7 @@ const noop = (): void => {} const PROMPT = 'Find why the login test is flaky on CI and fix it. Run the suite three times to confirm.' -function promptFixture(prompt: string, editable: boolean) { +function promptFixture(prompt: string, editable: boolean, held = false) { return defineFixture({ width: 420, render: () => ( @@ -15,6 +15,7 @@ function promptFixture(prompt: string, editable: boolean) { agentName="Claude Code" prompt={prompt} editable={editable} + held={held} onQueue={noop} /> @@ -28,6 +29,10 @@ export const empty = promptFixture('', true) export const queued = promptFixture(PROMPT, true) /** Provisioning finished; the prompt is handed to the agent launch. */ export const sending = promptFixture(PROMPT, false) +/** N-04: the agent isn't set up for Orca Cloud, so the hint waits for that, not the workspace. */ +export const emptyHeld = promptFixture('', true, true) +/** N-04: a queued prompt while the agent isn't set up. */ +export const queuedHeld = promptFixture(PROMPT, true, true) function BuildOutrunsTyping(): React.JSX.Element { const [editable, setEditable] = useState(true) diff --git a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx index e509a540497..84d55af6d4c 100644 --- a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx +++ b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.test.tsx @@ -2,7 +2,9 @@ import { cleanup, render } from '@testing-library/react' import { afterEach, describe, expect, it } from 'vitest' -import { OrcaCloudQueuedPromptView } from './OrcaCloudQueuedPrompt' +import { useAppStore } from '@/store' +import { setOrcaCloudAgentAccountsStateForTest } from '@/lib/orca-cloud/orca-cloud-agent-accounts-store' +import { OrcaCloudQueuedPrompt, OrcaCloudQueuedPromptView } from './OrcaCloudQueuedPrompt' afterEach(() => { cleanup() @@ -42,3 +44,73 @@ describe('OrcaCloudQueuedPromptView heading (DS-e)', () => { expect(heading({ editable: false })).toBe('Sending to Claude next') }) }) + +describe('OrcaCloudQueuedPromptView editing hint (N-04)', () => { + function hint(held: boolean): string { + const { container } = render( + {}} + /> + ) + const textarea = container.querySelector('textarea') + const hintId = textarea?.getAttribute('aria-describedby') ?? '' + return container.ownerDocument.getElementById(hintId)?.textContent ?? '' + } + + it('waits for the workspace when the agent is set up', () => { + expect(hint(false)).toBe('Claude starts with it as soon as the workspace is ready.') + }) + + it('waits for the agent from the first render while it isn’t set up', () => { + expect(hint(true)).toBe('Claude starts with it once Claude is set up.') + }) +}) + +describe('OrcaCloudQueuedPrompt held copy from the first frame (N-04)', () => { + it('reads the account state synchronously, so the first render already says it waits for setup', () => { + setOrcaCloudAgentAccountsStateForTest({ + load: { + kind: 'ready', + status: { + credentials: { + claude: { state: 'none' }, + codex: { state: 'none' }, + providerEnabled: { claude: true, codex: true } + }, + sources: { defaults: {}, coveredByKey: { claude: false, codex: false } } + } + }, + setups: { claude: { phase: 'idle' }, codex: { phase: 'idle' } }, + keyKinds: { claude: null, codex: null }, + queue: { agents: [], index: 0 } + }) + useAppStore.setState({ + pendingWorktreeCreations: { + c1: { + status: 'creating', + phase: 'provisioning-vm', + request: { + agent: 'claude', + quickPrompt: '', + creationStartup: { legacy: { command: 'claude' } }, + ephemeralVmRecipe: { + sourceRepoId: 'repo', + recipeId: 'cloud', + projectId: 'project', + provider: 'orca-cloud' + } + } + } + } + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the component reads only these fields + } as unknown as Partial>) + const { container } = render() + expect( + container.querySelector('[data-orca-cloud-queued-prompt="editing"]')?.textContent + ).toContain('Claude starts with it once Claude is set up.') + }) +}) diff --git a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx index b47c245195a..bbbff908e84 100644 --- a/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx +++ b/src/renderer/src/components/orca-cloud/OrcaCloudQueuedPrompt.tsx @@ -126,11 +126,17 @@ export function OrcaCloudQueuedPromptView({ />

- {t( - 'auto.components.orcaCloud.QueuedPrompt.hint', - '{{agent}} starts with it as soon as the workspace is ready.', - { agent: agentName } - )} + {held + ? t( + 'auto.components.orcaCloud.QueuedPrompt.heldHint', + '{{agent}} starts with it once {{agent}} is set up.', + { agent: agentName } + ) + : t( + 'auto.components.orcaCloud.QueuedPrompt.hint', + '{{agent}} starts with it as soon as the workspace is ready.', + { agent: agentName } + )}

{prompt ? ( diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index f8d5b8f469d..1bb195361a1 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -21125,6 +21125,7 @@ "label": "First prompt for {{agent}}", "placeholder": "What should {{agent}} work on?", "hint": "{{agent}} starts with it as soon as the workspace is ready.", + "heldHint": "{{agent}} starts with it once {{agent}} is set up.", "cancelEdit": "Cancel", "queue": "Queue prompt", "lateEdit": "Too late to change: {{agent}} is starting with the queued prompt. Send your edit once the workspace opens:",