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 { describe, expect, it } from 'vitest'
import type { AgentStatusEntry } from './agent-status-types'
import {
parseAgentStatusPaneIdentity,
resolveAgentStatusWorktreeId
} from './agent-status-worktree-attribution'
function entry(overrides: Partial<AgentStatusEntry> = {}): AgentStatusEntry {
return {
paneKey: 'tab-1:11111111-1111-4111-8111-111111111111',
state: 'working',
prompt: '',
updatedAt: 1,
stateStartedAt: 1,
stateHistory: [],
...overrides
}
}
describe('agent status worktree attribution', () => {
it('uses the pane tab before a stale worktree stamp', () => {
expect(
resolveAgentStatusWorktreeId(
entry({ worktreeId: 'stale-worktree' }),
new Map([['tab-1', 'current-worktree']])
)
).toBe('current-worktree')
})
it('falls back to a parent pane tab for a pre-mirror worker', () => {
expect(
resolveAgentStatusWorktreeId(
entry({
paneKey: 'worker-tab:22222222-2222-4222-8222-222222222222',
orchestration: {
taskId: 'task-1',
dispatchId: 'dispatch-1',
parentPaneKey: 'parent-tab:1'
}
}),
new Map([['parent-tab', 'parent-worktree']])
)
).toBe('parent-worktree')
})
it('parses legacy numeric pane identities consistently', () => {
expect(parseAgentStatusPaneIdentity('tab-1:7')).toEqual({ tabId: 'tab-1', paneId: '7' })
})
})
it.each([
{ connectionId: 'host-a' },
{ paneKey: 'web-terminal-shared:11111111-1111-4111-8111-111111111111' }
])('keeps the remote owner when another workspace has the same tab ID: %o', (remote) => {
const row = entry({ worktreeId: 'host-a-workspace', ...remote })
const tabId = row.paneKey.split(':')[0]
expect(resolveAgentStatusWorktreeId(row, new Map([[tabId, 'host-b-workspace']]))).toBe(
'host-a-workspace'
)
})