mirror of
https://github.com/openai/codex.git
synced 2026-05-29 15:30:22 +00:00
Tighten environment path naming
This commit is contained in:
@@ -1073,14 +1073,14 @@ pub(crate) async fn skill_roots_from_layer_stack(
|
||||
cwd: &AbsolutePathBuf,
|
||||
home_dir: Option<&AbsolutePathBuf>,
|
||||
) -> Vec<SkillRoot> {
|
||||
let path_ref = EnvironmentPathRef::new(
|
||||
let cwd_path = EnvironmentPathRef::new(
|
||||
codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
fs,
|
||||
cwd.clone(),
|
||||
);
|
||||
skill_roots_with_home_dir(
|
||||
Some(&path_ref),
|
||||
Some(&path_ref),
|
||||
Some(&cwd_path),
|
||||
Some(&cwd_path),
|
||||
config_layer_stack,
|
||||
home_dir,
|
||||
Vec::new(),
|
||||
|
||||
@@ -145,7 +145,7 @@ fn normalized(path: &Path) -> AbsolutePathBuf {
|
||||
.abs()
|
||||
}
|
||||
|
||||
fn env_path_ref(path: AbsolutePathBuf) -> EnvironmentPathRef {
|
||||
fn env_path(path: AbsolutePathBuf) -> EnvironmentPathRef {
|
||||
EnvironmentPathRef::new(
|
||||
LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
Arc::clone(&LOCAL_FS),
|
||||
@@ -155,7 +155,7 @@ fn env_path_ref(path: AbsolutePathBuf) -> EnvironmentPathRef {
|
||||
|
||||
fn local_skill_root(path: AbsolutePathBuf, scope: SkillScope) -> SkillRoot {
|
||||
SkillRoot {
|
||||
path: env_path_ref(path),
|
||||
path: env_path(path),
|
||||
scope,
|
||||
plugin_id: None,
|
||||
plugin_root: None,
|
||||
@@ -864,10 +864,10 @@ interface:
|
||||
|
||||
let plugin_root_abs = plugin_root.abs();
|
||||
let outcome = load_skills_from_roots([SkillRoot {
|
||||
path: env_path_ref(plugin_root.join("skills").abs()),
|
||||
path: env_path(plugin_root.join("skills").abs()),
|
||||
scope: SkillScope::User,
|
||||
plugin_id: Some("twilio-developer-kit@test".to_string()),
|
||||
plugin_root: Some(env_path_ref(plugin_root_abs.clone())),
|
||||
plugin_root: Some(env_path(plugin_root_abs.clone())),
|
||||
}])
|
||||
.await;
|
||||
|
||||
@@ -920,10 +920,10 @@ interface:
|
||||
);
|
||||
|
||||
let outcome = load_skills_from_roots([SkillRoot {
|
||||
path: env_path_ref(plugin_root.join("skills").abs()),
|
||||
path: env_path(plugin_root.join("skills").abs()),
|
||||
scope: SkillScope::User,
|
||||
plugin_id: Some("twilio-developer-kit@test".to_string()),
|
||||
plugin_root: Some(env_path_ref(plugin_root.abs())),
|
||||
plugin_root: Some(env_path(plugin_root.abs())),
|
||||
}])
|
||||
.await;
|
||||
|
||||
@@ -1271,10 +1271,10 @@ async fn namespaces_plugin_skills_using_plugin_name() {
|
||||
.unwrap();
|
||||
|
||||
let outcome = load_skills_from_roots([SkillRoot {
|
||||
path: env_path_ref(plugin_root.join("skills").abs()),
|
||||
path: env_path(plugin_root.join("skills").abs()),
|
||||
scope: SkillScope::User,
|
||||
plugin_id: Some("sample@test".to_string()),
|
||||
plugin_root: Some(env_path_ref(plugin_root.abs())),
|
||||
plugin_root: Some(env_path(plugin_root.abs())),
|
||||
}])
|
||||
.await;
|
||||
|
||||
@@ -1593,13 +1593,13 @@ async fn deduplicates_by_path_preferring_first_root() {
|
||||
|
||||
let outcome = load_skills_from_roots([
|
||||
SkillRoot {
|
||||
path: env_path_ref(root.path().abs()),
|
||||
path: env_path(root.path().abs()),
|
||||
scope: SkillScope::Repo,
|
||||
plugin_id: None,
|
||||
plugin_root: None,
|
||||
},
|
||||
SkillRoot {
|
||||
path: env_path_ref(root.path().abs()),
|
||||
path: env_path(root.path().abs()),
|
||||
scope: SkillScope::User,
|
||||
plugin_id: None,
|
||||
plugin_root: None,
|
||||
@@ -1891,10 +1891,10 @@ async fn skill_roots_include_admin_with_lowest_priority() {
|
||||
let codex_home = tempfile::tempdir().expect("tempdir");
|
||||
let cfg = make_config(&codex_home).await;
|
||||
|
||||
let path_ref = env_path_ref(cfg.cwd.clone());
|
||||
let cwd = env_path(cfg.cwd.clone());
|
||||
let scopes: Vec<SkillScope> = super::skill_roots(
|
||||
Some(&path_ref),
|
||||
Some(&path_ref),
|
||||
Some(&cwd),
|
||||
Some(&cwd),
|
||||
&cfg.config_layer_stack,
|
||||
Vec::new(),
|
||||
)
|
||||
@@ -1911,13 +1911,13 @@ async fn skill_roots_include_admin_with_lowest_priority() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn skill_roots_skip_local_roots_without_local_env_path_ref() {
|
||||
async fn skill_roots_skip_local_roots_without_local_root_path() {
|
||||
let codex_home = tempfile::tempdir().expect("tempdir");
|
||||
let cfg = make_config(&codex_home).await;
|
||||
|
||||
let local_env_path_ref = env_path_ref(cfg.cwd.clone());
|
||||
let env_cwd = env_path(cfg.cwd.clone());
|
||||
let scopes: Vec<SkillScope> = super::skill_roots(
|
||||
Some(&local_env_path_ref),
|
||||
Some(&env_cwd),
|
||||
/*root_path_ref*/ None,
|
||||
&cfg.config_layer_stack,
|
||||
Vec::new(),
|
||||
|
||||
@@ -421,15 +421,15 @@ enabled = false
|
||||
let plugins_input = config.plugins_config_input();
|
||||
let plugin_outcome = plugins_manager.plugins_for_config(&plugins_input).await;
|
||||
let effective_skill_roots = plugin_outcome.effective_plugin_skill_roots();
|
||||
let path_ref = crate::environment_path_ref(
|
||||
let cwd = crate::environment_path(
|
||||
codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
Arc::clone(&codex_exec_server::LOCAL_FS),
|
||||
config.cwd.clone(),
|
||||
);
|
||||
let skills_input = skills_load_input_from_config(
|
||||
&config,
|
||||
Some(path_ref.clone()),
|
||||
Some(path_ref),
|
||||
Some(cwd.clone()),
|
||||
Some(cwd),
|
||||
effective_skill_roots,
|
||||
);
|
||||
let outcome = skills_manager.skills_for_config(&skills_input).await;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::input_queue::InputQueue;
|
||||
use super::*;
|
||||
use crate::config::ConstraintError;
|
||||
use crate::environment_path_ref;
|
||||
use crate::environment_path;
|
||||
use crate::goals::GoalRuntimeState;
|
||||
use crate::skills::SkillError;
|
||||
use crate::state::ActiveTurn;
|
||||
@@ -457,7 +457,7 @@ async fn warm_plugins_and_skills_for_session_init(
|
||||
.as_ref()
|
||||
.and_then(crate::environment_selection::ResolvedTurnEnvironments::primary)
|
||||
.map(|environment| {
|
||||
environment_path_ref(
|
||||
environment_path(
|
||||
environment.environment_id.clone(),
|
||||
environment.environment.get_filesystem(),
|
||||
environment.cwd.clone(),
|
||||
|
||||
@@ -4120,12 +4120,12 @@ async fn new_default_turn_uses_config_aware_skills_for_role_overrides() {
|
||||
.skills_for_cwd(
|
||||
&crate::skills_load_input_from_config(
|
||||
&parent_config,
|
||||
Some(crate::environment_path_ref(
|
||||
Some(crate::environment_path(
|
||||
codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
Arc::clone(&skill_fs),
|
||||
parent_config.cwd.clone(),
|
||||
)),
|
||||
Some(crate::environment_path_ref(
|
||||
Some(crate::environment_path(
|
||||
codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
Arc::clone(&skill_fs),
|
||||
parent_config.cwd.clone(),
|
||||
@@ -4695,15 +4695,15 @@ pub(crate) async fn make_session_and_context() -> (Session, TurnContext) {
|
||||
.plugins_for_config(&per_turn_config.plugins_config_input())
|
||||
.await;
|
||||
let effective_skill_roots = plugin_outcome.effective_plugin_skill_roots();
|
||||
let path_ref = crate::environment_path_ref(
|
||||
let cwd = crate::environment_path(
|
||||
codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
environment.get_filesystem(),
|
||||
per_turn_config.cwd.clone(),
|
||||
);
|
||||
let skills_input = crate::skills_load_input_from_config(
|
||||
&per_turn_config,
|
||||
Some(path_ref.clone()),
|
||||
Some(path_ref),
|
||||
Some(cwd.clone()),
|
||||
Some(cwd),
|
||||
effective_skill_roots,
|
||||
);
|
||||
let skills_outcome = Arc::new(
|
||||
@@ -6538,15 +6538,15 @@ where
|
||||
.plugins_for_config(&per_turn_config.plugins_config_input())
|
||||
.await;
|
||||
let effective_skill_roots = plugin_outcome.effective_plugin_skill_roots();
|
||||
let path_ref = crate::environment_path_ref(
|
||||
let cwd = crate::environment_path(
|
||||
codex_exec_server::LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
environment.get_filesystem(),
|
||||
per_turn_config.cwd.clone(),
|
||||
);
|
||||
let skills_input = crate::skills_load_input_from_config(
|
||||
&per_turn_config,
|
||||
Some(path_ref.clone()),
|
||||
Some(path_ref),
|
||||
Some(cwd.clone()),
|
||||
Some(cwd),
|
||||
effective_skill_roots,
|
||||
);
|
||||
let skills_outcome = Arc::new(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
use crate::SkillLoadOutcome;
|
||||
use crate::config::GhostSnapshotConfig;
|
||||
use crate::environment_path_ref;
|
||||
use crate::environment_path;
|
||||
use crate::environment_selection::ResolvedTurnEnvironments;
|
||||
use codex_model_provider::SharedModelProvider;
|
||||
use codex_model_provider::create_model_provider;
|
||||
@@ -678,7 +678,7 @@ impl Session {
|
||||
)
|
||||
.await;
|
||||
let cwd = primary_turn_environment.map(|turn_environment| {
|
||||
environment_path_ref(
|
||||
environment_path(
|
||||
turn_environment.environment_id.clone(),
|
||||
turn_environment.environment.get_filesystem(),
|
||||
turn_environment.cwd.clone(),
|
||||
|
||||
@@ -51,7 +51,7 @@ pub(crate) fn skills_load_input_from_config(
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn environment_path_ref(
|
||||
pub(crate) fn environment_path(
|
||||
environment_id: String,
|
||||
file_system: Arc<dyn ExecutorFileSystem>,
|
||||
path: AbsolutePathBuf,
|
||||
|
||||
Reference in New Issue
Block a user