fix(agents): use list display names for ordered agent config

This commit is contained in:
YeonGyu-Kim
2026-03-31 15:11:00 -07:00
parent 1d0135b230
commit e2e57bb2dd
7 changed files with 59 additions and 24 deletions
@@ -54,7 +54,7 @@ describe("remapAgentKeysToDisplayNames", () => {
expect(result["hephaestus"]).toBeUndefined()
expect(result["Prometheus (Plan Builder)"]).toBeDefined()
expect(result["prometheus"]).toBeUndefined()
expect(result["Atlas (Plan Executor)"]).toBeDefined()
expect(result["\u200BAtlas (Plan Executor)"]).toBeDefined()
expect(result["atlas"]).toBeUndefined()
expect(result["Athena (Council)"]).toBeDefined()
expect(result["athena"]).toBeUndefined()
+2 -2
View File
@@ -1,4 +1,4 @@
import { AGENT_DISPLAY_NAMES } from "../shared/agent-display-names"
import { getAgentListDisplayName } from "../shared/agent-display-names"
export function remapAgentKeysToDisplayNames(
agents: Record<string, unknown>,
@@ -6,7 +6,7 @@ export function remapAgentKeysToDisplayNames(
const result: Record<string, unknown> = {}
for (const [key, value] of Object.entries(agents)) {
const displayName = AGENT_DISPLAY_NAMES[key]
const displayName = getAgentListDisplayName(key)
if (displayName && displayName !== key) {
result[displayName] = value
// Regression guard: do not also assign result[key].
+5 -5
View File
@@ -1,10 +1,10 @@
import { getAgentDisplayName } from "../shared/agent-display-names";
import { getAgentListDisplayName } from "../shared/agent-display-names";
const CORE_AGENT_ORDER: ReadonlyArray<{ displayName: string; order: number }> = [
{ displayName: getAgentDisplayName("sisyphus"), order: 1 },
{ displayName: getAgentDisplayName("hephaestus"), order: 2 },
{ displayName: getAgentDisplayName("prometheus"), order: 3 },
{ displayName: getAgentDisplayName("atlas"), order: 4 },
{ displayName: getAgentListDisplayName("sisyphus"), order: 1 },
{ displayName: getAgentListDisplayName("hephaestus"), order: 2 },
{ displayName: getAgentListDisplayName("prometheus"), order: 3 },
{ displayName: getAgentListDisplayName("atlas"), order: 4 },
];
function injectOrderField(
+10 -10
View File
@@ -4,7 +4,7 @@ import { describe, test, expect, spyOn, beforeEach, afterEach } from "bun:test"
import { resolveCategoryConfig, createConfigHandler } from "./config-handler"
import type { CategoryConfig } from "../config/schema"
import type { OhMyOpenCodeConfig } from "../config"
import { getAgentDisplayName } from "../shared/agent-display-names"
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
import * as agents from "../agents"
import * as sisyphusJunior from "../agents/sisyphus-junior"
@@ -198,10 +198,10 @@ describe("Plan agent demote behavior", () => {
// #then
const keys = Object.keys(config.agent as Record<string, unknown>)
const coreAgents = [
getAgentDisplayName("sisyphus"),
getAgentDisplayName("hephaestus"),
getAgentDisplayName("prometheus"),
getAgentDisplayName("atlas"),
getAgentListDisplayName("sisyphus"),
getAgentListDisplayName("hephaestus"),
getAgentListDisplayName("prometheus"),
getAgentListDisplayName("atlas"),
]
const ordered = keys.filter((key) => coreAgents.includes(key))
expect(ordered).toEqual(coreAgents)
@@ -1158,11 +1158,11 @@ describe("config-handler plugin loading error boundary (#1559)", () => {
describe("per-agent todowrite/todoread deny when task_system enabled", () => {
const AGENTS_WITH_TODO_DENY = new Set([
getAgentDisplayName("sisyphus"),
getAgentDisplayName("hephaestus"),
getAgentDisplayName("atlas"),
getAgentDisplayName("prometheus"),
getAgentDisplayName("sisyphus-junior"),
getAgentListDisplayName("sisyphus"),
getAgentListDisplayName("hephaestus"),
getAgentListDisplayName("atlas"),
getAgentListDisplayName("prometheus"),
getAgentListDisplayName("sisyphus-junior"),
])
test("denies todowrite and todoread for primary agents when task_system is enabled", async () => {
+2 -2
View File
@@ -1,5 +1,5 @@
import type { OhMyOpenCodeConfig } from "../config";
import { getAgentDisplayName } from "../shared/agent-display-names";
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names";
type AgentWithPermission = { permission?: Record<string, unknown> };
@@ -15,7 +15,7 @@ function getConfigQuestionPermission(): string | null {
}
function agentByKey(agentResult: Record<string, unknown>, key: string): AgentWithPermission | undefined {
return (agentResult[getAgentDisplayName(key)] ?? agentResult[key]) as
return (agentResult[getAgentListDisplayName(key)] ?? agentResult[getAgentDisplayName(key)] ?? agentResult[key]) as
| AgentWithPermission
| undefined;
}