fix(keyword-detector): add logging for silent skip paths (fixes #2058)

This commit is contained in:
MoerAI
2026-03-27 21:24:03 +09:00
parent 324dbb119c
commit f030e0d78d

View File

@@ -57,17 +57,20 @@ export function createKeywordDetectorHook(ctx: PluginInput, _collector?: Context
let detectedKeywords = detectKeywordsWithType(cleanText, currentAgent, modelID) let detectedKeywords = detectKeywordsWithType(cleanText, currentAgent, modelID)
if (isPlannerAgent(currentAgent)) { if (isPlannerAgent(currentAgent)) {
const preFilterCount = detectedKeywords.length
detectedKeywords = detectedKeywords.filter((k) => k.type !== "ultrawork") detectedKeywords = detectedKeywords.filter((k) => k.type !== "ultrawork")
if (preFilterCount > detectedKeywords.length) {
log(`[keyword-detector] Filtered ultrawork keywords for planner agent`, { sessionID: input.sessionID, agent: currentAgent })
}
} }
if (detectedKeywords.length === 0) { if (detectedKeywords.length === 0) {
return return
} }
// Skip keyword detection for background task sessions to prevent mode injection
// (e.g., [analyze-mode]) which incorrectly triggers Prometheus restrictions
const isBackgroundTaskSession = subagentSessions.has(input.sessionID) const isBackgroundTaskSession = subagentSessions.has(input.sessionID)
if (isBackgroundTaskSession) { if (isBackgroundTaskSession) {
log(`[keyword-detector] Skipping keyword injection for background task session`, { sessionID: input.sessionID })
return return
} }