mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Apply permission profile updates to future turn environments (#37031)
## What changed - Include the current permission profile in each turn environment's configuration. - Refresh retained environment configurations when session settings change, while preserving the configuration already captured by active turns. - Keep environment connection and shell snapshot resolution reusable across configuration updates. ## Testing - Cover permission profile updates applied through both session settings updates and per-turn updates. - Verify that pending environment resolutions use the configuration captured by their turn and that configuration-only updates do not retry failed environments. GitOrigin-RevId: 923694f0729b87a118d7635ade3a8ca9bcd4e7b1
This commit is contained in:
@@ -7,7 +7,6 @@ use std::time::SystemTime;
|
||||
|
||||
use crate::StateDbHandle;
|
||||
use crate::rollout::list::find_thread_path_by_id_str;
|
||||
use crate::session::turn_context::TurnEnvironment;
|
||||
use crate::shell::Shell;
|
||||
use crate::shell::ShellType;
|
||||
use crate::shell::get_shell;
|
||||
@@ -15,9 +14,11 @@ use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use anyhow::bail;
|
||||
use codex_exec_server::Environment;
|
||||
use codex_otel::SessionTelemetry;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use tokio::fs;
|
||||
use tokio::process::Command;
|
||||
use tokio::time::timeout;
|
||||
@@ -68,17 +69,19 @@ impl ShellSnapshot {
|
||||
|
||||
pub(crate) async fn build(
|
||||
self,
|
||||
environment: TurnEnvironment,
|
||||
environment: Arc<Environment>,
|
||||
cwd: PathUri,
|
||||
shell: Option<Shell>,
|
||||
) -> Option<Arc<ShellSnapshotFile>> {
|
||||
let config = self.config.as_ref()?;
|
||||
if environment.environment.is_remote() {
|
||||
if environment.is_remote() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let shell = environment.shell.clone()?;
|
||||
let shell = shell?;
|
||||
// TODO(anp): Migrate shell snapshot creation to accept PathUri and defer native
|
||||
// conversion to the spawned shell process.
|
||||
let cwd = environment.cwd().to_abs_path().ok()?;
|
||||
let cwd = cwd.to_abs_path().ok()?;
|
||||
Self::build_for_cwd(Arc::clone(config), cwd, shell).await
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user