fix(athena): harden council registration with duplicate detection and count validation
Three registration improvements: gate council member registration on Athena enablement, throw on duplicate council member keys instead of silent overwrite, and disable council mode when valid members drop below 2 after model parsing. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
fetchAvailableModels,
|
||||
readConnectedProvidersCache,
|
||||
readProviderModelsCache,
|
||||
log,
|
||||
} from "../shared"
|
||||
import { CATEGORY_DESCRIPTIONS } from "../tools/delegate-task/constants"
|
||||
import { mergeCategories } from "../shared/merge-categories"
|
||||
@@ -186,13 +187,13 @@ export async function createBuiltinAgents(
|
||||
result["atlas"] = atlasConfig
|
||||
}
|
||||
|
||||
if (councilConfig && councilConfig.members.length >= 2) {
|
||||
if (councilConfig && councilConfig.members.length >= 2 && result["athena"]) {
|
||||
const { agents: councilAgents, registeredKeys } = registerCouncilMemberAgents(councilConfig)
|
||||
for (const [key, config] of Object.entries(councilAgents)) {
|
||||
result[key] = config
|
||||
}
|
||||
|
||||
if (result["athena"] && registeredKeys.length > 0) {
|
||||
if (registeredKeys.length > 0) {
|
||||
const memberList = registeredKeys.map((key) => `- "${key}"`).join("\n")
|
||||
const councilTaskInstructions = `\n\n## Registered Council Members (use these as subagent_type in task calls)\n\n${memberList}`
|
||||
result["athena"] = {
|
||||
@@ -200,6 +201,8 @@ export async function createBuiltinAgents(
|
||||
prompt: (result["athena"].prompt ?? "") + councilTaskInstructions,
|
||||
}
|
||||
}
|
||||
} else if (councilConfig && councilConfig.members.length >= 2 && !result["athena"]) {
|
||||
log("[builtin-agents] Skipping council member registration — Athena is disabled")
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user