fix(keyword-detector): skip keyword detection for background task sessions

Skip all keyword detection for background task sessions to prevent mode
injection (e.g., [analyze-mode], [search-mode]) which incorrectly triggers
Prometheus planner restrictions on Sisyphus sessions.

This aligns with the existing pattern used in:
- sisyphus-orchestrator (line 504)
- todo-continuation-enforcer (line 303)
- session-notification (line 278)

Closes #713
This commit is contained in:
Sangguen Chang
2026-01-17 10:23:23 +09:00
parent 8391b8a7a5
commit 0823dbe4d4
3 changed files with 16 additions and 22 deletions

View File

@@ -72,12 +72,11 @@
"empty-message-sanitizer",
"thinking-block-validator",
"ralph-loop",
"preemptive-compaction",
"compaction-context-injector",
"claude-code-hooks",
"auto-slash-command",
"edit-error-recovery",
"sisyphus-task-retry",
"delegate-task-retry",
"prometheus-md-only",
"start-work",
"sisyphus-orchestrator"
@@ -2134,14 +2133,6 @@
"auto_resume": {
"type": "boolean"
},
"preemptive_compaction": {
"type": "boolean"
},
"preemptive_compaction_threshold": {
"type": "number",
"minimum": 0.5,
"maximum": 0.95
},
"truncate_all_tool_outputs": {
"type": "boolean"
},
@@ -2234,9 +2225,6 @@
}
}
}
},
"dcp_for_compaction": {
"type": "boolean"
}
}
},

View File

@@ -1,6 +1,5 @@
{
"lockfileVersion": 1,
"configVersion": 1,
"workspaces": {
"": {
"name": "oh-my-opencode",
@@ -31,13 +30,13 @@
"typescript": "^5.7.3",
},
"optionalDependencies": {
"oh-my-opencode-darwin-arm64": "0.0.0",
"oh-my-opencode-darwin-x64": "0.0.0",
"oh-my-opencode-linux-arm64": "0.0.0",
"oh-my-opencode-linux-arm64-musl": "0.0.0",
"oh-my-opencode-linux-x64": "0.0.0",
"oh-my-opencode-linux-x64-musl": "0.0.0",
"oh-my-opencode-windows-x64": "0.0.0",
"oh-my-opencode-darwin-arm64": "3.0.0-beta.8",
"oh-my-opencode-darwin-x64": "3.0.0-beta.8",
"oh-my-opencode-linux-arm64": "3.0.0-beta.8",
"oh-my-opencode-linux-arm64-musl": "3.0.0-beta.8",
"oh-my-opencode-linux-x64": "3.0.0-beta.8",
"oh-my-opencode-linux-x64-musl": "3.0.0-beta.8",
"oh-my-opencode-windows-x64": "3.0.0-beta.8",
},
},
},

View File

@@ -2,7 +2,7 @@ import type { PluginInput } from "@opencode-ai/plugin"
import { detectKeywordsWithType, extractPromptText, removeCodeBlocks } from "./detector"
import { log } from "../../shared"
import { isSystemDirective } from "../../shared/system-directive"
import { getMainSessionID, getSessionAgent } from "../../features/claude-code-session-state"
import { getMainSessionID, getSessionAgent, subagentSessions } from "../../features/claude-code-session-state"
import type { ContextCollector } from "../../features/context-injector"
export * from "./detector"
@@ -37,6 +37,13 @@ export function createKeywordDetectorHook(ctx: PluginInput, collector?: ContextC
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)
if (isBackgroundTaskSession) {
return
}
const mainSessionID = getMainSessionID()
const isNonMainSession = mainSessionID && input.sessionID !== mainSessionID