mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Report configured sandbox policy consistently (#41933)
## Why Sandbox diagnostics could report `read-only` when a configured writable root did not yet exist, because policy labeling used filesystem-aware runtime root resolution. ## What changed - Derive diagnostic policy labels from configured writable roots without inspecting the filesystem. Runtime sandbox authorization continues to use filesystem-aware resolution. - Capture sandbox labels once per turn and reuse them for response metadata and tool-result metrics. ## Testing Add coverage for missing project roots, denied roots, and deny rules on project subpaths. GitOrigin-RevId: ccbdb8c32a1f44bfa63ae4d2ae1f9cc408e66b9c
This commit is contained in:
1 parent
4ac20a7f74
commit
a62ff9a5d4
6 files changed
+146
-61
No files matched your search
@@ -20,7 +20,6 @@ use crate::responses_metadata::TurnToolSource;
|
||||
use crate::responses_metadata::WINDOW_ID_KEY;
|
||||
use crate::responses_metadata::WINDOW_NUMBER_KEY;
|
||||
use crate::responses_metadata::validate_extra_metadata;
|
||||
use crate::sandbox_tags::permission_profile_sandbox_tag;
|
||||
use codex_analytics::CompactionImplementation;
|
||||
use codex_analytics::CompactionPhase;
|
||||
use codex_analytics::CompactionReason;
|
||||
@@ -32,6 +31,8 @@ use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::SubAgentSource;
|
||||
use codex_protocol::protocol::ThreadSource;
|
||||
use codex_sandboxing::SandboxType;
|
||||
use codex_sandboxing::get_platform_sandbox;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use core_test_support::PathBufExt;
|
||||
use core_test_support::PathExt;
|
||||
@@ -249,11 +250,9 @@ fn turn_metadata_state_includes_sandbox_metadata() {
|
||||
let thread_id = json.get("thread_id").and_then(Value::as_str);
|
||||
|
||||
assert!(json.get("request_kind").is_none());
|
||||
let expected_sandbox = permission_profile_sandbox_tag(
|
||||
&permission_profile,
|
||||
WindowsSandboxLevel::Disabled,
|
||||
/*enforce_managed_network*/ false,
|
||||
);
|
||||
let expected_sandbox = get_platform_sandbox(/*windows_sandbox_enabled*/ false)
|
||||
.map(SandboxType::as_metric_tag)
|
||||
.unwrap_or("none");
|
||||
assert_eq!(sandbox_name, Some(expected_sandbox));
|
||||
assert_eq!(sandbox_mode, Some("read-only"));
|
||||
assert_eq!(auto_review_enabled, Some(true));
|
||||
|
||||
Reference in new issue
Block a user