Skip to content

[FEATURE]: TUI should show pending permissions or questions when attaching to a session #10564

Closed

Description

@tensor-ninja

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When using opencode attach to connect to a running server, the TUI does not display permissions or questions that were asked while no TUI was attached. This blocks the detach/reattach workflow.

You can reproduce by:

  • Start opencode in server mode: opencode serve
  • Attach in another terminal: opencode attach http://127.0.0.1:4096
  • Send a prompt that triggers the AI to ask a question
  • Detach from the TUI
  • Reattach: opencode attach http://127.0.0.1:4096 --session

Expected: The pending question should be displayed in the TUI
Actual: The question is not shown; the session appears stuck on N questions asked

The TUI's sync context src/cli/cmd/tui/context/sync.tsx only populates store.permission and store.question from SSE events permission.asked, question.asked. When a TUI attaches after the event has already fired, it never receives the event and doesn't know about pending items.

The server already has endpoints to list pending items:

  • GET /permission - Lists all pending permission requests
  • GET /question - Lists all pending question requests

But the TUI doesn't call these during bootstrap.

I think we should add API calls to the bootstrap sequence in sync.tsx to fetch pending permissions and questions:

sdk.client.permission.list().then((x) => {
  const grouped: Record<string, PermissionRequest[]> = {}
  for (const p of x.data ?? []) {
    if (!grouped[p.sessionID]) grouped[p.sessionID] = []
    grouped[p.sessionID]!.push(p)
  }
  setStore("permission", reconcile(grouped))
}),
sdk.client.question.list().then((x) => {
  const grouped: Record<string, QuestionRequest[]> = {}
  for (const q of x.data ?? []) {
    if (!grouped[q.sessionID]) grouped[q.sessionID] = []
    grouped[q.sessionID]!.push(q)
  }
  setStore("question", reconcile(grouped))
}),

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 25, 2026
  2. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 25, 2026
  3. dseravalli commented on Feb 14, 2026

    @dseravalli

    I am building an opencode agent orchestrator and needed this functionality, so I took @tensor-ninja 's idea and tried it out. Seems to work great.
    #13657

  4. tensor-ninja commented on Feb 15, 2026

    @tensor-ninja
    Author

    Yes! I'd love to see this merged!

  5. github-actions commented on Apr 17, 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

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussionopentuiThis 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