mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Track Windows sandbox policy and per-thread executor hosts in the TUI (#45813)
## What changed - Add `WindowsSandboxConfig` helpers to read app-server configuration and managed requirements, preserve legacy feature flag fallbacks, and select an allowed setup mode with elevated mode preferred when the configured mode is disallowed. - Store the sandbox host classification in thread session state using reported environments across start, resume, fork, and replay paths. Classify missing or empty environments as `Unknown`, and distinguish local, remote, and mixed selections. ## Testing Add coverage for managed setup restrictions, legacy configuration precedence, unknown policy state, environment classification, and remote host state in inactive-thread replay. GitOrigin-RevId: ae8920d9c2a1c80b641ac90617ae607b171bd55a
This commit is contained in:
1 parent
58e2e8cf3c
commit
7f501cd334
22 files changed
+336
-3
No files matched your search
@@ -4403,6 +4403,7 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
|
||||
let primary_cwd = test_path_buf("/tmp/main").abs();
|
||||
let shared_root = test_path_buf("/tmp/shared").abs();
|
||||
let primary_session = ThreadSessionState {
|
||||
windows_sandbox_host: WindowsSandboxHost::Local,
|
||||
approval_policy: AskForApproval::OnRequest,
|
||||
permission_profile: PermissionProfile::workspace_write(),
|
||||
runtime_workspace_roots: vec![primary_cwd.clone(), shared_root.clone()],
|
||||
@@ -4427,7 +4428,11 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
|
||||
ServerNotification::ThreadStarted(ThreadStartedNotification {
|
||||
thread: Thread {
|
||||
originator: None,
|
||||
environments: None,
|
||||
environments: Some(vec![codex_app_server_protocol::ThreadEnvironment {
|
||||
environment_id: "remote".to_string(),
|
||||
cwd: test_path_buf("/tmp/agent").abs().into(),
|
||||
runtime_workspace_roots: Vec::new(),
|
||||
}]),
|
||||
id: agent_thread_id.to_string(),
|
||||
extra: None,
|
||||
session_id: agent_thread_id.to_string(),
|
||||
@@ -4474,6 +4479,7 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
|
||||
drop(store);
|
||||
|
||||
assert_eq!(session.thread_id, agent_thread_id);
|
||||
assert_eq!(session.windows_sandbox_host, WindowsSandboxHost::Remote);
|
||||
assert_eq!(session.thread_name, Some("agent thread".to_string()));
|
||||
assert_eq!(session.model, "gpt-agent");
|
||||
assert_eq!(session.model_provider_id, "agent-provider");
|
||||
@@ -5083,6 +5089,7 @@ async fn side_thread_snapshot_hides_forked_parent_transcript() {
|
||||
let side_thread_id = ThreadId::new();
|
||||
let mut store = ThreadEventStore::new(/*capacity*/ 4);
|
||||
let session = ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
forked_from_id: Some(parent_thread_id),
|
||||
fork_parent_title: None,
|
||||
..test_thread_session(side_thread_id, test_path_buf("/tmp/side"))
|
||||
@@ -5150,6 +5157,7 @@ async fn side_thread_snapshot_skips_session_header_preamble() {
|
||||
let snapshot = ThreadEventSnapshot {
|
||||
delegated_turns: Vec::new(),
|
||||
session: Some(ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
forked_from_id: Some(parent_thread_id),
|
||||
fork_parent_title: None,
|
||||
..test_thread_session(side_thread_id, test_path_buf("/tmp/side"))
|
||||
@@ -5731,6 +5739,7 @@ async fn render_clear_ui_header_after_long_transcript_for_snapshot() -> String {
|
||||
};
|
||||
let make_header = |is_first| -> Arc<dyn HistoryCell> {
|
||||
let session = ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
thread_id: ThreadId::new(),
|
||||
forked_from_id: None,
|
||||
fork_parent_title: None,
|
||||
@@ -6277,6 +6286,7 @@ async fn replace_goal_confirmation_snapshot() {
|
||||
|
||||
fn test_thread_session(thread_id: ThreadId, cwd: PathBuf) -> ThreadSessionState {
|
||||
ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
thread_id,
|
||||
forked_from_id: None,
|
||||
fork_parent_title: None,
|
||||
@@ -7314,6 +7324,7 @@ async fn backtrack_selection_preserves_selected_prompt_and_requests_branch() {
|
||||
|
||||
let make_header = |is_first| {
|
||||
let session = ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
thread_id: ThreadId::new(),
|
||||
forked_from_id: None,
|
||||
fork_parent_title: None,
|
||||
@@ -7386,6 +7397,7 @@ async fn backtrack_selection_preserves_selected_prompt_and_requests_branch() {
|
||||
let base_id = ThreadId::new();
|
||||
app.chat_widget
|
||||
.handle_thread_session(crate::session_state::ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
thread_id: base_id,
|
||||
forked_from_id: None,
|
||||
fork_parent_title: None,
|
||||
@@ -8545,6 +8557,7 @@ async fn new_session_requests_shutdown_for_previous_conversation() {
|
||||
|
||||
let thread_id = ThreadId::new();
|
||||
let event = crate::session_state::ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
thread_id,
|
||||
forked_from_id: None,
|
||||
fork_parent_title: None,
|
||||
@@ -9279,6 +9292,7 @@ async fn clear_only_ui_reset_preserves_chat_session_state() {
|
||||
let thread_id = ThreadId::new();
|
||||
app.chat_widget
|
||||
.handle_thread_session(crate::session_state::ThreadSessionState {
|
||||
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
|
||||
thread_id,
|
||||
forked_from_id: None,
|
||||
fork_parent_title: None,
|
||||
|
||||
Reference in new issue
Block a user