fix(agents): use runtime names for default_agent to match ordered agent list

This commit is contained in:
YeonGyu-Kim
2026-04-11 14:15:00 +09:00
parent 630f5b79e7
commit c30b058b7e
5 changed files with 106 additions and 16 deletions
+44 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect } from "bun:test"
import { remapAgentKeysToDisplayNames } from "./agent-key-remapper"
import { getAgentDisplayName } from "../shared/agent-display-names"
import { getAgentDisplayName, getAgentRuntimeName } from "../shared/agent-display-names"
describe("remapAgentKeysToDisplayNames", () => {
it("remaps known agent keys to display names", () => {
@@ -105,4 +105,47 @@ describe("remapAgentKeysToDisplayNames", () => {
expect(name).not.toContain("\u200B")
}
})
it("preserves clean keys but rewrites core agent name fields to list-display names for tab cycling", () => {
// given agents with raw config-key names
const agents = {
sisyphus: { name: "sisyphus", prompt: "test", mode: "primary" },
hephaestus: { name: "hephaestus", prompt: "test", mode: "primary" },
prometheus: { name: "prometheus", prompt: "test", mode: "all" },
atlas: { name: "atlas", prompt: "test", mode: "primary" },
oracle: { name: "oracle", prompt: "test", mode: "subagent" },
}
// when remapping
const result = remapAgentKeysToDisplayNames(agents)
// then keys stay HTTP-header-safe, but nested names carry stable list ordering
expect(Object.keys(result).slice(0, 4)).toEqual([
getAgentDisplayName("sisyphus"),
getAgentDisplayName("hephaestus"),
getAgentDisplayName("prometheus"),
getAgentDisplayName("atlas"),
])
expect(result[getAgentDisplayName("sisyphus")]).toEqual({
name: getAgentRuntimeName("sisyphus"),
prompt: "test",
mode: "primary",
})
expect(result[getAgentDisplayName("hephaestus")]).toEqual({
name: getAgentRuntimeName("hephaestus"),
prompt: "test",
mode: "primary",
})
expect(result[getAgentDisplayName("prometheus")]).toEqual({
name: getAgentRuntimeName("prometheus"),
prompt: "test",
mode: "all",
})
expect(result[getAgentDisplayName("atlas")]).toEqual({
name: getAgentRuntimeName("atlas"),
prompt: "test",
mode: "primary",
})
expect(result.oracle).toEqual({ name: "oracle", prompt: "test", mode: "subagent" })
})
})