Files
codex/codex-rs/ext/skills/src/lib.rs
T
Dmitriy Kovalenko 0b21a5b526 Respect filesystem permissions when discovering repository skills (#59280)
## Why

Repository skill discovery must reflect current filesystem access, including newly approved grants and narrower permissions. Previously listed skills can remain in conversation history after a turn-scoped grant expires, so catalog updates need to tell the model when availability changes.

## What changed

- Discover repository skills through the selected executor's permission-aware filesystem accessor and refresh snapshots when the working directory or access changes. Use the current step's snapshot for skill selection and invocation.
- Preserve repository boundaries even when project markers are hidden by read restrictions, and report unsupported sandbox backends as skill-loading errors.
- Track grant-dependent catalog entries and emit availability notices when skills disappear or return, even when the metadata budget is exhausted.
- Resolve implicit skill paths through their owning filesystem and exclude remote repository skills from local implicit command attribution.

## Testing

Add coverage for turn and session grants, grant expiry and restoration, hidden and newly created repository markers, cached read denials on Windows, unsupported remote sandboxes, and executor-backed implicit skill paths.

GitOrigin-RevId: ac1af483e73e3130524aeeabe218630435054028
2026-11-04 01:15:38 +00:00

70 lines
1.9 KiB
Rust

mod aliases;
pub mod catalog;
mod catalog_delta;
mod catalog_observability;
mod catalog_prompt;
mod catalog_state;
mod config;
mod dynamic_skill_selector;
mod extension;
mod fragments;
mod host_aliases;
mod host_outcome;
mod host_prompt;
mod host_roots;
mod host_service;
mod host_snapshot;
mod invocation;
mod loader;
mod preparation;
pub mod provider;
mod render;
mod render_observability;
mod required;
mod selection;
mod shadow_selection_experiment;
mod sources;
mod state;
mod step_state;
mod telemetry;
mod tools;
mod warnings;
mod world_state;
mod world_state_catalogs;
pub use catalog::merge_catalogs;
pub use config::SkillsExtensionConfig;
pub use extension::install;
pub use extension::install_with_providers;
pub use extension::install_with_providers_and_metrics;
pub use host_outcome::SkillLoadOutcome;
pub use host_prompt::HostSkillPrompts;
pub use host_prompt::InjectedHostSkillPrompts;
pub use host_service::HostSkillsLoadInput;
pub use host_service::HostSkillsRequest;
pub use host_service::HostSkillsService;
pub use host_snapshot::HostSkillsSnapshot;
pub use invocation::detect_implicit_skill_invocation;
pub use provider::ExecutorSkillProvider;
pub use provider::FrozenCloudSkillProvider;
pub use provider::HostSkillProvider;
pub use provider::SkillProvider;
pub use required::EnvironmentSkillRequirements;
pub use required::validate_required_skills;
pub use sources::SkillProviderSource;
pub use sources::SkillProviders;
pub use state::SkillsThreadState;
pub use telemetry::record_plugin_turn_usage;
/// Selected environments whose discovery can use a turn-scoped filesystem grant.
pub struct TurnSkillFilesystemGrants {
pub environment_ids: std::collections::HashSet<String>,
}
/// Recognizes persisted explicit skill prompts without exposing their fragment implementation.
pub fn is_skill_prompt_fragment(text: &str) -> bool {
<fragments::SkillInstructions as codex_extension_api::ContextualUserFragment>::matches_text(
text,
)
}