fix(cloud-start): composer footer wraps instead of overflowing; session plan row never shows a raw code; plan subtitle names GitHub

- The footer's actions wrap under "Create more" at the modal's width, so "Set up and start" /
  "Give access and start" no longer run past the dialog's right edge.
- A setup session's machine details ('subscription', 'trial', 'checkout', 'requested') read as
  words, or nothing for a plan that's simply done.
- When the one browser visit also gives GitHub access, the subtitle says so.
- Fixtures at the real modal width (CloudStartModalWidth) and unit tests.
This commit is contained in:
Neil
2026-11-10 15:23:09 -08:00
parent 240e764ebd
commit a2410d10eb
9 changed files with 263 additions and 46 deletions
@@ -2,7 +2,6 @@ import React from 'react'
import { LoaderCircle } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { SwitchIndicator } from '@/components/ui/switch'
import { cn } from '@/lib/utils'
import { useTranslate } from '@/i18n/use-translate'
import { ButtonKeyHint } from '@/components/ButtonKeyHint'
import type { NewWorkspaceComposerCardProps } from './new-workspace-composer-card-props'
@@ -57,12 +56,9 @@ export function NewWorkspaceComposerFooter({
</div>
) : null}
<div
className={cn(
'flex items-center gap-3',
showCreateMultiple ? 'justify-between' : 'justify-end'
)}
>
{/* Wraps instead of overflowing: "Use this computer instead" plus a long primary label
("Give access and start") don't fit beside "Create more" in the modal's width. */}
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-2">
{showCreateMultiple ? (
<button
type="button"
@@ -72,36 +68,32 @@ export function NewWorkspaceComposerFooter({
className="group flex w-fit cursor-pointer items-center gap-2 rounded-md text-xs outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-focus-ring"
>
<SwitchIndicator checked={createMultiple} />
<span className="text-muted-foreground transition-colors group-hover:text-foreground">
<span className="whitespace-nowrap text-muted-foreground transition-colors group-hover:text-foreground">
{t('auto.components.NewWorkspaceComposerCard.createMultiple', 'Create more')}
</span>
</button>
) : null}
{cloudStart?.onUseThisComputer ? (
<div className="ml-auto flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2">
{cloudStart?.onUseThisComputer ? (
<Button type="button" variant="ghost" size="sm" onClick={cloudStart.onUseThisComputer}>
{t('components.newWorkspace.cloudStart.useThisComputer', 'Use this computer instead')}
</Button>
) : null}
<Button
type="button"
variant="ghost"
onClick={heldReason ? undefined : () => void onCreate()}
disabled={createDisabled}
aria-disabled={heldReason ? true : undefined}
aria-describedby={heldReason ? heldReasonId : undefined}
title={heldReason}
variant={heldReason ? 'default-held' : 'default'}
size="sm"
className="ml-auto"
onClick={cloudStart.onUseThisComputer}
className="text-xs"
>
{t('components.newWorkspace.cloudStart.useThisComputer', 'Use this computer instead')}
{creating ? <LoaderCircle className="size-4 animate-spin" /> : null}
{primaryActionLabel}
<ButtonKeyHint modifierLabel={submitShortcutModifierLabel} />
</Button>
) : null}
<Button
onClick={heldReason ? undefined : () => void onCreate()}
disabled={createDisabled}
aria-disabled={heldReason ? true : undefined}
aria-describedby={heldReason ? heldReasonId : undefined}
title={heldReason}
variant={heldReason ? 'default-held' : 'default'}
size="sm"
className="text-xs"
>
{creating ? <LoaderCircle className="size-4 animate-spin" /> : null}
{primaryActionLabel}
<ButtonKeyHint modifierLabel={submitShortcutModifierLabel} />
</Button>
</div>
{heldReason ? (
<span id={heldReasonId} className="sr-only">
{heldReason}
@@ -0,0 +1,120 @@
// "Start in Orca Cloud" at the real modal's width (sm:max-w-lg, ~448px of content) with its
// "Create more" switch, where np4-e2e saw the primary button overflow the dialog's right edge.
// Also the setup session's plan row (no raw "subscription") and the plan + GitHub subtitle.
import { defineFixture } from '../../../component-fixtures/component-fixture'
import type { OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access'
import type { CloudSetupStep } from './cloud-start-model'
import { ComposerPreview } from './cloud-start-preview-fixture'
const setup = (): void => {
window.api.agentApiKeys = undefined
window.api.cloudSecrets = undefined
window.api.orcaCloudAgents = undefined
window.api.cloudWorkspaces = { ...window.api.cloudWorkspaces, available: async () => true }
}
const CARD_WIDTH = 480
const noPlan: OrcaCloudRunTargetAccess = {
state: 'no-plan',
lapsed: false,
canManageBilling: true
}
const githubNeeded: CloudSetupStep = {
id: 'github',
state: 'needed',
need: 'github',
canFix: true,
label: 'GitHub access',
status: 'Needed',
detail: 'Orca Cloud can’t reach nwparker/orca-sandbox-push-test yet.',
note: 'It clones your code from GitHub. Give access to this repository once.'
}
/** Signed out at the modal's width: "Create more", "Use this computer instead", "Set up and start". */
export const modalSignedOut = defineFixture({
width: CARD_WIDTH + 40,
setup,
render: () => (
<ComposerPreview
availability="needs-sign-in"
access={{ state: 'signed-out' }}
cloudSelected
showCreateMultiple
width={CARD_WIDTH}
/>
)
})
/** Only GitHub is missing: the longer "Give access and start" at the modal's width. */
export const modalGiveAccess = defineFixture({
width: CARD_WIDTH + 40,
setup,
render: () => (
<ComposerPreview
availability="offered"
access={{ state: 'entitled', remainingSeconds: 41 * 3600 }}
cloudSelected
github={githubNeeded}
showCreateMultiple
width={CARD_WIDTH}
/>
)
})
/** No plan and no GitHub access: the subtitle names both parts of the one browser visit. */
export const modalPlanAndGitHub = defineFixture({
width: CARD_WIDTH + 40,
setup,
render: () => (
<ComposerPreview
availability="offered"
access={noPlan}
cloudSelected
github={githubNeeded}
showCreateMultiple
width={CARD_WIDTH}
/>
)
})
/** A setup session after Checkout: Team plan done with no raw "subscription" under it. */
export const sessionPlanDone = defineFixture({
width: CARD_WIDTH + 40,
setup,
render: () => (
<ComposerPreview
availability="offered"
access={noPlan}
cloudSelected
showCreateMultiple
width={CARD_WIDTH}
steps={[
{ id: 'account', state: 'done' },
{ id: 'team', state: 'done' },
{ id: 'plan', state: 'done', detail: 'subscription' },
{ id: 'github', state: 'active' },
{ id: 'agent', state: 'optional' }
]}
/>
)
})
/** A setup session mid-Checkout, with an owner's GitHub approval pending: codes read as words. */
export const sessionCheckoutAndRequested = defineFixture({
width: CARD_WIDTH + 40,
setup,
render: () => (
<ComposerPreview
availability="offered"
access={noPlan}
cloudSelected
width={CARD_WIDTH}
steps={[
{ id: 'account', state: 'done' },
{ id: 'team', state: 'done' },
{ id: 'plan', state: 'active', detail: 'checkout' },
{ id: 'github', state: 'pending', detail: 'requested' },
{ id: 'agent', state: 'optional' }
]}
/>
)
})
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest'
import { translate } from '@/i18n/i18n'
import { sessionDetailCopy } from './OrcaCloudSetupPanel'
describe('sessionDetailCopy', () => {
// np4-e2e: the plan row read the session's raw "subscription".
it('never shows a setup session code on the row', () => {
expect(
sessionDetailCopy({ id: 'plan', state: 'done', detail: 'subscription' }, translate)
).toBe(null)
expect(sessionDetailCopy({ id: 'plan', state: 'done', detail: 'trial' }, translate)).toBe(
'Your trial covers it.'
)
expect(sessionDetailCopy({ id: 'plan', state: 'active', detail: 'checkout' }, translate)).toBe(
'Finish checkout in your browser.'
)
expect(
sessionDetailCopy({ id: 'github', state: 'pending', detail: 'requested' }, translate)
).toBe('Waiting for an owner on GitHub to approve Orca Cloud.')
})
it('leaves the composer’s own details alone', () => {
expect(sessionDetailCopy({ id: 'team', state: 'done', detail: 'acme' }, translate)).toBe(
undefined
)
expect(sessionDetailCopy({ id: 'github', state: 'done', detail: 'acme/web' }, translate)).toBe(
undefined
)
})
})
@@ -8,6 +8,7 @@ import { Skeleton } from '@/components/ui/skeleton'
import { cn } from '@/lib/utils'
import { useTranslate, type Translate } from '@/i18n/use-translate'
import {
cloudSetupNeedsGitHub,
cloudSetupNeedsPlan,
type CloudSetupStep,
type CloudSetupStepId
@@ -159,6 +160,34 @@ function planDetail(step: CloudSetupStep, t: Translate): string | null {
}
}
/**
* A setup session's rows name how a step is covered with a code ('subscription', 'trial',
* 'checkout', 'requested'); say it in words, or nothing. Undefined: not a session code.
*/
export function sessionDetailCopy(step: CloudSetupStep, t: Translate): string | null | undefined {
if (step.id === 'plan') {
switch (step.detail) {
case 'subscription':
// "Team plan · Done" already says it.
return null
case 'trial':
return t('components.newWorkspace.cloudSetup.planCoveredByTrial', 'Your trial covers it.')
case 'checkout':
return t(
'components.newWorkspace.cloudSetup.planCheckoutOpen',
'Finish checkout in your browser.'
)
}
}
if (step.id === 'github' && step.detail === 'requested') {
return t(
'components.newWorkspace.cloudSetup.githubRequestedSession',
'Waiting for an owner on GitHub to approve Orca Cloud.'
)
}
return undefined
}
function stateLabel(step: CloudSetupStep, t: Translate): string {
switch (step.state) {
case 'done':
@@ -246,15 +275,20 @@ export function OrcaCloudSetupPanel({
'components.newWorkspace.cloudSetup.subtitleOwnerFixes',
'An owner or admin needs to fix this. Your prompt stays here.'
)
: cloudSetupNeedsPlan(steps)
: cloudSetupNeedsPlan(steps) && cloudSetupNeedsGitHub(steps)
? t(
'components.newWorkspace.cloudSetup.subtitleChoosePlan',
'One visit to your browser to choose a plan. Your prompt stays here and starts when you’re done.'
'components.newWorkspace.cloudSetup.subtitleChoosePlanAndGitHub',
'One visit to your browser to choose a plan and give Orca Cloud access on GitHub. Your prompt stays here and starts when you’re done.'
)
: t(
'components.newWorkspace.cloudSetup.subtitleNoCard',
'One visit to your browser, no card. Your prompt stays here and starts when you’re done.'
)))}
: cloudSetupNeedsPlan(steps)
? t(
'components.newWorkspace.cloudSetup.subtitleChoosePlan',
'One visit to your browser to choose a plan. Your prompt stays here and starts when you’re done.'
)
: t(
'components.newWorkspace.cloudSetup.subtitleNoCard',
'One visit to your browser, no card. Your prompt stays here and starts when you’re done.'
)))}
</p>
{/* One polite announcement per row change ("Team plan, done"). */}
<ul aria-live="polite" className="mt-2 space-y-1.5">
@@ -263,6 +297,8 @@ export function OrcaCloudSetupPanel({
const title = step.label ?? copy.title
const state = step.status ?? copy.status ?? stateLabel(step, t)
const note = step.note ?? copy.note
const sessionDetail = sessionDetailCopy(step, t)
const detail = sessionDetail === undefined ? (step.detail ?? copy.detail) : sessionDetail
return (
<li
key={step.id}
@@ -277,10 +313,8 @@ export function OrcaCloudSetupPanel({
<span className="block text-xs text-foreground">{title}</span>
{step.state === 'loading' ? (
<Skeleton shape="small" className="mt-1 h-2.5 w-40" />
) : (step.detail ?? copy.detail) ? (
<span className="block text-[11px] text-muted-foreground">
{step.detail ?? copy.detail}
</span>
) : detail ? (
<span className="block text-[11px] text-muted-foreground">{detail}</span>
) : null}
{note ? (
<span className="block text-[11px] text-muted-foreground">{note}</span>
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
import {
cloudSetupNeedsGitHub,
deriveCloudSetupSteps,
getCloudPrimaryAction,
getOrcaCloudSegmentState,
@@ -273,3 +274,15 @@ describe('withReachableGitHub', () => {
expect(withReachableGitHub(steps, false)).toBe(steps)
})
})
describe('cloudSetupNeedsGitHub', () => {
it('counts GitHub access the browser visit gives, not an approval, a missing remote or a check', () => {
expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'needed', need: 'github' }])).toBe(true)
expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'active' }])).toBe(true)
expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'done' }])).toBe(false)
expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'loading' }])).toBe(false)
expect(
cloudSetupNeedsGitHub([{ id: 'github', state: 'pending', need: 'github', blocksStart: true }])
).toBe(false)
})
})
@@ -191,6 +191,16 @@ export function cloudSetupNeedsPlan(steps: readonly CloudSetupStep[]): boolean {
)
}
/**
* The same browser trip also gives Orca Cloud access to the repository on GitHub. An owner's
* approval (D2) or a project not on GitHub (D3) isn't part of the trip; still checking isn't either.
*/
export function cloudSetupNeedsGitHub(steps: readonly CloudSetupStep[]): boolean {
return getOpenSetupSteps(steps).some(
(step) => step.id === 'github' && !step.blocksStart && step.state !== 'loading'
)
}
export type CloudPrimaryAction =
| 'start'
| 'setUpAndStart'
@@ -273,7 +283,7 @@ export function withReachableGitHub(
if (!reachable || !steps.some((step) => step.id === 'github' && step.state !== 'done')) {
return steps
}
return steps.map(
(step): CloudSetupStep => (step.id === 'github' ? { id: 'github', state: 'done' } : step)
return steps.map((step): CloudSetupStep =>
step.id === 'github' ? { id: 'github', state: 'done' } : step
)
}
@@ -80,7 +80,9 @@ export function ComposerPreview({
prompt = 'Fix the flaky login test in e2e/auth.spec.ts and open a PR.',
cloudRepos,
pickedCloudRepo = null,
folderProject = false
folderProject = false,
showCreateMultiple = false,
width
}: {
availability: OrcaCloudAvailability
access: OrcaCloudRunTargetAccess
@@ -95,6 +97,10 @@ export function ComposerPreview({
pickedCloudRepo?: string | null
/** The project is a plain folder (D3 for folders). */
folderProject?: boolean
/** The modal's "Create more" switch, which shares the footer row with the actions. */
showCreateMultiple?: boolean
/** Pins the card's width, e.g. the modal's content width. */
width?: number
}): React.JSX.Element {
const [picked, setPicked] = useState<string | null>(pickedCloudRepo)
const [host, setHost] = useState('local')
@@ -135,7 +141,10 @@ export function ComposerPreview({
: {})
}
return (
<div className="space-y-4 rounded-xl border border-border bg-background p-4">
<div
className="space-y-4 rounded-xl border border-border bg-background p-4"
style={width ? { width } : undefined}
>
<h1 className="text-base font-semibold">Create workspace</h1>
<p className="text-sm text-muted-foreground">{prompt}</p>
<NewWorkspaceComposerProjectSection
@@ -178,6 +187,7 @@ export function ComposerPreview({
}
submitShortcutModifierLabel="⌘"
cloudStart={cloudStart}
showCreateMultiple={showCreateMultiple}
/>
</div>
)
@@ -8,7 +8,11 @@ import { useOrcaCloudRepoAccess } from '@/lib/orca-cloud/use-orca-cloud-repo-acc
import { useCloudSetupSession } from '@/lib/orca-cloud/cloud-setup-session-seam'
import type { OrcaCloudAvailability } from '../../../../../shared/orca-yaml-hook-types'
import type { OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access'
import { deriveCloudSetupSteps, withReachableGitHub, type CloudSetupStep } from './cloud-start-model'
import {
deriveCloudSetupSteps,
withReachableGitHub,
type CloudSetupStep
} from './cloud-start-model'
import { cloudStartAgentStep } from './cloud-start-agent-step'
import {
orcaCloudAgentSetupRow,
+5 -1
View File
@@ -23161,7 +23161,11 @@
"teamCreateFailed": "Couldn’t create the team. Nothing was created, and you weren’t charged.",
"wrongAccount": "Signed in as {{email}}, who isn’t on {{team}}. Switch accounts or ask an owner of {{team}} for an invite.",
"wrongAccountGeneric": "Signed in with an account that isn’t on this team. Switch accounts or ask an owner for an invite."
}
},
"planCoveredByTrial": "Your trial covers it.",
"planCheckoutOpen": "Finish checkout in your browser.",
"githubRequestedSession": "Waiting for an owner on GitHub to approve Orca Cloud.",
"subtitleChoosePlanAndGitHub": "One visit to your browser to choose a plan and give Orca Cloud access on GitHub. Your prompt stays here and starts when you’re done."
},
"runOn": {
"thisComputer": "This computer",