Route built-in permission selections through the app server (#46008)

## Why

Built-in permission selections in connected TUI threads previously applied local settings directly. Use server-confirmed settings so the TUI adopts the authoritative permissions and refreshes cached network configuration.

## What changed

- Send built-in permission selections through the existing app-server settings API, including selections after Windows sandbox setup. Allow built-in selections during a running turn.
- Block task creation and switching while permission updates are pending, restoring submitted text to the composer when necessary.
- Refresh local permissions, approval settings, runtime overrides, and network configuration when the server confirms a built-in selection.
- Submit a pending initial prompt when the selected permissions already match the current settings.

## Testing

Add regression tests for server-confirmed built-in selection during a running turn, blocked task switches, stale proxy removal, and pending prompt submission when permissions already match. Update background-task tests to wait for settings confirmation.

GitOrigin-RevId: 76e71a8c278c37c0a7ce7c0246da7d185e12ee7a
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-16 19:15:53 +00:00
1 parent 39a99a6c36
commit 2b59d92dbd
11 files changed
+267 -9

No files matched your search

+28
View File
@@ -1282,6 +1282,34 @@ impl App {
notification = None;
}
if permission_change_confirmed {
if self.chat_widget.thread_id() == Some(thread_id)
&& let Some(profile) = self
.chat_widget
.config_ref()
.permissions
.active_permission_profile()
&& profile.id.starts_with(':')
{
let config = self.chat_widget.config_ref();
let network = config
.network_proxy_spec_for_active_permission_profile(
&profile,
config.permissions.permission_profile(),
)
.unwrap_or_else(|err| {
tracing::warn!(%err, "failed to refresh local permission network settings");
None
});
self.chat_widget.set_permission_network(network);
self.config.permissions = self.chat_widget.config_ref().permissions.clone();
self.config.approvals_reviewer = self.chat_widget.config_ref().approvals_reviewer;
self.runtime_approval_policy_override =
Some(RuntimeApprovalPolicyOverride::Explicit(
self.config.permissions.approval_policy.value().into(),
));
self.runtime_permission_profile_override =
Some(RuntimePermissionProfileOverride::from_config(&self.config));
}
self.app_event_tx.send(AppEvent::SettingsSelectionSettled);
}