Check folder consent before creating or resuming TUI tasks (#44755)

## What changed

- Check directory trust when dispatching tasks from Agent Command Center, resuming sessions, and opening loaded tasks.
- Return connected users to Agent Command Center when they cancel folder consent. Clear launch prompts and images on startup cancellation, and restore the composer draft when task dispatch is canceled.
- Reload local configuration after saving folder trust and review startup hooks before creating a new task.
- Label connected consent screens with “Back to Agent Command Center”; retain quit behavior for embedded sessions.

## Testing

Add a terminal integration test covering unknown and untrusted folders, server-authoritative trust, cancellation and retry, resumed tasks with changed directories, and hook review before task creation. Update consent-screen snapshots.

GitOrigin-RevId: db88d2113fd47bc4c57369cc20ebf3042e6fb7ab
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-11 07:13:19 +00:00
1 parent b9934480bf
commit 02a8f038b8
20 files changed
+544 -42

No files matched your search

+31 -3
View File
@@ -406,7 +406,7 @@ impl App {
target_thread.status,
codex_app_server_protocol::ThreadStatus::NotLoaded
);
let (mut resume_config, local_settings) = if unloaded {
let (mut resume_config, mut local_settings) = if unloaded {
let target_session = SessionTarget {
path: target_thread.path.clone(),
thread_id: root_thread_id,
@@ -440,8 +440,20 @@ impl App {
}
}
};
if unloaded && self.reject_remote_resume_permission_override(&resume_config) {
return Ok(AppRunControl::Continue);
if !unloaded {
if let Err(control) = self
.confirm_directory_trust(
tui,
app_server,
&mut resume_config,
target_thread.cwd.as_path(),
Some(&target_thread),
)
.await
{
return Ok(control);
}
local_settings = crate::local_settings::LocalSettings::from(&resume_config);
}
let baseline_approval = resume_config.permissions.approval_policy.value();
let baseline_permissions =
@@ -660,6 +672,7 @@ impl App {
pub(super) async fn dispatch_agents_overview_task(
&mut self,
tui: &mut tui::Tui,
app_server: &mut AppServerSession,
prompt: UserMessage,
cwd: Option<AbsolutePathBuf>,
@@ -687,6 +700,21 @@ impl App {
},
None => self.fresh_session_config(),
};
let trust_cwd = config.cwd.to_path_buf();
if self
.confirm_directory_trust(
tui,
app_server,
&mut config,
&trust_cwd,
/*resumed_thread*/ None,
)
.await
.is_err()
{
self.restore_agents_overview_prompt(prompt);
return;
}
if let Some(profile) = self.runtime_permission_profile_override.as_ref()
&& profile.active_permission_profile.is_some()
&& (!profile.matches_config(&config)