codex: document local skill path choices

This commit is contained in:
starr-openai
2026-05-28 22:09:44 -07:00
parent 929716f185
commit 6059a80c20
3 changed files with 16 additions and 0 deletions
+2
View File
@@ -563,6 +563,8 @@ async fn load_plugin(
.or_else(|| Some(manifest.name.clone()));
loaded_plugin.manifest_description = manifest.description.clone();
loaded_plugin.skill_roots = plugin_skill_roots(&plugin_root, manifest_paths);
// TODO: Support multi-env plugin skill loading. Plugin discovery is local-only today, so bind
// plugin skill reads to the local environment instead of the selected turn environment.
let resolved_skills = load_plugin_skills(
EnvironmentPathRef::local(plugin_root.clone()),
&loaded_plugin_id,
+2
View File
@@ -1419,6 +1419,8 @@ impl PluginsManager {
manifest.interface.clone(),
marketplace_category,
);
// TODO: Support multi-env plugin skill loading. Marketplace plugins are installed and
// scanned locally today, so bind plugin skill reads to the local environment.
let resolved_skills = load_plugin_skills(
codex_exec_server::EnvironmentPathRef::local(source_path.clone()),
&plugin_id,
+12
View File
@@ -236,6 +236,9 @@ pub(crate) async fn skill_roots(
plugin_skill_roots: Vec<PluginSkillRoot>,
extra_skill_roots: Vec<AbsolutePathBuf>,
) -> Vec<SkillRoot> {
// `env_path` owns workspace/repo-relative skill discovery for the selected environment.
// `local_file_system` owns client-local system/user/plugin roots and is absent when local exec
// is disabled, in which case those local roots intentionally do not load.
let home_dir =
home_dir().and_then(|path| AbsolutePathBuf::from_absolute_path_checked(path).ok());
skill_roots_with_home_dir(
@@ -257,6 +260,8 @@ async fn skill_roots_with_home_dir(
plugin_skill_roots: Vec<PluginSkillRoot>,
extra_skill_roots: Vec<AbsolutePathBuf>,
) -> Vec<SkillRoot> {
// Assemble one precedence-ordered root list from the two authorities above, then dedupe before
// any reads happen so downstream loading stays oblivious to local-vs-selected-env routing.
let mut roots = repo_config_skill_roots(env_path, config_layer_stack);
roots.extend(local_skill_roots(
local_file_system,
@@ -277,6 +282,9 @@ fn local_skill_roots(
plugin_skill_roots: Vec<PluginSkillRoot>,
extra_skill_roots: Vec<AbsolutePathBuf>,
) -> Vec<SkillRoot> {
// These roots are absolute paths on the client machine, not paths inside the selected
// workspace environment. Bind them to the available local exec filesystem so remote turns
// keep loading local installed/bundled/plugin skills without reading those paths remotely.
let Some(local_file_system) = local_file_system else {
// Local exec can be disabled. In that case, keep repo/env skill loading intact but skip
// local absolute roots instead of falling back to the process-global local filesystem.
@@ -366,6 +374,8 @@ fn repo_config_skill_roots(
env_path: &EnvironmentPathRef,
config_layer_stack: &ConfigLayerStack,
) -> Vec<SkillRoot> {
// Project config layers describe workspace-local skill directories. Their absolute paths only
// make sense inside the selected environment, so keep them bound to `env_path`.
config_layer_stack
.get_layers(
ConfigLayerStackOrdering::HighestPrecedenceFirst,
@@ -397,6 +407,8 @@ async fn repo_agents_skill_roots(
env_path: &EnvironmentPathRef,
config_layer_stack: &ConfigLayerStack,
) -> Vec<SkillRoot> {
// Discover repo `.agents/skills` folders by walking from the selected environment's project
// root to its cwd; this must never consult the local filesystem for remote workspaces.
let project_root_markers = project_root_markers_from_stack(config_layer_stack);
let project_root = find_project_root(env_path, &project_root_markers).await;
let dirs = dirs_between_project_root_and_cwd(env_path.path(), project_root.path());