fix(agents): use runtime names for default_agent to match ordered agent list
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { describe, test, expect, spyOn, beforeEach, afterEach, mock } from "bun:test"
|
||||
import type { CategoryConfig } from "../config/schema"
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName, getAgentRuntimeName } from "../shared/agent-display-names"
|
||||
import { resolveCategoryConfig } from "./category-config-resolver"
|
||||
|
||||
import * as agents from "../agents"
|
||||
@@ -479,7 +479,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
})
|
||||
|
||||
test("canonicalizes configured default_agent when key uses mixed case", async () => {
|
||||
@@ -503,7 +503,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
})
|
||||
|
||||
test("canonicalizes configured default_agent key to display name", async () => {
|
||||
@@ -527,7 +527,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
})
|
||||
|
||||
test("preserves existing display-name default_agent", async () => {
|
||||
@@ -575,7 +575,31 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("sisyphus"))
|
||||
})
|
||||
|
||||
test("uses runtime default_agent name so OpenCode matches the emitted ordered agent names", async () => {
|
||||
// given
|
||||
const pluginConfig = createPluginConfig({})
|
||||
const config: Record<string, unknown> = {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
default_agent: "hephaestus",
|
||||
agent: {},
|
||||
}
|
||||
const handler = createConfigHandler({
|
||||
ctx: { directory: "/tmp" },
|
||||
pluginConfig,
|
||||
modelCacheState: {
|
||||
anthropicContext1MEnabled: false,
|
||||
modelContextLimitsCache: new Map(),
|
||||
},
|
||||
})
|
||||
|
||||
// when
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
})
|
||||
|
||||
test("sets default_agent to sisyphus when configured default_agent is empty after trim", async () => {
|
||||
@@ -599,7 +623,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("sisyphus"))
|
||||
})
|
||||
|
||||
test("preserves custom default_agent names while trimming whitespace", async () => {
|
||||
|
||||
Reference in New Issue
Block a user