fix(plugin): persist selected model only for main session#2798
Merged
code-yeongyu merged 1 commit intodevfrom Mar 24, 2026
Merged
fix(plugin): persist selected model only for main session#2798code-yeongyu merged 1 commit intodevfrom
code-yeongyu merged 1 commit intodevfrom
Conversation
Reuse the stored model only for subsequent main-session messages when the UI provides no model, while preserving first-message behavior, explicit overrides, and subagent isolation. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 2/5
- There is a high-confidence functional issue in
src/plugin/chat-message.ts: looking uppluginConfig.agentswith the raw agent name (instead ofgetAgentConfigKey(agent)) can cause the wrong agent config to be applied at runtime. - The same code path also ignores overrides from the non-deprecated
categoryfield, so configured behavior may not match user/admin expectations even when valid overrides exist. - Given the 8/10 severity and direct behavior impact in message handling/config resolution, this is a high-risk merge until the lookup and override logic are aligned.
- Pay close attention to
src/plugin/chat-message.ts- agent key mapping andcategory-based override resolution are likely to regress configuration behavior.
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/plugin/chat-message.ts">
<violation number="1" location="src/plugin/chat-message.ts:40">
P1: The raw agent name must be mapped via `getAgentConfigKey(agent)` before looking it up in `pluginConfig.agents`. Additionally, the function misses overrides defined via the non-deprecated `category` field (`configuredAgent?.category`).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }) | ||
| } | ||
|
|
||
| function hasExplicitAgentModelOverride( |
There was a problem hiding this comment.
P1: The raw agent name must be mapped via getAgentConfigKey(agent) before looking it up in pluginConfig.agents. Additionally, the function misses overrides defined via the non-deprecated category field (configuredAgent?.category).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/plugin/chat-message.ts, line 40:
<comment>The raw agent name must be mapped via `getAgentConfigKey(agent)` before looking it up in `pluginConfig.agents`. Additionally, the function misses overrides defined via the non-deprecated `category` field (`configuredAgent?.category`).</comment>
<file context>
@@ -35,6 +37,53 @@ function isStartWorkHookOutput(value: unknown): value is StartWorkHookOutput {
})
}
+function hasExplicitAgentModelOverride(
+ agent: string | undefined,
+ pluginConfig: OhMyOpenCodeConfig
</file context>
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.
Summary
Verification
bun test src/plugin/chat-message.test.ts src/plugin-handlers/agent-config-handler.test.ts src/plugin-handlers/config-handler.test.tsbun run typecheckbun run buildContext
getMainSessionID()inside config loading.Summary by cubic
Persist and reuse the selected model only for the true main session, and only on follow-up messages when the UI sends no model. Keeps first-message behavior, agent model overrides, and subagent isolation intact (addresses #2353).
Written for commit 7fa2417. Summary will update on new commits.