Skip to content

Primary agent responds in subagent view; delegated subagent views become inaccessible #4422

Closed as not planned

Description

@ndrwstn

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:

  1. 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
  2. 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

  1. Start an OpenCode session with the primary agent
  2. Have the primary agent delegate a task to a subagent (e.g., using the task tool)
  3. Click on the subagent entry in the right-hand panel to switch to its view
  4. Type a message in the text input box while viewing the subagent
  5. Observe that the primary agent responds in the subagent's view instead of the subagent
  6. While still in the subagent view, have the primary agent delegate another task
  7. 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

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 17, 2025
  2. github-actions commented on Nov 17, 2025

    @github-actions
    Contributor

    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.

  3. ndrwstn commented on Nov 17, 2025

    @ndrwstn
    Author

    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.

  4. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Collaborator

    Yeah we will do something better here

  5. christomitov commented on Nov 18, 2025

    @christomitov

    Is this still open?

  6. taqtiqa-mark commented on Nov 18, 2025

    @taqtiqa-mark

    Tagging the A2A protocol discussion in #3023 as a relevant option to evaluate.

  7. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Collaborator
  8. ticoombs commented on Dec 8, 2025

    @ticoombs

    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.

  9. ShpetimA commented on Dec 29, 2025

    @ShpetimA
    Contributor
    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

  10. LTS2 commented on Jan 14, 2026

    @LTS2

    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.

  11. taqtiqa-mark commented on Jan 15, 2026

    @taqtiqa-mark

    @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.

  12. sainzs commented on Mar 3, 2026

    @sainzs

    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.

  13. sainzs commented on Mar 3, 2026

    @sainzs

    Clarification: I’m testing against the current dev branch and will propose a focused fix for subagent input routing plus nested subagent visibility.

  14. StressTestor commented on Mar 3, 2026

    @StressTestor

    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.

  15. added a commit that references this issue on Mar 3, 2026
    459e2b4
  16. added a commit that references this issue on Mar 14, 2026
    9f40156
  17. github-actions commented on May 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersopentuiThis relates to changes in v1.0, now that opencode uses opentui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions