mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
Merge pull request #441 from nwparker/cloud/rr-a-setup-cancel-keeps-hold
fix(cloud): RR-a cancelling a held launch's setup keeps the launch held (P1)
This commit is contained in:
@@ -48,6 +48,28 @@ describe('cloudAgentSetupStripModel (PC-3b)', () => {
|
||||
expect(failed).toMatchObject({ status: 'error', primary: { action: { kind: 'setUpOnce' } } })
|
||||
})
|
||||
|
||||
it('after a cancelled setup it asks again, then offers Start once a setup from anywhere covers the agent (RR-a)', () => {
|
||||
// Cancel left the setup idle and the launch held.
|
||||
const again = cloudAgentSetupStripModel({
|
||||
agent: 'claude',
|
||||
setup: { phase: 'idle' },
|
||||
ready: false,
|
||||
t
|
||||
})
|
||||
expect(again.primary).toMatchObject({ action: { kind: 'setUpOnce' } })
|
||||
// Then set up from Settings: this pane's setup never ran, but the account now covers Claude.
|
||||
const covered = cloudAgentSetupStripModel({
|
||||
agent: 'claude',
|
||||
setup: { phase: 'idle' },
|
||||
ready: true,
|
||||
t
|
||||
})
|
||||
expect(covered).toMatchObject({
|
||||
status: 'done',
|
||||
primary: { label: 'Start Claude', action: { kind: 'start' } }
|
||||
})
|
||||
})
|
||||
|
||||
it('offers Start once the account covers the agent', () => {
|
||||
const model = cloudAgentSetupStripModel({
|
||||
agent: 'claude',
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
const store = vi.hoisted(() => ({ stop: vi.fn(), run: vi.fn(), reload: vi.fn() }))
|
||||
const hold = vi.hoisted(() => ({ release: vi.fn() }))
|
||||
|
||||
vi.mock('@/lib/orca-cloud/orca-cloud-agent-accounts-store', () => ({
|
||||
runOrcaCloudAgentSetups: store.run,
|
||||
stopOrcaCloudAgentSetups: store.stop,
|
||||
reloadOrcaCloudAgentAccounts: store.reload
|
||||
}))
|
||||
vi.mock('@/lib/orca-cloud/cloud-agent-launch-hold', () => ({
|
||||
releaseCloudAgentHold: hold.release
|
||||
}))
|
||||
|
||||
// The strip reads the agents bridge at build time; these tests never reach it.
|
||||
Object.defineProperty(window, 'api', { value: { orcaCloudAgents: {} }, configurable: true })
|
||||
|
||||
const { cloudSetupStripActions } = await import('./cloud-setup-strip-actions')
|
||||
|
||||
function actions(setupRunning: boolean) {
|
||||
return cloudSetupStripActions({
|
||||
agent: 'claude',
|
||||
holdKey: 'tab:1',
|
||||
setupRunning,
|
||||
copyText: vi.fn(),
|
||||
openLink: vi.fn(),
|
||||
useApiKey: vi.fn()
|
||||
})
|
||||
}
|
||||
|
||||
describe('cloudSetupStripActions (PC-3b, RR-a)', () => {
|
||||
beforeEach(() => {
|
||||
store.stop.mockReset()
|
||||
hold.release.mockReset()
|
||||
})
|
||||
|
||||
it('Cancel during a setup stops only the setup: the launch stays held', () => {
|
||||
actions(true).cancel()
|
||||
expect(store.stop).toHaveBeenCalledExactlyOnceWith('claude')
|
||||
expect(hold.release).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('Cancel with no setup running gives up the held launch (plain shell)', () => {
|
||||
actions(false).cancel()
|
||||
expect(store.stop).not.toHaveBeenCalled()
|
||||
expect(hold.release).toHaveBeenCalledExactlyOnceWith('tab:1', 'cancel')
|
||||
})
|
||||
|
||||
it('Start releases the held launch', () => {
|
||||
actions(false).primary({ kind: 'start' })
|
||||
expect(hold.release).toHaveBeenCalledExactlyOnceWith('tab:1', 'proceed')
|
||||
})
|
||||
})
|
||||
@@ -1,6 +1,8 @@
|
||||
// PC-3b: what the "not set up" strip's buttons do. Set up once runs S0's setup for the agent (the
|
||||
// same flow as Settings › Accounts › Orca Cloud); Start releases the held launch; Cancel stops the
|
||||
// setup and opens a plain shell, like cancelling any held launch.
|
||||
// same flow as Settings › Accounts › Orca Cloud); Start releases the held launch. Cancel during a
|
||||
// setup stops only that setup: the launch stays held on "Set up once", and a setup finished from
|
||||
// anywhere (here or Settings) turns the strip into "Start". Cancel with no setup running gives up
|
||||
// the held launch and opens a plain shell, like cancelling any held launch (RR-a).
|
||||
import { releaseCloudAgentHold } from '@/lib/orca-cloud/cloud-agent-launch-hold'
|
||||
import {
|
||||
reloadOrcaCloudAgentAccounts,
|
||||
@@ -45,7 +47,9 @@ export function cloudSetupStripActions(args: {
|
||||
useApiKey: args.useApiKey,
|
||||
cancel: () => {
|
||||
if (args.setupRunning) {
|
||||
// Only the sign-in is abandoned; the person may still set up (here or in Settings) and start.
|
||||
stopOrcaCloudAgentSetups(agent)
|
||||
return
|
||||
}
|
||||
releaseCloudAgentHold(holdKey, 'cancel')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user