From 43b3b9d8bf59ca2d009137bb0bd3165c91a924fb Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Sat, 30 May 2026 20:37:52 -0300 Subject: [PATCH] fix(tui): sync runtime workspace settings --- codex-rs/tui/src/app/tests.rs | 12 +++++++++++- codex-rs/tui/src/app/thread_settings.rs | 5 ++++- codex-rs/tui/src/bottom_pane/approval_overlay.rs | 3 ++- ...verlay_workspace_mutation_permissions_prompt.snap | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rs index 403e44397a..74e08bbe17 100644 --- a/codex-rs/tui/src/app/tests.rs +++ b/codex-rs/tui/src/app/tests.rs @@ -5865,7 +5865,10 @@ async fn inactive_thread_settings_notification_updates_cached_collaboration_mode thread_id: inactive_thread_id.to_string(), thread_settings: ThreadSettings { cwd: test_absolute_path("/tmp/thread-settings"), - runtime_workspace_roots: vec![test_absolute_path("/tmp/thread-settings")], + runtime_workspace_roots: vec![ + test_absolute_path("/tmp/thread-settings"), + test_absolute_path("/tmp/thread-settings-shared"), + ], approval_policy: AskForApproval::OnRequest, approvals_reviewer: codex_app_server_protocol::ApprovalsReviewer::AutoReview, sandbox_policy: codex_app_server_protocol::SandboxPolicy::ReadOnly { @@ -5902,6 +5905,13 @@ async fn inactive_thread_settings_notification_updates_cached_collaboration_mode .expect("inactive session should remain cached"); assert_eq!(cached_session.model, "gpt-test"); assert_eq!(cached_session.personality, Some(Personality::Pragmatic)); + assert_eq!( + cached_session.runtime_workspace_roots, + vec![ + test_absolute_path("/tmp/thread-settings"), + test_absolute_path("/tmp/thread-settings-shared"), + ] + ); assert_eq!( cached_session.collaboration_mode.as_deref(), Some(&collaboration_mode) diff --git a/codex-rs/tui/src/app/thread_settings.rs b/codex-rs/tui/src/app/thread_settings.rs index 84dcebe1a8..4e0f31d5bb 100644 --- a/codex-rs/tui/src/app/thread_settings.rs +++ b/codex-rs/tui/src/app/thread_settings.rs @@ -183,7 +183,10 @@ fn apply_thread_settings_to_session(session: &mut ThreadSessionState, settings: settings.cwd.as_path(), ); session.active_permission_profile = settings.active_permission_profile.clone().map(Into::into); - session.set_cwd_retargeting_implicit_runtime_workspace_root(settings.cwd.clone()); + session.cwd.clone_from(&settings.cwd); + session + .runtime_workspace_roots + .clone_from(&settings.runtime_workspace_roots); session.personality = settings.personality; let mut collaboration_mode = settings.collaboration_mode.clone(); collaboration_mode diff --git a/codex-rs/tui/src/bottom_pane/approval_overlay.rs b/codex-rs/tui/src/bottom_pane/approval_overlay.rs index d04250092c..66266479a8 100644 --- a/codex-rs/tui/src/bottom_pane/approval_overlay.rs +++ b/codex-rs/tui/src/bottom_pane/approval_overlay.rs @@ -763,7 +763,8 @@ fn build_header(request: &ApprovalRequest) -> Box { ])); header.push(Line::from("")); header.push( - "This grants write access to the directory for the rest of the session.".into(), + "This updates the session workspace and may grant additional filesystem access." + .into(), ); header.push(Line::from("")); } else if let Some(reason) = reason { diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_workspace_mutation_permissions_prompt.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_workspace_mutation_permissions_prompt.snap index 6353136790..45695402fc 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_workspace_mutation_permissions_prompt.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_workspace_mutation_permissions_prompt.snap @@ -7,7 +7,7 @@ expression: "normalize_snapshot_paths(render_overlay_lines(&view, 120))" Directory: /tmp/out.txt - This grants write access to the directory for the rest of the session. + This updates the session workspace and may grant additional filesystem access. Permission rule: network; read `/tmp/readme.txt`; write `/tmp/out.txt`