Uh oh!
There was an error while loading. Please reload this page.
fix(tui): don't show 'Agent not found' toast for subagents - #6528
Merged
Conversation
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 anomalyco#6325)
vtemianforce-pushed
the
fix/subagent-toast-error
branch
from
December 31, 2025 14:14
ba3916a to
237e6f8CompareUh oh!
There was an error while loading. Please reload this page.
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
hk9890 pushed a commit
to hk9890/opencode
that referenced
this pull request
Jan 1, 2026
ariane-emory pushed a commit
to ariane-emory/opencode
that referenced
this pull request
Jan 1, 2026
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
dl-alexandre pushed a commit
to dl-alexandre/opencode
that referenced
this pull request
Jan 2, 2026
triklozoid pushed a commit
to triklozoid/opencode
that referenced
this pull request
Feb 2, 2026
triklozoid pushed a commit
to triklozoid/opencode
that referenced
this pull request
Feb 2, 2026
triklozoid pushed a commit
to triklozoid/opencode
that referenced
this pull request
Feb 2, 2026
xywsxp pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 2026
xywsxp pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 2026
xywsxp pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 2026
AIALRA-0 pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0 pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0 pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0 pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0 pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0 pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
avion23 pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
avion23 pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
avion23 pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
Rwanbt pushed a commit
to Rwanbt/unifia
that referenced
this pull request
Jun 14, 2026
Rwanbt pushed a commit
to Rwanbt/unifia
that referenced
this pull request
Jun 14, 2026
Rwanbt pushed a commit
to Rwanbt/unifia
that referenced
this pull request
Jun 14, 2026
MarsQiu007 referenced
this pull request
in MarsQiu007/openNovel
Jul 31, 2026
MarsQiu007 referenced
this pull request
in MarsQiu007/openNovel
Jul 31, 2026
…6528)" This reverts commit 5e547f6.
MarsQiu007 referenced
this pull request
in MarsQiu007/openNovel
Jul 31, 2026
…#6528)" This reverts commit 04d22fb.
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 freeto 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")