Respect execution hosts in Windows sandbox setup (#44939)

## Why

The Windows TUI cannot configure a remote executor's sandbox. Required elevated sandbox setup also needs to reflect the local app server's readiness rather than the TUI's local setup files.

## What changed

- Restrict setup prompts and actions to local connections with local executors, including local daemon connections. Let remote servers own Agent permission selection, and warn when local and remote executors are configured together.
- Query `WindowsSandboxReadiness` at startup when elevated sandboxing is required locally, and track successful setup across chat widget replacement and reconnects.
- Restore pending initial input to the composer when mixed executors prevent required setup or a local connection goes offline.

## Testing

Add regression coverage for local, remote, and mixed host selection, remote Agent permission selection, pending input restoration with mixed executors, and setup state preservation during daemon reconnects.

GitOrigin-RevId: bd45b308ac3ae4c2489b0bd2ac5d7e12a7fc35d6
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-11 23:44:29 +00:00
1 parent 2e572378f4
commit c210f4c222
17 files changed
+278 -32

No files matched your search

+33 -3
View File
@@ -682,9 +682,39 @@ impl App {
AppServerTarget::LocalDaemon { .. }
));
let thread_and_widget_ms = thread_and_widget_started_at.elapsed().as_millis();
chat_widget
.maybe_prompt_windows_sandbox_enable(should_prompt_windows_sandbox_nux_at_startup);
let windows_sandbox_host =
windows_sandbox_host(&app_server_target, environment_manager.as_ref());
chat_widget.windows_sandbox_host = windows_sandbox_host;
let windows_sandbox_host_is_local = windows_sandbox_host == WindowsSandboxHost::Local;
#[cfg(target_os = "windows")]
let sandbox_ready =
if windows_sandbox_host_is_local && chat_widget.required_elevated_windows_sandbox() {
windows_sandbox_ready(&mut app_server).await
} else {
false
};
#[cfg(not(target_os = "windows"))]
let sandbox_ready = false;
#[cfg(target_os = "windows")]
if sandbox_ready {
chat_widget.windows_sandbox_elevated_setup_complete = true;
}
chat_widget.maybe_prompt_windows_sandbox_enable(
should_prompt_windows_sandbox_nux_at_startup
&& windows_sandbox_host_is_local
&& !sandbox_ready,
);
#[cfg(target_os = "windows")]
if windows_sandbox_host == WindowsSandboxHost::Mixed
&& should_prompt_windows_sandbox_nux_at_startup
{
app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
history_cell::StartupWarningsCell::new(vec![
"Windows sandbox setup is unavailable when local and remote executors are configured together."
.to_string(),
]),
)));
}
let file_search = FileSearchManager::new(config.cwd.to_path_buf(), app_event_tx.clone());
let runtime_keymap =
RuntimeKeymap::from_config(&local_settings.tui.keymap).map_err(|err| {