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
[Bug]: Changing permissions while a turn runs ends the turn as failed on providers that cannot switch modes in session #42024
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Start a Claude thread and send a message that keeps the agent busy for a while.
While that turn is running, change the permission picker (for example Auto to Full access) and send or queue a follow-up. The thread configure MCP tool and the CLI reach the same command.
Expected behavior
The running turn finishes under the mode it started with. The next turn uses the new mode.
Actual behavior
The running turn ends failed with "The provider event stream closed unexpectedly."
thread.runtime-mode.set detaches every live session whose provider cannot switch modes inside a session (supportsRuntimeModeSwitchInSession: false: Claude, Grok, Cursor, Pi, Muse, OpenCode v1, Kiro and generic ACP agents), even while its turn is running. Detaching closes the process under the turn. The composer saves a changed picker right before it sends, so any follow-up sent after a picker change during a turn triggers it.
Wait for the turn to finish before changing permissions.
Notes for a fix
Keeping the session alive until the active run settles fixes the failed turn. Two traps came up when we tried it:
Reusing the old-mode session afterwards for a provider continuation (the agent waking to report finished background work) lets new work run under the old mode. After a change to a stricter mode, a Claude wake can call tools or schedule another wake without approval, and Pi's tool hook still reads the mode it was launched with.
Muse rejects a turn whose mode differs from its host before it drains the held wake, so the session stays busy and the next user message fails with the busy refusal.
A small shape that avoids both: defer the detach until the active run settles, then close the old-mode session exactly as the command does today (background work ends as it does now), so the next message opens under the saved mode.
Seeing this on 0.1.13 stable (macOS, Claude). I switched a thread from Auto to Full access while a turn was running, and the turn ended failed with "The provider event stream closed unexpectedly."
The follow-up message started a new turn fine, so nothing got stuck.
Until the detach is deferred, the message could say the turn was stopped by the permission change. "Provider error ... check the provider and server logs" sends you looking for an outage. The server already knows the cause.
Activity
grahamfarrar commentedon Nov 27, 2026
Seeing this on 0.1.13 stable (macOS, Claude). I switched a thread from Auto to Full access while a turn was running, and the turn ended failed with "The provider event stream closed unexpectedly."
Server log for the run:
The follow-up message started a new turn fine, so nothing got stuck.
Until the detach is deferred, the message could say the turn was stopped by the permission change. "Provider error ... check the provider and server logs" sends you looking for an outage. The server already knows the cause.