Description
When a child session (subagent) triggers a permission request in the Web UI, approving it via "Allow once" or "Allow always" can leave the permission prompt visible in the composer even after the server has accepted the response.
The server returns 200 true for the permission reply, and subsequent GET /permission calls return an empty array [], confirming the permission was processed. However, the Web UI composer still renders the stale permission prompt until another sync event arrives or the page is refreshed.
Steps to Reproduce
- Start OpenCode with Web UI (
opencode serve and opencode attach, or dev mode).
- Create a session and trigger a subagent or background task that requires a permission (e.g., a bash command with
permission: { bash: "ask" }).
- In the parent session composer, observe the permission prompt for the child session.
- Click "Allow once".
- Observe that the permission prompt remains visible in the composer, even though the subagent proceeds.
Expected Behavior
The permission prompt should be removed from the composer immediately after the server confirms the response.
Actual Behavior
The permission prompt persists in the Web UI composer, creating a stale UI state that may confuse users.
Environment
- OpenCode version: latest (observed during development)
- Browser: Chrome (via Chrome DevTools MCP during reproduction)
- OS: Linux
Related
This is a client-side UI state issue. The backend processes the permission correctly, but the frontend sync cache does not remove the accepted permission from the local store after a successful response.
Proposed Fix
After sdk.client.permission.respond() succeeds, optimistically remove the matching permission from the local sync cache (sync.set("permission", sessionID, ...)) so the composer re-renders without the stale prompt.
This aligns the UI state with the confirmed server response without waiting for the next sync event.
Description
When a child session (subagent) triggers a permission request in the Web UI, approving it via "Allow once" or "Allow always" can leave the permission prompt visible in the composer even after the server has accepted the response.
The server returns
200 truefor the permission reply, and subsequentGET /permissioncalls return an empty array[], confirming the permission was processed. However, the Web UI composer still renders the stale permission prompt until another sync event arrives or the page is refreshed.Steps to Reproduce
opencode serveandopencode attach, or dev mode).permission: { bash: "ask" }).Expected Behavior
The permission prompt should be removed from the composer immediately after the server confirms the response.
Actual Behavior
The permission prompt persists in the Web UI composer, creating a stale UI state that may confuse users.
Environment
Related
This is a client-side UI state issue. The backend processes the permission correctly, but the frontend sync cache does not remove the accepted permission from the local store after a successful response.
Proposed Fix
After
sdk.client.permission.respond()succeeds, optimistically remove the matching permission from the localsynccache (sync.set("permission", sessionID, ...)) so the composer re-renders without the stale prompt.This aligns the UI state with the confirmed server response without waiting for the next sync event.