fix(config): preserve configured default_agent
oh-my-opencode overwrote OpenCode's default_agent with sisyphus whenever Sisyphus orchestration was enabled. This made explicit defaults like Hephaestus ineffective and forced manual agent switching in new sessions. Only assign sisyphus as default when default_agent is missing or blank, and preserve existing configured values. Add tests for both preservation and fallback behavior to prevent regressions.
This commit is contained in:
committed by
YeonGyu-Kim
parent
2fa82896f8
commit
90ede4487b
@@ -349,6 +349,55 @@ describe("Agent permission defaults", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
test("preserves existing default_agent when already set", async () => {
|
||||
// #given
|
||||
const pluginConfig: OhMyOpenCodeConfig = {}
|
||||
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("hephaestus")
|
||||
})
|
||||
|
||||
test("sets default_agent to sisyphus when missing", async () => {
|
||||
// #given
|
||||
const pluginConfig: OhMyOpenCodeConfig = {}
|
||||
const config: Record<string, unknown> = {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
agent: {},
|
||||
}
|
||||
const handler = createConfigHandler({
|
||||
ctx: { directory: "/tmp" },
|
||||
pluginConfig,
|
||||
modelCacheState: {
|
||||
anthropicContext1MEnabled: false,
|
||||
modelContextLimitsCache: new Map(),
|
||||
},
|
||||
})
|
||||
|
||||
// #when
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
})
|
||||
|
||||
describe("Prometheus category config resolution", () => {
|
||||
test("resolves ultrabrain category config", () => {
|
||||
// given
|
||||
|
||||
Reference in New Issue
Block a user