Enable remote named permission profile selection in the TUI (#43340)

## Why

The permissions picker displayed profiles from the connected app server but disabled selection of remote custom profiles.

## What changed

- Enable named profile selection through `thread/settings/update` and track pending selections until server confirmation.
- Use pending or confirmed server permissions for subsequent turns, preserve profiles across forks and prompt edits, and reconcile pending selections on reconnect.
- Block conflicting permission changes and forks while selection is pending. Preserve input when selection fails and report unsupported app servers.
- Reject working directory changes while a remote named profile is active.

## Testing

Add regression coverage for profile selection, turn permissions, pending-selection guards, prompt-edit profile preservation, reconnect reconciliation, and profile inheritance in forks and side conversations.

GitOrigin-RevId: 76e9bb7b4d631b1066974da013d9915a89dc54a7
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-07 03:19:57 +00:00
1 parent 1fb5158b34
commit 121f91fd5d
24 files changed
+914 -50

No files matched your search

+13 -1
View File
@@ -267,6 +267,17 @@ impl App {
.with_collaboration_modes(bootstrap.collaboration_modes),
);
self.pending_app_server_requests.clear();
let pending_displayed_profile =
displayed.is_some_and(|id| self.pending_server_profiles.contains_key(&id));
if pending_displayed_profile {
self.runtime_approval_policy_override = None;
self.runtime_permission_profile_override = None;
}
// The displayed task was resumed above. Keep offscreen selections pending until those
// tasks can be resumed from the server too; their old confirmations cannot arrive.
if let Some(id) = displayed {
self.pending_server_profiles.remove(&id);
}
self.pending_primary_events.clear();
self.pending_plugin_enabled_writes.clear();
self.pending_hook_enabled_writes.clear();
@@ -313,7 +324,8 @@ impl App {
}
if let Some(mut started) = thread {
let id = started.session.thread_id;
if let Some(channel) = self.thread_event_channels.get(&id)
if !pending_displayed_profile
&& let Some(channel) = self.thread_event_channels.get(&id)
&& let Some(cached) = channel.store.lock().await.session.as_ref()
{
self.restore_runtime_permissions(&mut started.session, cached);