fix(athena): address 9 council-audit findings — dead code, bugs, and hardening

Fixes from multi-model council audit (7 members, 19 findings, 9 selected):

- Use parseModelString() for cross-provider Anthropic thinking config (#3)
- Update stale AGENTS.md athena directory listing (#4)
- Replace prompt in appendMissingCouncilPrompt instead of appending (#5)
- Extract duplicated session cleanup logic in agent-switch hook (#6)
- Surface skipped council members when >=2 valid members exist (#9)
- Expand fallback handoff regex with negation guards (#11)
- Remove dead council-member agent from agentSources and tests (#12)
- Make runtime council member duplicate check case-insensitive (#14)
- Fix false-positive schema tests by adding required name field (#18)
This commit is contained in:
ismeth
2026-02-20 16:10:08 +01:00
committed by YeonGyu-Kim
parent 4ca623c29c
commit 9f541ed3ee
12 changed files with 99 additions and 46 deletions
+24 -7
View File
@@ -51,17 +51,34 @@ export function extractTextPartsFromMessageResponse(response: unknown): string {
.join("\n")
}
export function detectFallbackHandoffTarget(messageText: string): "atlas" | "prometheus" | undefined {
const HANDOFF_TARGETS = ["prometheus", "atlas"] as const
type HandoffTarget = (typeof HANDOFF_TARGETS)[number]
const HANDOFF_VERBS = [
"switching",
"handing\\s+off",
"delegating",
"routing",
"transferring",
"passing",
]
function buildHandoffPattern(target: string): RegExp {
const verbGroup = HANDOFF_VERBS.join("|")
return new RegExp(
`(?<!\\bnot\\s+)(?<!\\bdon'?t\\s+)(?<!\\bnever\\s+)(?:${verbGroup})\\s+(?:(?:control|this|it|work)\\s+)?to\\s+\\*{0,2}\\s*${target}\\b`
)
}
export function detectFallbackHandoffTarget(messageText: string): HandoffTarget | undefined {
if (!messageText) return undefined
const normalized = messageText.toLowerCase()
if (/switching\s+to\s+\*{0,2}\s*prometheus\b/.test(normalized) || /handing\s+off\s+to\s+\*{0,2}\s*prometheus\b/.test(normalized)) {
return "prometheus"
}
if (/switching\s+to\s+\*{0,2}\s*atlas\b/.test(normalized) || /handing\s+off\s+to\s+\*{0,2}\s*atlas\b/.test(normalized)) {
return "atlas"
for (const target of HANDOFF_TARGETS) {
if (buildHandoffPattern(target).test(normalized)) {
return target
}
}
return undefined
+11 -12
View File
@@ -14,6 +14,15 @@ import {
const processedFallbackMessages = new Set<string>()
const MAX_PROCESSED_FALLBACK_MARKERS = 500
function clearFallbackMarkersForSession(sessionID: string): void {
clearPendingSwitchRuntime(sessionID)
for (const key of Array.from(processedFallbackMessages)) {
if (key.startsWith(`${sessionID}:`)) {
processedFallbackMessages.delete(key)
}
}
}
function getSessionIDFromStatusEvent(input: { event: { properties?: Record<string, unknown> } }): string | undefined {
const props = input.event.properties as Record<string, unknown> | undefined
const fromProps = typeof props?.sessionID === "string" ? props.sessionID : undefined
@@ -46,12 +55,7 @@ export function createAgentSwitchHook(ctx: PluginInput) {
const info = props?.info as Record<string, unknown> | undefined
const deletedSessionID = info?.id
if (typeof deletedSessionID === "string") {
clearPendingSwitchRuntime(deletedSessionID)
for (const key of Array.from(processedFallbackMessages)) {
if (key.startsWith(`${deletedSessionID}:`)) {
processedFallbackMessages.delete(key)
}
}
clearFallbackMarkersForSession(deletedSessionID)
}
return
}
@@ -61,12 +65,7 @@ export function createAgentSwitchHook(ctx: PluginInput) {
const info = props?.info as Record<string, unknown> | undefined
const erroredSessionID = info?.id ?? props?.sessionID
if (typeof erroredSessionID === "string") {
clearPendingSwitchRuntime(erroredSessionID)
for (const key of Array.from(processedFallbackMessages)) {
if (key.startsWith(`${erroredSessionID}:`)) {
processedFallbackMessages.delete(key)
}
}
clearFallbackMarkersForSession(erroredSessionID)
}
return
}