Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions codex-rs/core/src/context_manager/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ use std::collections::HashSet;
use codex_protocol::models::FunctionCallOutputPayload;
use codex_protocol::models::ResponseItem;


use tracing::error;

use crate::util::error_or_panic;

pub(crate) fn ensure_call_outputs_present(items: &mut Vec<ResponseItem>) {
Expand All @@ -22,9 +25,7 @@ pub(crate) fn ensure_call_outputs_present(items: &mut Vec<ResponseItem>) {
});

if !has_output {
error_or_panic(format!(
"Function call output is missing for call id: {call_id}"
));
error!("Function call output is missing for call id: {call_id}");
missing_outputs_to_insert.push((
idx,
ResponseItem::FunctionCallOutput {
Expand All @@ -46,9 +47,7 @@ pub(crate) fn ensure_call_outputs_present(items: &mut Vec<ResponseItem>) {
});

if !has_output {
error_or_panic(format!(
"Custom tool call output is missing for call id: {call_id}"
));
error!("Custom tool call output is missing for call id: {call_id}");
missing_outputs_to_insert.push((
idx,
ResponseItem::CustomToolCallOutput {
Expand All @@ -69,9 +68,7 @@ pub(crate) fn ensure_call_outputs_present(items: &mut Vec<ResponseItem>) {
});

if !has_output {
error_or_panic(format!(
"Local shell call output is missing for call id: {call_id}"
));
error!("Local shell call output is missing for call id: {call_id}");
missing_outputs_to_insert.push((
idx,
ResponseItem::FunctionCallOutput {
Expand Down
66 changes: 55 additions & 11 deletions codex-rs/windows-sandbox-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ mod windows_impl {
use super::winutil::format_last_error;
use super::winutil::quote_windows_arg;
use super::winutil::to_wide;
use anyhow::Context;
use anyhow::Result;
use std::collections::HashMap;
use std::ffi::c_void;
Expand Down Expand Up @@ -241,26 +242,69 @@ mod windows_impl {
compute_allow_paths(&policy, sandbox_policy_cwd, &current_dir, &env_map);
let mut guards: Vec<(PathBuf, *mut c_void)> = Vec::new();
unsafe {
let mut ace_setup_error = None;
for p in &allow {
if let Ok(added) = add_allow_ace(p, psid_to_use) {
if added {
if persist_aces {
if p.is_dir() {
// best-effort seeding omitted intentionally
match add_allow_ace(p, psid_to_use) {
Ok(added) => {
if added {
if persist_aces {
if p.is_dir() {
// best-effort seeding omitted intentionally
}
} else {
guards.push((p.clone(), psid_to_use));
}
} else {
guards.push((p.clone(), psid_to_use));
}
}
Err(e) => {
log_failure(
&command,
&format!("failed to grant allow ACE on {}: {}", p.display(), e),
logs_base_dir,
);
ace_setup_error = Some(e.context(format!(
"failed to grant allow ACE on {}",
p.display()
)));
break;
}
}
}
for p in &deny {
if let Ok(added) = add_deny_write_ace(p, psid_to_use) {
if added && !persist_aces {
guards.push((p.clone(), psid_to_use));

if ace_setup_error.is_none() {
for p in &deny {
match add_deny_write_ace(p, psid_to_use) {
Ok(added) => {
if added && !persist_aces {
guards.push((p.clone(), psid_to_use));
}
}
Err(e) => {
log_failure(
&command,
&format!("failed to add deny ACE on {}: {}", p.display(), e),
logs_base_dir,
);
ace_setup_error = Some(e.context(format!(
"failed to add deny ACE on {}",
p.display()
)));
break;
}
}
}
}

if let Some(err) = ace_setup_error {
if !persist_aces {
for (p, sid) in guards {
revoke_ace(&p, sid);
}
}
CloseHandle(h_token);
return Err(err);
}

allow_null_device(psid_to_use);
}

Expand Down
Loading