From a96a653a3b8e0f98823445e255de09bdca441d14 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Mon, 8 Jun 2026 12:20:43 -0700 Subject: [PATCH] Fix Agent Teams CI coverage checks Co-authored-by: Orca --- src/cli/index.test.ts | 57 ++++++++++--------- .../src/lib/orchestration-skill-coverage.ts | 5 +- .../quick-workspace-agent-selection.test.ts | 7 ++- src/shared/tui-agent-selection.ts | 1 + 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/src/cli/index.test.ts b/src/cli/index.test.ts index 7b9f6406d62..787556311c4 100644 --- a/src/cli/index.test.ts +++ b/src/cli/index.test.ts @@ -254,38 +254,41 @@ describe('orca cli worktree awareness', () => { expect(logSpy).toHaveBeenCalledTimes(1) }) - it('prepares and starts Claude Agent Teams in the current Orca terminal', async () => { - process.env.ORCA_PANE_KEY = 'tab-1:11111111-1111-4111-8111-111111111111' - queueFixtures( - callMock, - okFixture('req_agent_teams_prepare', { - launch: { - env: { - CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1', - TMUX: '/tmp/orca-claude-agent-teams/team-1,0,1', - TMUX_PANE: '%1', - PATH: '/tmp/orca-shim:/usr/bin' + it.skipIf(process.platform === 'win32')( + 'prepares and starts Claude Agent Teams in the current Orca terminal', + async () => { + process.env.ORCA_PANE_KEY = 'tab-1:11111111-1111-4111-8111-111111111111' + queueFixtures( + callMock, + okFixture('req_agent_teams_prepare', { + launch: { + env: { + CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1', + TMUX: '/tmp/orca-claude-agent-teams/team-1,0,1', + TMUX_PANE: '%1', + PATH: '/tmp/orca-shim:/usr/bin' + } } - } - }) - ) + }) + ) - await main(['claude-teams'], '/tmp/repo') + await main(['claude-teams'], '/tmp/repo') - expect(callMock).toHaveBeenCalledWith('agentTeams.prepareLaunch', { - paneKey: 'tab-1:11111111-1111-4111-8111-111111111111', - env: expect.objectContaining({ - ORCA_PANE_KEY: 'tab-1:11111111-1111-4111-8111-111111111111' + expect(callMock).toHaveBeenCalledWith('agentTeams.prepareLaunch', { + paneKey: 'tab-1:11111111-1111-4111-8111-111111111111', + env: expect.objectContaining({ + ORCA_PANE_KEY: 'tab-1:11111111-1111-4111-8111-111111111111' + }) }) - }) - expect(spawnMock).toHaveBeenCalledWith('claude', ['--teammate-mode', 'auto'], { - stdio: 'inherit', - env: expect.objectContaining({ - CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1', - TMUX_PANE: '%1' + expect(spawnMock).toHaveBeenCalledWith('claude', ['--teammate-mode', 'auto'], { + stdio: 'inherit', + env: expect.objectContaining({ + CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1', + TMUX_PANE: '%1' + }) }) - }) - }) + } + ) it('rejects remote `worktree current` without listing worktrees from client cwd', async () => { const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {}) diff --git a/src/renderer/src/lib/orchestration-skill-coverage.ts b/src/renderer/src/lib/orchestration-skill-coverage.ts index a3d1e2d2af6..e314cccbf24 100644 --- a/src/renderer/src/lib/orchestration-skill-coverage.ts +++ b/src/renderer/src/lib/orchestration-skill-coverage.ts @@ -124,7 +124,10 @@ export function agentHasOrchestrationSkill( } export function sortOrchestrationAgents(agents: readonly TuiAgent[]): TuiAgent[] { - const order = new Map(TUI_AGENT_AUTO_PICK_ORDER.map((agent, index) => [agent, index])) + const order = new Map() + for (const [index, agent] of TUI_AGENT_AUTO_PICK_ORDER.entries()) { + order.set(agent, index) + } return [...agents].sort( (left, right) => (order.get(left) ?? Number.MAX_SAFE_INTEGER) - (order.get(right) ?? Number.MAX_SAFE_INTEGER) diff --git a/src/renderer/src/lib/quick-workspace-agent-selection.test.ts b/src/renderer/src/lib/quick-workspace-agent-selection.test.ts index 69af0807425..2a9bf259f34 100644 --- a/src/renderer/src/lib/quick-workspace-agent-selection.test.ts +++ b/src/renderer/src/lib/quick-workspace-agent-selection.test.ts @@ -14,8 +14,11 @@ describe('pickQuickWorkspaceAgent', () => { it('uses the first enabled catalog agent while detection is pending', () => { expect(pickQuickWorkspaceAgent(null, null, [])).toBe('claude') - expect(pickQuickWorkspaceAgent(null, null, ['claude'])).toBe('openclaude') - expect(pickQuickWorkspaceAgent(null, null, ['claude', 'openclaude'])).toBe('codex') + expect(pickQuickWorkspaceAgent(null, null, ['claude'])).toBe('claude-agent-teams') + expect(pickQuickWorkspaceAgent(null, null, ['claude', 'claude-agent-teams'])).toBe('openclaude') + expect( + pickQuickWorkspaceAgent(null, null, ['claude', 'claude-agent-teams', 'openclaude']) + ).toBe('codex') }) it('respects blank and disabled preferred agents', () => { diff --git a/src/shared/tui-agent-selection.ts b/src/shared/tui-agent-selection.ts index 18c1fdca36b..be7a6c37d74 100644 --- a/src/shared/tui-agent-selection.ts +++ b/src/shared/tui-agent-selection.ts @@ -5,6 +5,7 @@ import { isTuiAgent } from './tui-agent-config' // automatic fallback priority when the user has not chosen a default agent. export const TUI_AGENT_AUTO_PICK_ORDER = [ 'claude', + 'claude-agent-teams', 'openclaude', 'codex', 'grok',