You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Permission asks from nested subagent sessions silently hang #13715
When a subagent spawns another subagent that requires permission (e.g. bash), the permission ask is emitted but never rendered in the TUI. The session hangs forever waiting for a response that never comes.
The children() memo in src/cli/cmd/tui/routes/session/index.tsx only collects direct child sessions. Permission and question events from grandchild sessions (sub-sub-agents) are never picked up.
Repro: have a general subagent spawn another general subagent that runs a bash command with "ask" permissions. The inner agent's permission request is invisible to the user.
Plugins
None
OpenCode version
1.2.4
Steps to reproduce
Set bash permissions to "ask" for the build agent
Send the prompt: Spawn a general subagent with this task: "Spawn another general subagent with this task: 'Run ls -la using bash and report the output.' Report back what it says."
The innermost general subagent requests bash permission but no prompt appears in the TUI. The session hangs indefinitely
Both issues appear to stem from the same root cause: the TUI only collects direct child sessions and misses events (permissions, questions) from grandchild sessions and deeper descendants. #7654 specifically mentions the same code location (children() memo in src/cli/cmd/tui/routes/session/index.tsx).
I also compiled and ran this locally, and I can confirm the nested prompt surfacing issue is fixed with these changes (permissions/questions from deeper subagent descendants now surface correctly).
I’d really appreciate getting this into mainline so I don’t have to maintain a fork to keep receiving updates.
Thank you all for the great work on OpenCode — this project is fantastic.
Would also appreciate this fixed be reviewed soon. The issue is especially annoying with the Explore subagent, because it can sometimes decide to spawn its own Explore subagent
This is addressed in PR #32167 (proposal #32166). Permission asks raised anywhere in a nested tree are now routed to the root session (carrying originSessionID/originAgent/originDepth metadata), and the headless run loop's permission filter was made tree-aware — so an ask from a grandchild no longer hangs forever. There's a regression test for the root-routing case.
Still reproducible on OpenCode 1.18.7 / macOS 26.2 with the question tool, not only permission asks: a depth-2 subagent's question does not reach the root TUI, leaving the workflow silently stalled.
This descendant prompt routing must also be fixed in opencode2. See also #39112 for a current depth-2 reproduction.
I traced the current implementation and the PRs linked to this issue.
The bug is still reproducible on OpenCode 1.18.7 in #39112. The server correctly creates the nested permission/question request, but Permission.ask() then waits indefinitely for a reply. The current TUI only selects requests from the root session and its direct children, so requests from grandchildren can remain invisible.
The web/desktop app already handles this differently: it traverses the complete descendant tree through sessionTreeRequest(). The TUI and some other clients still assume one level of children.
There are now several overlapping implementations, particularly #30639 and #36046, but I could not find a submitted maintainer review choosing the intended architecture.
Could a maintainer clarify the desired request-routing contract?
Preserve the leaf sessionID, and make clients use shared ancestry/subtree handling to determine which root or managed session presents the request; or
Route the request to the root/managed ancestor in core and carry the actual origin separately through metadata such as originSessionID, originAgent, and originDepth.
My preference would be to preserve the actual requester in sessionID and add a separate core-computed presentation/owner session ID. That preserves provenance while avoiding independent tree traversal in every client.
An explicit decision would clarify whether #30639, #36046, or a smaller extracted implementation is the preferred path.
Confirmed with a deterministic depth-2 Bash permission reproduction on OpenCode 1.18.4 / Linux. This is still reproducible without a provider or child-session stall.
Direct general leaf provider/tool execution: PASS.
Depth-2 ask-free general leaf running git status --short: PASS; the leaf returned to its parent.
The Ask fixture disabled the unrelated question tool for the leaf (question: deny, resolved as tools.question: false) while leaving Bash at its normal ask boundary.
The leaf immediately requested exactly:
printf'depth2-ask-approved\n'
Debug evidence recorded permission evaluation as action=ask, followed by creation of a permission.asked request for the depth-2 leaf.
The root/Main TUI never displayed a permission prompt. It only remained on the pending child task, so the request could not be approved or rejected from the Main TUI.
Waiting did not produce a resolution event; the leaf and its parents remained blocked on the pending permission.
It is not a model/provider stall and is distinct from the earlier question-tool ambiguity because the question tool was unavailable in this run. Navigating to a child session to approve would not satisfy the centralized root-TUI permission contract.
I've literally written into my Agents.md on my projects where i use opencode for it to specifically not use subagents because of this issue, specifically in Zed's AI panel agent, so if this could get fixed that'd be awesome.
In OpenCode v2, the session view gathers pending permission requests from every session in the family, including subagents started by other subagents. Nested requests now appear in the TUI instead of hanging silently.
Added in 02cb350 and ce228bf. It was reverted once and restored in #46376. A commenter here confirmed it works in v2.0.3.
Closing as completed. If you still see a nested permission hang on v2, please open a new issue with steps to reproduce.
Activity
github-actions commentedon Feb 15, 2026
This issue might be a duplicate of an existing issue. Please check:
Both issues appear to stem from the same root cause: the TUI only collects direct child sessions and misses events (permissions, questions) from grandchild sessions and deeper descendants. #7654 specifically mentions the same code location (children() memo in src/cli/cmd/tui/routes/session/index.tsx).
feddericovonwernich commentedon Apr 11, 2026
I opened a PR with a minimal fix + regression coverage for this issue:
#21996
I also compiled and ran this locally, and I can confirm the nested prompt surfacing issue is fixed with these changes (permissions/questions from deeper subagent descendants now surface correctly).
I’d really appreciate getting this into mainline so I don’t have to maintain a fork to keep receiving updates.
Thank you all for the great work on OpenCode — this project is fantastic.
cc @thdxr @rekram1-node @adamdotdevin
Related: #7654
bernatGene commentedon Apr 12, 2026
facing the same issue.
aserowy commentedon Apr 22, 2026
would be awesome to get this fixed. Having the same result with question tool usage in subsubagents.
kind regards
dwen3232 commentedon Apr 25, 2026
Would also appreciate this fixed be reviewed soon. The issue is especially annoying with the Explore subagent, because it can sometimes decide to spawn its own Explore subagent
Terminator637 commentedon Apr 27, 2026
Rough workaround now is to restrict general, explore and others to spawn their subagents via task, questions have the same issue #7654
fix(opencode): cap subagent delegation depth at one
fix(opencode): cap subagent delegation depth at one
chore(opencode): inline Opus reviewer into code-reviewer as workaround
mguttmann commentedon Jun 13, 2026
This is addressed in PR #32167 (proposal #32166). Permission asks raised anywhere in a nested tree are now routed to the root session (carrying
originSessionID/originAgent/originDepthmetadata), and the headlessrunloop's permission filter was made tree-aware — so an ask from a grandchild no longer hangs forever. There's a regression test for the root-routing case.CodeAnimal commentedon Jul 24, 2026
This is a significant issue when using nested subagents, with a PR that apparently resolves it. It would be great if we can get this fix in ASAP.
trin4ik commentedon Jul 30, 2026
Still reproducible on OpenCode 1.18.7 / macOS 26.2 with the
questiontool, not only permission asks: a depth-2 subagent's question does not reach the root TUI, leaving the workflow silently stalled.This descendant prompt routing must also be fixed in opencode2. See also #39112 for a current depth-2 reproduction.
samiralibabic commentedon Aug 3, 2026
I traced the current implementation and the PRs linked to this issue.
The bug is still reproducible on OpenCode 1.18.7 in #39112. The server correctly creates the nested permission/question request, but
Permission.ask()then waits indefinitely for a reply. The current TUI only selects requests from the root session and its direct children, so requests from grandchildren can remain invisible.The web/desktop app already handles this differently: it traverses the complete descendant tree through
sessionTreeRequest(). The TUI and some other clients still assume one level of children.There are now several overlapping implementations, particularly #30639 and #36046, but I could not find a submitted maintainer review choosing the intended architecture.
Could a maintainer clarify the desired request-routing contract?
sessionID, and make clients use shared ancestry/subtree handling to determine which root or managed session presents the request; ororiginSessionID,originAgent, andoriginDepth.My preference would be to preserve the actual requester in
sessionIDand add a separate core-computed presentation/owner session ID. That preserves provenance while avoiding independent tree traversal in every client.An explicit decision would clarify whether #30639, #36046, or a smaller extracted implementation is the preferred path.
upiscium commentedon Aug 9, 2026
Confirmed with a deterministic depth-2 Bash permission reproduction on OpenCode 1.18.4 / Linux. This is still reproducible without a provider or child-session stall.
Topology:
Controls and observations:
Direct
generalleaf provider/tool execution: PASS.Depth-2 ask-free
generalleaf runninggit status --short: PASS; the leaf returned to its parent.The Ask fixture disabled the unrelated
questiontool for the leaf (question: deny, resolved astools.question: false) while leaving Bash at its normalaskboundary.The leaf immediately requested exactly:
Debug evidence recorded permission evaluation as
action=ask, followed by creation of apermission.askedrequest for the depth-2 leaf.The root/Main TUI never displayed a permission prompt. It only remained on the pending child task, so the request could not be approved or rejected from the Main TUI.
Waiting did not produce a resolution event; the leaf and its parents remained blocked on the pending permission.
This isolates the stop point to:
It is not a model/provider stall and is distinct from the earlier question-tool ambiguity because the question tool was unavailable in this run. Navigating to a child session to approve would not satisfy the centralized root-TUI permission contract.
Local tracking and diagnostic procedure: upiscium/KUMIKI#41
BenGoetemann commentedon Aug 11, 2026
Can confirm. I have the same issue with Version 1.18.16. please fix.
mmadariaga commentedon Aug 21, 2026
@rekram1-node we need this fixed, please
apkrymov commentedon Aug 25, 2026
@thdxr @rekram1-node
This is a complete blocker for subagent workflows. Any suggested community fix or workaround would be much appreciated
GamingInfinite commentedon Sep 16, 2026
I've literally written into my Agents.md on my projects where i use opencode for it to specifically not use subagents because of this issue, specifically in Zed's AI panel agent, so if this could get fixed that'd be awesome.
mmadariaga commentedon Sep 16, 2026
It looks like the error is fixed in v2.0.3
neriousy commentedon Oct 1, 2026
In OpenCode v2, the session view gathers pending permission requests from every session in the family, including subagents started by other subagents. Nested requests now appear in the TUI instead of hanging silently.
Added in 02cb350 and ce228bf. It was reverted once and restored in #46376. A commenter here confirmed it works in v2.0.3.
Closing as completed. If you still see a nested permission hang on v2, please open a new issue with steps to reproduce.