mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Remove TUI legacy Windows sandbox dependency (#27490)
## Why This is part of an ongoing attempt to eliminate the TUI's direct dependency on core features. When we moved the TUI to the app server, we left a `legacy_core` shim that re-exported some remaining core symbols for the TUI. The intent was to eventually remove all of these. In this PR, we remove the symbols related to the Windows sandbox. The change should be behavior-neutral and low risk because it's just refactoring and removal of code that is now effectively dead. When working on this PR, I noticed a big existing problem that affects mixed-platform remoting. For example, if you run the TUI on a Linux box and remote into a Windows box, the TUI logic doesn't properly handle Windows sandbox setup properly. Fixing this is beyond the scope of this PR, but I've left a TODO comment in place so we don't forget. ## What changed - Move the remaining TUI-specific sandbox level, setup, telemetry, and read-root helpers into `codex-tui`, calling `codex-windows-sandbox` directly. - Remove the Windows sandbox namespace and read-root grant re-exports from the client-side `legacy_core` facade. - Remove the dormant pre-elevation prompt fallback guarded by the permanently enabled `ELEVATED_SANDBOX_NUX_ENABLED` switch. The reachable elevated and non-elevated setup flows remain unchanged.
This commit is contained in:
1 parent
f42780109c
commit
1e5b87b4d7
13 files changed
+170
-123
No files matched your search
@@ -964,7 +964,7 @@ impl App {
|
||||
fn propagate_windows_sandbox_turn_context(&self) {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let windows_sandbox_level = WindowsSandboxLevel::from_config(&self.config);
|
||||
let windows_sandbox_level = crate::windows_sandbox::level_from_config(&self.config);
|
||||
self.app_event_tx
|
||||
.send(AppEvent::CodexOp(AppCommand::override_turn_context(
|
||||
/*cwd*/ None,
|
||||
|
||||
@@ -949,9 +949,7 @@ impl App {
|
||||
|
||||
// If the elevated setup already ran on this machine, don't prompt for
|
||||
// elevation again - just flip the config to use the elevated path.
|
||||
if crate::legacy_core::windows_sandbox::sandbox_setup_is_complete(
|
||||
codex_home.as_path(),
|
||||
) {
|
||||
if crate::windows_sandbox::sandbox_setup_is_complete(codex_home.as_path()) {
|
||||
tx.send(AppEvent::EnableWindowsSandboxForAgentMode {
|
||||
preset,
|
||||
mode: WindowsSandboxEnableMode::Elevated,
|
||||
@@ -964,7 +962,7 @@ impl App {
|
||||
self.windows_sandbox.setup_started_at = Some(Instant::now());
|
||||
let session_telemetry = self.session_telemetry.clone();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let result = crate::legacy_core::windows_sandbox::run_elevated_setup(
|
||||
let result = crate::windows_sandbox::run_elevated_setup(
|
||||
&permission_profile,
|
||||
workspace_roots.as_slice(),
|
||||
command_cwd.as_path(),
|
||||
@@ -988,9 +986,7 @@ impl App {
|
||||
let mut code_tag: Option<String> = None;
|
||||
let mut message_tag: Option<String> = None;
|
||||
if let Some((code, message)) =
|
||||
crate::legacy_core::windows_sandbox::elevated_setup_failure_details(
|
||||
&err,
|
||||
)
|
||||
crate::windows_sandbox::elevated_setup_failure_details(&err)
|
||||
{
|
||||
code_tag = Some(code);
|
||||
message_tag = Some(message);
|
||||
@@ -1003,7 +999,7 @@ impl App {
|
||||
tags.push(("message", message));
|
||||
}
|
||||
session_telemetry.counter(
|
||||
crate::legacy_core::windows_sandbox::elevated_setup_failure_metric_name(
|
||||
crate::windows_sandbox::elevated_setup_failure_metric_name(
|
||||
&err,
|
||||
),
|
||||
/*inc*/ 1,
|
||||
@@ -1074,12 +1070,12 @@ impl App {
|
||||
self.chat_widget.show_windows_sandbox_setup_status();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
if let Err(err) =
|
||||
crate::legacy_core::windows_sandbox::run_legacy_setup_preflight(
|
||||
codex_windows_sandbox::run_windows_sandbox_legacy_preflight(
|
||||
&permission_profile,
|
||||
workspace_roots.as_slice(),
|
||||
codex_home.as_path(),
|
||||
command_cwd.as_path(),
|
||||
&env_map,
|
||||
codex_home.as_path(),
|
||||
)
|
||||
{
|
||||
session_telemetry.counter(
|
||||
@@ -1123,7 +1119,7 @@ impl App {
|
||||
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let requested_path = PathBuf::from(path);
|
||||
let event = match crate::legacy_core::grant_read_root_non_elevated(
|
||||
let event = match crate::windows_sandbox::grant_read_root_non_elevated(
|
||||
&permission_profile,
|
||||
workspace_roots.as_slice(),
|
||||
command_cwd.as_path(),
|
||||
@@ -1219,7 +1215,7 @@ impl App {
|
||||
self.config.permissions.windows_sandbox_mode,
|
||||
);
|
||||
let windows_sandbox_level =
|
||||
WindowsSandboxLevel::from_config(&self.config);
|
||||
crate::windows_sandbox::level_from_config(&self.config);
|
||||
if let Some((sample_paths, extra_count, failed_scan)) =
|
||||
self.chat_widget.world_writable_warning_details()
|
||||
{
|
||||
@@ -1562,7 +1558,7 @@ impl App {
|
||||
return Ok(AppRunControl::Continue);
|
||||
}
|
||||
|
||||
let should_check = WindowsSandboxLevel::from_config(&self.config)
|
||||
let should_check = crate::windows_sandbox::level_from_config(&self.config)
|
||||
!= WindowsSandboxLevel::Disabled
|
||||
&& permission_profile_is_managed_restricted
|
||||
&& !self.chat_widget.world_writable_warning_hidden();
|
||||
|
||||
Reference in new issue
Block a user