-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix(tui): don't show 'Agent not found' toast for subagents #6528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
When a command runs with a subagent (e.g., /init with project-initializer), the TUI tried to set the current agent to it, which failed because local.agent.list() only includes primary agents (mode !== 'subagent'). This caused an erroneous 'Agent not found' toast even though the subagent session was created and running correctly in the backend. The fix checks if the agent exists in the primary agents list before attempting to set it. Regression introduced in ed0c0d9 (feat: add variants toggle sst#6325)
ba3916a to
237e6f8
Compare
burgercrisis
pushed a commit
to burgercrisis/opencode
that referenced
this pull request
Dec 31, 2025
hk9890
pushed a commit
to hk9890/opencode
that referenced
this pull request
Jan 1, 2026
hk9890
pushed a commit
to hk9890/opencode
that referenced
this pull request
Jan 1, 2026
…nomalyco#6528)" This reverts commit 87f9ebd.
hk9890
pushed a commit
to hk9890/opencode
that referenced
this pull request
Jan 1, 2026
…nomalyco#6528)" This reverts commit 97a0fd1.
dl-alexandre
pushed a commit
to dl-alexandre/opencode
that referenced
this pull request
Jan 2, 2026
dl-alexandre
pushed a commit
to dl-alexandre/opencode
that referenced
this pull request
Jan 2, 2026
…nomalyco#6528)" This reverts commit c12ea47.
dl-alexandre
pushed a commit
to dl-alexandre/opencode
that referenced
this pull request
Jan 2, 2026
…nomalyco#6528)" This reverts commit 8a68244.
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
When a command runs with a subagent (e.g.,
/initwithproject-initializer), the TUI incorrectly shows an "Agent not found" toast error.Related issues
#6518
Root Cause
The code added in #6325 (variants toggle) syncs the agent from the last user message to the TUI:
However,
local.agent.list()only includes primary agents (mode !== 'subagent'), so when a command runs with a subagent, theset()call fails and shows the toast.The backend correctly creates and runs the subagent session - only the TUI display has this bug.
Fix
Check if the agent exists in the primary agents list before attempting to set it:
Testing
/initwithagent: "my-subagent")