Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

test(agents): derive the builtin list from BUILTIN_AGENT_IDS (copilot broke #245's hardcoded list)

enes1e00c2e4dbc5
diff --git a/src/renderer/state/agentAvailability.test.ts b/src/renderer/state/agentAvailability.test.ts
index e90c8b669..ebe6e3578 100644
--- a/src/renderer/state/agentAvailability.test.ts
+++ b/src/renderer/state/agentAvailability.test.ts
@@ -7,6 +7,11 @@ import {
setDefaultAgent
} from './agentAvailability'
import type { CustomAgent } from '@shared/types'
+import { BUILTIN_AGENT_IDS } from '@shared/agents/config'
+
+// Derived, not hardcoded: a builtin added later (copilot landed after these tests were written)
+// must not silently leave one enabled and break the "every builtin disabled" premise.
+const ALL_BUILTINS = [...BUILTIN_AGENT_IDS] as string[]
const custom = (id: string, label = id): CustomAgent => ({
id: `custom:${id}`,
@@ -28,21 +33,21 @@ describe('firstEnabledAgent', () => {
})
it('falls through to an enabled CUSTOM agent when every builtin is disabled — the bug', () => {
- const all = ['claude', 'codex', 'gemini', 'opencode', 'grok']
+ const all = ALL_BUILTINS
expect(firstEnabledAgent({ disabledAgents: all, customAgents: [custom('work')] })).toBe(
'custom:work'
)
})
it('skips a disabled custom agent too', () => {
- const all = ['claude', 'codex', 'gemini', 'opencode', 'grok', 'custom:work']
+ const all = [...ALL_BUILTINS, 'custom:work']
expect(
firstEnabledAgent({ disabledAgents: all, customAgents: [custom('work'), custom('personal')] })
).toBe('custom:personal')
})
it("answers 'claude' only when literally everything is disabled", () => {
- const all = ['claude', 'codex', 'gemini', 'opencode', 'grok', 'custom:work']
+ const all = [...ALL_BUILTINS, 'custom:work']
expect(firstEnabledAgent({ disabledAgents: all, customAgents: [custom('work')] })).toBe('claude')
})
})
@@ -50,7 +55,8 @@ describe('firstEnabledAgent', () => {
describe('setAgentEnabled — default reassignment', () => {
it('hands the default to a custom agent when the last builtin goes dark', () => {
const s = {
- disabledAgents: ['codex', 'gemini', 'opencode', 'grok'],
+ // Every builtin but claude already dark; disabling claude then leaves only the custom agent.
+ disabledAgents: ALL_BUILTINS.filter((id) => id !== 'claude'),
defaultAgent: 'claude',
customAgents: [custom('work')]
}