fix(cloud): N-04 held copy in the queued prompt's editing hint, decided from the first frame

This commit is contained in:
Neil
2026-11-11 12:17:08 -08:00
parent 8a384f4692
commit ffe1d633ed
4 changed files with 91 additions and 7 deletions
@@ -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}
/>
</div>
@@ -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)
@@ -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(
<OrcaCloudQueuedPromptView
agentName="Claude"
prompt=""
editable
held={held}
onQueue={() => {}}
/>
)
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<ReturnType<typeof useAppStore.getState>>)
const { container } = render(<OrcaCloudQueuedPrompt creationId="c1" />)
expect(
container.querySelector('[data-orca-cloud-queued-prompt="editing"]')?.textContent
).toContain('Claude starts with it once Claude is set up.')
})
})
@@ -126,11 +126,17 @@ export function OrcaCloudQueuedPromptView({
/>
<div className="flex items-center justify-between gap-2">
<p id={hintId} className="text-xs text-muted-foreground">
{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 }
)}
</p>
<div className="flex shrink-0 items-center gap-1.5">
{prompt ? (
+1
View File
@@ -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:",