mirror of
https://github.com/openai/codex.git
synced 2026-11-11 21:10:39 +00:00
## Why Windows sandbox setup diagnostics previously displayed only the outer error context, hiding native failure causes needed to diagnose ACL failures. ## What changed Preserve full error chains in ACL refresh summaries, setup logs, and sandbox binary directory lock failure reports. Include the requested access rights in ACL update open errors, and retain recorded ACL failures even when writing their log entries fails. ## Testing Add tests covering error chains for ACL checks, grants, and denies; preservation of accumulated failures when logging fails; and native directory-open errors surviving a structured setup report round trip on Windows. GitOrigin-RevId: 0a44a56b13d13b52b92ec673aaa2da7bc6cf0753
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
//! Preserve native ACL failure causes in both refresh summaries and setup logs.
|
|
//! Recording a diagnostic never changes whether a failed ACL operation is fatal.
|
|
|
|
use anyhow::Error;
|
|
use anyhow::Result;
|
|
use std::path::Path;
|
|
|
|
pub(crate) enum WriteAclOperation {
|
|
Check,
|
|
Grant,
|
|
Deny,
|
|
}
|
|
|
|
pub(crate) fn record_acl_failure(
|
|
errors: &mut Vec<String>,
|
|
operation: WriteAclOperation,
|
|
path: &Path,
|
|
error: &Error,
|
|
write_log: impl FnOnce(&str) -> Result<()>,
|
|
) -> Result<()> {
|
|
let detail = format!("{}: {error:#}", path.display());
|
|
let (summary, log) = match operation {
|
|
WriteAclOperation::Check => (
|
|
format!("write ACE check failed on {detail}"),
|
|
format!("write ACE check failed on {detail}; continuing"),
|
|
),
|
|
WriteAclOperation::Grant => (
|
|
format!("write ACE failed on {detail}"),
|
|
format!("write ACE grant failed on {detail}"),
|
|
),
|
|
WriteAclOperation::Deny => (
|
|
format!("deny ACE failed on {detail}"),
|
|
format!("deny ACE failed on {detail}"),
|
|
),
|
|
};
|
|
// Retain the ACL failure even if writing its individual log line fails.
|
|
errors.push(summary);
|
|
write_log(&log)
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "setup_acl_error_tests.rs"]
|
|
mod tests;
|