opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open ndrwstn opened this issue 2 months ago • 10 comments

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

  • 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 #4372 which involves fatal errors when working with subagents
  • Also potentially related to #4078 (subagent permission requests not visible) and #4180 (navigation between subagents)
  • The issue affects the ability to debug and monitor subagent workflows effectively

ndrwstn avatar Nov 17 '25 19:11 ndrwstn

This issue might be a duplicate of existing issues. Please check:

  • #2390: Reports the same core problem - switching to a child/subagent session results in subsequent messages being sent to the parent session instead of the subagent
  • #4078: Related subagent interaction issue where subagent permission requests aren't visible in the primary agent view, requiring manual navigation to subagent views
  • #4180: Describes navigation issues between subagents in the TUI that could contribute to accessibility problems
  • #2294: Previously reported issue about subagent messages being sent to main chat instead of subagent chat (closed but may be related)

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.

github-actions[bot] avatar Nov 17 '25 19:11 github-actions[bot]

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.

ndrwstn avatar Nov 17 '25 19:11 ndrwstn

Yeah we will do something better here

rekram1-node avatar Nov 18 '25 06:11 rekram1-node

Is this still open?

christomitov avatar Nov 18 '25 15:11 christomitov

Tagging the A2A protocol discussion in https://github.com/sst/opencode/issues/3023 as a relevant option to evaluate.

taqtiqa-mark avatar Nov 18 '25 16:11 taqtiqa-mark

@christomitov yes

rekram1-node avatar Nov 18 '25 17:11 rekram1-node

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.

ticoombs avatar Dec 08 '25 23:12 ticoombs