Description
Description
When attaching a TUI client to an already-running session (via opencode attach), any pending permission or question prompts that were raised while the client was detached are not displayed. The session appears stuck in a "busy" state with no way for the user to respond.
Expected behavior:
On attach, pending permission and question prompts should appear in the UI so the user can respond to them.
Actual behavior:
The session shows as busy but no prompt is rendered. The bootstrap() function in the TUI sync context fetches sessions, messages, config, etc., but never calls GET /permission or GET /question to load pending requests into the store. These are only populated via real-time SSE events (permission.asked, question.asked), which are ephemeral BusEvents — if no client was connected when they fired, they're lost.
Root cause:
packages/opencode/src/cli/cmd/tui/context/sync.tsx — the bootstrap() non-blocking phase does not call sdk.client.permission.list() or sdk.client.question.list(). The server endpoints exist and return the correct pending items, but the TUI never queries them on startup.
Note
This is distinct from #15172, which covers questions lost after a server restart (in-memory state destroyed). This bug occurs with a running server — the pending state is alive in memory, the TUI client just doesn't fetch it on connect.
Steps to reproduce
- Start opencode in server mode (
opencode serve) - Attach to a session and send a prompt that triggers a permission request (e.g. a bash command)
- Detach the TUI before responding to the permission prompt
- Re-attach to the same session via
opencode attach - The permission prompt is not shown — the session appears stuck
Operating System
Linux
Terminal
Any
Activity
github-actions commentedon Apr 6, 2026
This issue might be a duplicate of existing issues. Please check:
sync.tsx, and even proposes the same fix (callingpermission.list()/question.list()during bootstrap).opencode serve+opencode attachif any permission is set to "ask" #16367: Reports the agent hanging indefinitely when usingopencode serve+opencode attachbecause permission prompts are not relayed to the attached client — same underlying issue.Please review those issues and consider whether this should be linked or closed as a duplicate.
opencode serve+opencode attachif any permission is set to "ask" #16367jtubbenhauer commentedon Apr 6, 2026
This would be solved by #13657