opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[BUG] Subagent permission request UI prompts fail to render when opening an active session in secondary UI instances

Open cccaballero opened this issue 2 months ago • 3 comments

Description

When an active session involves a subagent requesting permission (e.g., external directory access via tool calls), the primary UI instance correctly displays the interactive "Permission required" prompt. However, if the same session is loaded or attached from a secondary UI instance (e.g., launching another OpenCode CLI instance or connecting via integrations such as the JetBrains ACP plugin), the permission prompt fails to render in the chat UI.

Because the secondary instance does not display the permission dialog, users cannot grant or reject the requested permission, causing the session to hang indefinitely waiting for user input.

Expected Behavior

When attaching or viewing a running session across multiple instances (or secondary clients like the JetBrains ACP integration), pending permission requests triggered by subagents should sync state and render the permission prompt so the user can approve or reject it from any connected UI.

Actual Behavior

The permission prompt only appears in the instance where the request was originally initiated. In secondary attached instances, the prompt is completely invisible, leaving the session stuck in an unexecutable state.


Environment / Version Details

  • OpenCode Version: 1.18.34
  • OMO-Slim Version: v2.2.13
  • OS: Linux (Ubuntu 26.04)
  • Integrations Affected: OpenCode CLI (multi-instance session attachment), OpenCode JetBrains ACP Plugin

Plugins

context-mode, oh-my-opencode-slim

OpenCode version

1.18.34

Steps to reproduce

  1. Start an OpenCode terminal/UI instance (Instance A).
  2. Prompt the Orchestrator with a task that triggers a subagent requiring permission (e.g., reading/accessing an external path like /home/.../test/tmp/*).
  3. Observe Instance A when the subagent requests permission: the "Permission required" dialog renders properly at the bottom of the chat interface.
  4. Launch a second OpenCode UI instance or attach via the JetBrains ACP plugin (Instance B).
  5. Switch to/open the active running session in Instance B (ctrl+x l -> Select active session).
  6. Observe Instance B: The task appears stalled, and the interactive permission prompt is missing from the UI.

Screenshot and/or share link

https://github.com/user-attachments/assets/b3384124-a3b5-457c-9590-e00d32a59c0a

Operating System

Ubuntu 26.04

Terminal

Gnome Terminal

cccaballero avatar Oct 01 '26 01:10 cccaballero

This issue might be a duplicate of existing issues about pending prompts not appearing when attaching to a session. Please check:

  • #21154: Pending permission/question prompts are not shown when reattaching to an existing session.
  • #10564: TUI does not display pending permissions or questions when attaching to a session.

For keybind-related issues, please also check our pinned keybinds documentation: #4997

github-actions[bot] avatar Oct 01 '26 01:10 github-actions[bot]

Thanks for the report and the video. This is on OpenCode v1 (opencode-ai 1.18.34), which now only gets critical fixes (data loss, security, breakage with no workaround). Here the prompt still shows in the instance that started the request and can be answered there, so this won't be fixed in v1. Please try v2 (@opencode/cli, see the migration guide). If subagent permission prompts still don't show up in a second client on v2, comment with your version and steps and we'll reopen.

neriousy avatar Oct 20 '26 08:10 neriousy

Environment

Windows 11, opencode 2.3.2 shared daemon (opencode serve --service, pid 47872, port 28894). One TUI client (VS Code terminal tab, session age: days, ~198k context) + one web/chamber client on the same daemon. Earlier the same day the machine went through an idle-location eviction storm (documented separately).

Symptom timeline (2026-11-21, all times UTC, service log)

  1. A plugin-gated tool call resolves to ask → host creates pending request per_2001e61ff001NNbtJAp62uh00s (session ses_e0ad30…, location C:\Users\Soren\Desktop\AgentWorkCommon\opencode_plugin_dev).
  2. TUI shows the tool as "Running code…" — no permission dialog is drawn. Caller parks (Deferred.await, no timeout).
  3. ~2 minutes later the user presses ESC.
  4. Service log immediately shows: POST /api/session/ses_e0ad30…/permission/per_2001e61ff001NNbtJAp62uh00s/reply — a reject reply POSTed by the TUI with the correct requestID.
  5. Tool call aborts with {"type":"aborted","message":"Tool execution interrupted"} (#51223's exact signature).

Why this matters (novel evidence)

  • The reject POST could only originate from a client that knew the requestID — i.e. the TUI ingested permission.asked (or learned the id another way) and had it in its permission store.
  • Yet the dialog never drew. So the failure is downstream of event ingestion: store-populated, render-path-wedged — precisely the #63838/#28312/#52411 class, but proving ingestion succeeded rules out the "missed one-shot event" theory (#21154 family) for this instance.
  • Discriminators already run against the live daemon:
    • GET /api/permission/request → {"location":{"directory":"C:\\Users\\Soren"},"data":[]} (post-ESC; no residue).
    • GET /api/debug/location → all three locations loaded and alive (eviction-as-direct-cause excluded: a completed eviction rejects the ask immediately instead of hanging).
    • No SubscriberOverflow, no "managed service registration replaced" in the log — SSE queue-overflow and daemon-replacement excluded.
    • GET /api/agent on this daemon throws repeated failed to encode response (11-19, ongoing) — separate schema-encode issue, noted in passing.

Request

Consider a TUI-side reconcile: on focus/attach/interrupt-edge, GET /api/session/{id}/permission and render any pending request not already drawn (the #10564/#21154 bootstrap, extended to the live-render path). Happy to provide full service log excerpts on request.

ChengZiiii avatar Nov 22 '26 13:11 ChengZiiii