mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
Restore cwd fallback for thread environment overrides
This commit is contained in:
@@ -418,7 +418,6 @@ impl TurnRequestProcessor {
|
||||
})?;
|
||||
|
||||
let environment_selections = self.parse_environment_selections(params.environments)?;
|
||||
let cwd = resolve_request_cwd(params.cwd)?;
|
||||
|
||||
// Map v2 input items to core input items.
|
||||
let mapped_items: Vec<CoreInputItem> = params
|
||||
|
||||
@@ -384,6 +384,10 @@ impl CodexThread {
|
||||
collaboration_mode,
|
||||
personality,
|
||||
} = overrides;
|
||||
let environments = self
|
||||
.codex
|
||||
.session
|
||||
.thread_settings_environments_update(&cwd, environments);
|
||||
let collaboration_mode = if let Some(collaboration_mode) = collaboration_mode {
|
||||
collaboration_mode
|
||||
} else {
|
||||
|
||||
@@ -139,6 +139,7 @@ async fn thread_settings_update(
|
||||
collaboration_mode,
|
||||
personality,
|
||||
} = thread_settings;
|
||||
let environments = sess.thread_settings_environments_update(&cwd, environments);
|
||||
let state = sess.state.lock().await;
|
||||
let collaboration_mode = match collaboration_mode {
|
||||
Some(collaboration_mode) => collaboration_mode,
|
||||
|
||||
@@ -458,6 +458,21 @@ async fn warm_plugins_and_skills_for_session_init(
|
||||
}
|
||||
|
||||
impl Session {
|
||||
pub(crate) fn thread_settings_environments_update(
|
||||
&self,
|
||||
cwd: &Option<AbsolutePathBuf>,
|
||||
environments: Option<Vec<TurnEnvironmentSelection>>,
|
||||
) -> Option<Vec<TurnEnvironmentSelection>> {
|
||||
environments.or_else(|| {
|
||||
cwd.as_ref().map(|cwd| {
|
||||
crate::environment_selection::default_thread_environment_selections(
|
||||
self.services.environment_manager.as_ref(),
|
||||
cwd,
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the concrete identity for this thread.
|
||||
pub(crate) fn thread_id(&self) -> ThreadId {
|
||||
self.thread_id
|
||||
|
||||
@@ -595,6 +595,7 @@ impl Session {
|
||||
let mut state = self.state.lock().await;
|
||||
match state.session_configuration.clone().apply(&updates) {
|
||||
Ok(next) => {
|
||||
self.resolve_turn_environments(&next.environments)?;
|
||||
let previous_cwd = state.session_configuration.cwd.clone();
|
||||
let previous_permission_profile =
|
||||
state.session_configuration.permission_profile();
|
||||
|
||||
Reference in New Issue
Block a user