You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Primary agent model switches to subagent model after returning to session #8946
After running a subagent with a different model than the primary agent, returning to the main session may cause the primary agent to adopt the subagent’s model.
Plugins
No response
OpenCode version
1.1.23
Steps to reproduce
Setup
Primary agent model:openai/gpt-5.2-codex
Subagent config example:
---description: Foo agentmode: subagentmodel: opencode/gemini-3-flash---
You are a foo agent
Steps to Reproduce
Open a new session.
Send a message as the primary agent (e.g., “Hi how are you”).
Invoke the subagent so it produces output and becomes the last message. For example, using the following /foo command. To reproduce it consistently, you can interrupt the subagent during its work (see screenshot).
---
description: Test md file creation
agent: foo
---
Create a test.md file with the text "bar". If the file exists, update it with "bar".
Navigate to the subagent output view, then navigate back to the primary agent.
Behavior
Expected Behavior
The primary agent should remain on its configured model: openai/gpt-5.2-codex
Actual Behavior
The primary agent incorrectly switches to the subagent model: opencode/gemini-3-flash
Notes / Additional Repro Paths
This issue only presents itself with the subagent appears as the last agent used in the list. I seem to getting mixed results on whether or not the flow is passed back to the primary agent or not. The issue can also occur during the following scenarios:
Session Switching: Switching sessions via /session and then returning to the original session.
App Restart: Closing OpenCode, reopening the application, and revisiting the session
Activity
github-actions commentedon Jan 16, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if this doesn't address your specific case.