fix: skip keyword injection for non-OMO agents (fixes #2024)#2765
Merged
code-yeongyu merged 1 commit intodevfrom Mar 23, 2026
Merged
fix: skip keyword injection for non-OMO agents (fixes #2024)#2765code-yeongyu merged 1 commit intodevfrom
code-yeongyu merged 1 commit intodevfrom
Conversation
There was a problem hiding this comment.
2 issues found across 5 files
Confidence score: 3/5
- Potential user-facing behavior change: keyword injection may run for the default OpenCode agent because
buildisn’t recognized, which could alter detection behavior insrc/hooks/keyword-detector/ultrawork/source-detector.ts. - Similar compatibility gap in
src/hooks/keyword-detector/hook.tswhereisNonOmoAgentmisses thebuildagent, making agent filtering inconsistent and likely incorrect. - Given the high severity/confidence of agent-name mismatches, there’s some regression risk despite a small scope change.
- Pay close attention to
src/hooks/keyword-detector/ultrawork/source-detector.ts,src/hooks/keyword-detector/hook.ts- agent name checks should includebuildto prevent unintended keyword injection.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/hooks/keyword-detector/hook.ts">
<violation number="1" location="src/hooks/keyword-detector/hook.ts:49">
P1: Custom agent: **Opencode Compatibility**
The OpenCode native agent is named `build`, which is missed by the `isNonOmoAgent` check (which only looks for `builder` and `plan`). Explicitly check for `build` to ensure the native subagent doesn't receive unsupported keyword injections.</violation>
</file>
<file name="src/hooks/keyword-detector/ultrawork/source-detector.ts">
<violation number="1" location="src/hooks/keyword-detector/ultrawork/source-detector.ts:33">
P1: Custom agent: **Opencode Compatibility**
The built-in OpenCode agent is named `build`, not `builder`. Update the condition to check for `build` so that keyword injection is correctly skipped for the default agent.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const currentAgent = getSessionAgent(input.sessionID) ?? input.agent | ||
|
|
||
| // Skip all keyword injection for non-OMO agents (e.g., OpenCode-Builder, Plan) | ||
| if (isNonOmoAgent(currentAgent)) { |
There was a problem hiding this comment.
P1: Custom agent: Opencode Compatibility
The OpenCode native agent is named build, which is missed by the isNonOmoAgent check (which only looks for builder and plan). Explicitly check for build to ensure the native subagent doesn't receive unsupported keyword injections.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/hooks/keyword-detector/hook.ts, line 49:
<comment>The OpenCode native agent is named `build`, which is missed by the `isNonOmoAgent` check (which only looks for `builder` and `plan`). Explicitly check for `build` to ensure the native subagent doesn't receive unsupported keyword injections.</comment>
<file context>
@@ -45,6 +45,12 @@ export function createKeywordDetectorHook(ctx: PluginInput, _collector?: Context
const currentAgent = getSessionAgent(input.sessionID) ?? input.agent
+ // Skip all keyword injection for non-OMO agents (e.g., OpenCode-Builder, Plan)
+ if (isNonOmoAgent(currentAgent)) {
+ log(`[keyword-detector] Skipping keyword injection for non-OMO agent`, { sessionID: input.sessionID, agent: currentAgent })
+ return
</file context>
Suggested change
| if (isNonOmoAgent(currentAgent)) { | |
| if (currentAgent === "build" || isNonOmoAgent(currentAgent)) { |
| export function isNonOmoAgent(agentName?: string): boolean { | ||
| if (!agentName) return false | ||
| const lowerName = agentName.toLowerCase() | ||
| return lowerName.includes("builder") || lowerName === "plan" |
There was a problem hiding this comment.
P1: Custom agent: Opencode Compatibility
The built-in OpenCode agent is named build, not builder. Update the condition to check for build so that keyword injection is correctly skipped for the default agent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/hooks/keyword-detector/ultrawork/source-detector.ts, line 33:
<comment>The built-in OpenCode agent is named `build`, not `builder`. Update the condition to check for `build` so that keyword injection is correctly skipped for the default agent.</comment>
<file context>
@@ -23,6 +23,16 @@ export function isPlannerAgent(agentName?: string): boolean {
+export function isNonOmoAgent(agentName?: string): boolean {
+ if (!agentName) return false
+ const lowerName = agentName.toLowerCase()
+ return lowerName.includes("builder") || lowerName === "plan"
+}
+
</file context>
Suggested change
| return lowerName.includes("builder") || lowerName === "plan" | |
| return lowerName === "build" || lowerName === "plan" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The keyword-detector hook injects
[search-mode]/[analyze-mode]into all agents in the main session, including the built-in OpenCode Builder/Plan agents that do not understand these keywords.Fix
Check the current agent before keyword injection. Skip injection for non-OMO agents (built-in Builder, Plan, etc.).
Fixes #2024
Automated fix by Sisyphus (oh-my-opencode)
Summary by cubic
Skip injecting
[search-mode]and[analyze-mode]for non-OMO agents (OpenCode-Builder, Plan) to prevent invalid prompts; keep injection for OMO agents. Fixes #2024.isNonOmoAgentand exported it throughultraworkandconstants.Written for commit de371be. Summary will update on new commits.