Normalize agent name comparisons to handle display name keys

Hooks and tools now use getAgentConfigKey() to resolve agent names (which may
be display names like 'Atlas (Plan Executor)') to lowercase config keys
before comparison.

- session-utils: orchestrator check uses getAgentConfigKey
- atlas event-handler: boulder agent matching uses config keys
- category-skill-reminder: target agent check uses config keys
- todo-continuation-enforcer: skipAgents comparison normalized
- subagent-resolver: resolves 'metis' -> 'Metis (Plan Consultant)' for lookup
This commit is contained in:
YeonGyu-Kim
2026-02-16 20:43:09 +09:00
parent dde858794a
commit 49b6c108e2
6 changed files with 28 additions and 17 deletions
@@ -9,6 +9,7 @@ import {
} from "../../features/hook-message-injector"
import { log } from "../../shared/logger"
import { isSqliteBackend } from "../../shared/opencode-storage-detection"
import { getAgentConfigKey } from "../../shared/agent-display-names"
import {
CONTINUATION_PROMPT,
@@ -103,7 +104,7 @@ export async function injectContinuation(args: {
tools = tools ?? previousMessage?.tools
}
if (agentName && skipAgents.includes(agentName)) {
if (agentName && skipAgents.some(s => getAgentConfigKey(s) === getAgentConfigKey(agentName))) {
log(`[${HOOK_NAME}] Skipped: agent in skipAgents list`, { sessionID, agent: agentName })
return
}
@@ -4,6 +4,7 @@ import type { BackgroundManager } from "../../features/background-agent"
import type { ToolPermission } from "../../features/hook-message-injector"
import { normalizeSDKResponse } from "../../shared"
import { log } from "../../shared/logger"
import { getAgentConfigKey } from "../../shared/agent-display-names"
import {
ABORT_WINDOW_MS,
@@ -162,8 +163,9 @@ export async function handleSessionIdle(args: {
log(`[${HOOK_NAME}] Agent check`, { sessionID, agentName: resolvedInfo?.agent, skipAgents, hasCompactionMessage })
if (resolvedInfo?.agent && skipAgents.includes(resolvedInfo.agent)) {
log(`[${HOOK_NAME}] Skipped: agent in skipAgents list`, { sessionID, agent: resolvedInfo.agent })
const resolvedAgentName = resolvedInfo?.agent
if (resolvedAgentName && skipAgents.some(s => getAgentConfigKey(s) === getAgentConfigKey(resolvedAgentName))) {
log(`[${HOOK_NAME}] Skipped: agent in skipAgents list`, { sessionID, agent: resolvedAgentName })
return
}
if (hasCompactionMessage && !resolvedInfo?.agent) {