Repository navigation
Primary agent responds in subagent view; delegated subagent views become inaccessible #4422
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
good first issueGood for newcomersGood for newcomersopentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Description
When switching to a subagent view by clicking on a delegated subagent in the right-hand panel, the text input box remains active and accepts user input. However, the primary agent (as selected by the 'tab' key) responds within the subagent's view instead of the subagent itself.
This creates two critical issues:
- Unexpected interaction behavior: Users expect to engage with the subagent when typing in a subagent view, but the primary agent responds instead, making it unclear which agent's context is being used
- Inaccessible subagent views: When the primary agent delegates a new task while in a subagent's view, the newly created subagent view becomes completely inaccessible
This prevents proper debugging of subagent behavior and makes it impossible to review their tool calls, responses, or interact with them directly in complex agent workflows.
OpenCode version
v1.0.67 (issue likely persists in v1.0.68)
Steps to reproduce
- Start an OpenCode session with the primary agent
- Have the primary agent delegate a task to a subagent (e.g., using the task tool)
- Click on the subagent entry in the right-hand panel to switch to its view
- Type a message in the text input box while viewing the subagent
- Observe that the primary agent responds in the subagent's view instead of the subagent
- While still in the subagent view, have the primary agent delegate another task
- Observe that the newly created subagent view is now inaccessible
Expected behavior
- When viewing a subagent, user input should engage with that specific subagent
- OR the text input should be disabled/hidden when viewing a subagent to prevent confusion
- All delegated subagent views should remain accessible regardless of which view the delegation occurred from
- Clear visual indication of which agent is currently active for user input
Actual behavior
- Primary agent responds in the subagent's view
- Unclear which agent's context receives user messages
- Newly delegated subagent views become inaccessible when delegation happens from within another subagent's view
Screenshot and/or share link
[Will be provided if requested - issue is reproducible with any agent workflow involving subagent delegation]
Operating System
macOS 26.1 (arm64, nix-darwin)
Terminal
Ghostty v1.1.2
Additional context
- It's unclear whether messages sent while viewing a subagent are added to the primary agent's context or handled separately
- This may be related to issue opentui: fatal: undefined is not an object (evaluating 'lines().length') #4372 which involves fatal errors when working with subagents
- Also potentially related to Sub-agent's request for permission is not shown in the primary agent's view #4078 (subagent permission requests not visible) and ctrl-left/right doesn't navigate between subagents since 1.0 TUI - TUI captures left and right? #4180 (navigation between subagents)
- The issue affects the ability to debug and monitor subagent workflows effectively
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersopentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Activity
github-actions commentedon Nov 17, 2025
This issue might be a duplicate of existing issues. Please check:
The core issue described in #2390 appears to be nearly identical - users can navigate to subagent views but typing messages results in the primary agent responding instead of the subagent.
Feel free to ignore if none of these address your specific case.
ndrwstn commentedon Nov 17, 2025
Thanks for the automated cross-reference!
Issue #2390 does appear to describe the same core problem (primary agent responding when typing in a subagent view). However, that issue may be from the pre-1.0 (0.x.x) version of OpenCode based on its date, so it's worth confirming this persists in the current 1.0.x TUI.
The second issue I've encountered - where subagent views become completely inaccessible after the primary agent delegates a new task while in a subagent's view - doesn't appear to be discussed in #2390 or the other related issues. This "lost delegation" problem makes it impossible to access certain subagent views at all, which is a distinct (though possibly related) bug from the input routing issue.
rekram1-node commentedon Nov 18, 2025
Yeah we will do something better here
christomitov commentedon Nov 18, 2025
Is this still open?
taqtiqa-mark commentedon Nov 18, 2025
Tagging the A2A protocol discussion in #3023 as a relevant option to evaluate.
rekram1-node commentedon Nov 18, 2025
@christomitov yes
ticoombs commentedon Dec 8, 2025
FWIW, in 1.0.129 I don't have this issue. When i type in a sub-agents window, it goes to that sub-agent.
ShpetimA commentedon Dec 29, 2025
Screen.Recording.2025-12-29.at.6.04.24.PM.mov
I took a look at this and removed the input since atm the primary agent only waits for the first message for the context and all other messages are irrelevant.
I added in the header aswell an indicator that shows that the subagent is working atm.
If this looks good to you @rekram1-node I could create a pr
LTS2 commentedon Jan 14, 2026
Hi, I'd like to take this issue. Could you assign it to me?
I dug into the cause. When a subagent spawns another subagent, the child is currently using the immediate parent's session ID instead of the root parent's ID. Because of that, nested subagents don't show up in the children() list in the TUI.
I have a patch ready that adds a getRootParentID() helper so every subagent attaches under the original parent session.
taqtiqa-mark commentedon Jan 15, 2026
@LTS2, given you have delved into the OC code... can you opine on the suitability/utility of the PocketFlow 100 line framework.
TypeScript implementation here.
sainzs commentedon Mar 3, 2026
I’d like to work on this one. I’ll start by reproducing on current , then propose a focused fix for subagent input routing + nested subagent visibility.
sainzs commentedon Mar 3, 2026
Clarification: I’m testing against the current dev branch and will propose a focused fix for subagent input routing plus nested subagent visibility.
StressTestor commentedon Mar 3, 2026
I'd like to take this one on. The subagent view routing the input to the primary agent instead of the viewed subagent is a clear bug — I'll dig into the TUI input handling and fix the dispatch logic.
fix(opencode): collect nested subagent sessions in TUI sidebar
fix(tui): show prompt when viewing subagent sessions
github-actions commentedon May 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.