Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import type { Page } from '@stablyai/playwright-test'
import { mkdirSync } from 'node:fs'
import { resolve } from 'node:path'
import { test, expect } from './helpers/orca-app'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
import { seedLineageScenario } from './worktree-lineage-state'
import { worktreeRow } from './worktree-row-locators'
// ORCA_CAPTURE_EVIDENCE=1 writes before/after screenshots to pr-evidence/; default CI runs behavioral assertions only.
const CAPTURE_EVIDENCE = process.env.ORCA_CAPTURE_EVIDENCE === '1'
const SHOT_DIR = resolve(process.cwd(), 'pr-evidence')
async function captureSidebar(page: Page, name: string): Promise<void> {
if (!CAPTURE_EVIDENCE) {
return
}
mkdirSync(SHOT_DIR, { recursive: true })
await sidebar(page).screenshot({ path: resolve(SHOT_DIR, name) })
}
// Seed two parent agents for the compact summary alongside the child-workspace chip.
async function seedTwoParentAgents(page: Page, worktreeId: string): Promise<void> {
await page.evaluate((worktreeId) => {
const store = window.__store
if (!store) {
throw new Error('window.__store is not available')
}
const state = store.getState()
if (!state.worktreeCardProperties.includes('inline-agents')) {
state.setWorktreeCardProperties([...state.worktreeCardProperties, 'inline-agents'])
}
while ((store.getState().tabsByWorktree[worktreeId] ?? []).length < 2) {
store.getState().createTab(worktreeId)
}
const tabs = (store.getState().tabsByWorktree[worktreeId] ?? []).slice(0, 2)
const now = Date.now()
const specs = [
{ state: 'working' as const, prompt: 'Refactor auth middleware', agentType: 'claude' },
{ state: 'done' as const, prompt: 'Write unit tests for parser', agentType: 'codex' }
]
tabs.forEach((tab, index) => {
const spec = specs[index]!
const leafId = crypto.randomUUID()
store
.getState()
.setAgentStatus(
`${tab.id}:${leafId}`,
{ state: spec.state, prompt: spec.prompt, agentType: spec.agentType },
spec.agentType,
{ updatedAt: now, stateStartedAt: now }
)
})
}, worktreeId)
}
function sidebar(page: Page) {
return page.locator('[data-worktree-sidebar]').first()
}
function compactSummary(page: Page, parentId: string) {
return worktreeRow(page, parentId).locator('button.compact-agent-summary-button').first()
}
function childWorkspacesChip(page: Page, parentId: string) {
return worktreeRow(page, parentId)
.getByRole('button', { name: /child workspace/i })
.first()
}
test.describe('Worktree lineage agent-list expansion independence', () => {
test.describe.configure({ mode: 'serial' })
test.beforeEach(async ({ orcaPage }) => {
await waitForSessionReady(orcaPage)
await waitForActiveWorktree(orcaPage)
})
test('toggling child worktrees does not collapse the expanded agent summary', async ({
orcaPage
}) => {
const { parentId, childId } = await seedLineageScenario(orcaPage)
const parentRow = worktreeRow(orcaPage, parentId)
const childRow = worktreeRow(orcaPage, childId)
await parentRow.click()
await expect(parentRow).toHaveAttribute('aria-current', 'page')
await seedTwoParentAgents(orcaPage, parentId)
await expect(compactSummary(orcaPage, parentId)).toBeVisible({ timeout: 10_000 })
await expect(childWorkspacesChip(orcaPage, parentId)).toBeVisible()
await expect(childRow).toBeVisible()
await expect(compactSummary(orcaPage, parentId)).toHaveAttribute('aria-expanded', 'false')
await captureSidebar(orcaPage, '1-before-both-collapsed.png')
await compactSummary(orcaPage, parentId).click()
await expect(compactSummary(orcaPage, parentId)).toHaveAttribute('aria-expanded', 'true')
await captureSidebar(orcaPage, '2-agents-expanded.png')
// Collapse children to remount the parent card; require expanded agent summary to survive.
await childWorkspacesChip(orcaPage, parentId).click()
await expect(childRow).toBeHidden()
await expect(compactSummary(orcaPage, parentId)).toHaveAttribute('aria-expanded', 'true')
await captureSidebar(orcaPage, '3-after-children-toggle-agents-still-expanded.png')
})
})