mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:25:04 +00:00
Read executor skill packages directly (#38167)
## Why Executor skills required a `skills.list` lookup before their contents could be read, even when the catalog already identified the skill. ## What changed - Render executor skill catalog entries as package locators, including shortened locators when skill roots are aliased. - Tell the model to pass those packages directly to `skills.read`, while keeping `skills.list` as the fallback when no package is available. - Use the shorter package locators when applying the skills context budget. ## Testing Update catalog, aliasing, budget-pressure, and selected-skill coverage, including an executor package ID containing a literal backslash. GitOrigin-RevId: 2ace5e527dc4f29651a8f3214475ccc90d52c73f
This commit is contained in:
1 parent
3fe19fcd81
commit
69ae78291d
7 files changed
+70
-50
No files matched your search
@@ -236,20 +236,20 @@ fn host_only_prompts_preserve_existing_behavior_with_and_without_aliases() {
|
||||
insta::assert_snapshot!(unaliased.body(), @r###"
|
||||
|
||||
## Skills
|
||||
A skill is a set of instructions provided through a `SKILL.md` source. Below is the list of skills that can be used. Each entry includes a name, description, and source locator. `file` locators are on the host filesystem, `environment resource` locators are owned by an execution environment, `orchestrator package` locators are opaque package identifiers, and `custom resource` locators use their provider's access mechanism.
|
||||
A skill is a set of instructions provided through a `SKILL.md` source. Below is the list of skills that can be used. Each entry includes a name, description, and source locator. `file` locators are on the host filesystem, `executor package` locators are owned by their execution environment, `orchestrator package` locators are opaque package identifiers, and `custom resource` locators use their provider's access mechanism.
|
||||
### Available skills
|
||||
- alpha: Alpha skill. (file: /Users/test/.codex/plugins/cache/openai-curated/host-plugin/1.0.0/skills-with-a-long-shared-root/alpha/SKILL.md)
|
||||
- beta: Beta skill. (file: /Users/test/.codex/plugins/cache/openai-curated/host-plugin/1.0.0/skills-with-a-long-shared-root/beta/SKILL.md)
|
||||
- gamma: Gamma skill. (file: /Users/test/.codex/plugins/cache/openai-curated/host-plugin/1.0.0/skills-with-a-long-shared-root/gamma/SKILL.md)
|
||||
### How to use skills
|
||||
- Discovery: The list above is the skills available in this session (name + description + source locator). `file` entries live on the host filesystem, `environment resource` entries are accessed through `skills.list` and `skills.read`, `orchestrator package` entries are accessed directly through `skills.read`, and `custom resource` entries use their provider's access mechanism.
|
||||
- Discovery: The list above is the skills available in this session (name + description + source locator). `file` entries live on the host filesystem, `executor package` and `orchestrator package` entries are accessed directly through `skills.read`, and `custom resource` entries use their provider's access mechanism.
|
||||
- Trigger rules: If the user names a skill (with `$SkillName` or plain text) OR the task clearly matches a skill's description shown above, you must use that skill for that turn. Multiple mentions mean use them all. Do not carry skills across turns unless re-mentioned.
|
||||
- Missing/blocked: If a named skill isn't in the list or its source can't be read, say so briefly and continue with the best fallback.
|
||||
- How to use a skill (progressive disclosure):
|
||||
1) After deciding to use a skill, the main agent must read its `SKILL.md` completely before taking task actions. For a `file` entry, open the listed path. For an `environment resource`, call `skills.list` with `{"authority":{"kind":"executor"}}`, select the matching package, and pass its exact package and `main_resource` to `skills.read`. For an `orchestrator package`, expand its root alias when present and call `skills.read` with the complete locator as `package`; omit `resource` to read `SKILL.md` directly without calling `skills.list`. Follow `next_cursor`; if a read is paginated, continue until EOF.
|
||||
2) When `SKILL.md` references another resource, use the same access mechanism. Resolve relative references beneath an executor skill's returned package and call `skills.read` with the same package. For orchestrator skills, pass the exact referenced resource identifier with the same package to `skills.read`; do not treat `skill://` identifiers as filesystem paths.
|
||||
1) After deciding to use a skill, the main agent must read its `SKILL.md` completely before taking task actions. For a `file` entry, open the listed path. For an `executor package` or `orchestrator package`, expand its root alias when present and call `skills.read` with the complete locator as `package`; omit `resource` to read `SKILL.md` directly without calling `skills.list`. If a read is paginated, follow `next_cursor` until EOF.
|
||||
2) When `SKILL.md` references another resource, use the same access mechanism. For executor and orchestrator skills, pass the complete package-contained resource identifier with the same package to `skills.read`; do not treat `skill://` identifiers as filesystem paths.
|
||||
3) If `SKILL.md` points to extra folders such as `references/`, use its routing instructions to identify the resources required for the task. The main agent must read each required instruction or reference file itself before acting on it. Do not delegate reading, summarizing, or interpreting skill instructions to a subagent. Subagents may still perform task work when the selected skill allows it.
|
||||
4) For filesystem-backed skills, prefer running or patching provided scripts instead of retyping large code blocks. For environment and orchestrator skills, use `skills.read` and the available tools; do not invent a local path.
|
||||
4) For filesystem-backed skills, prefer running or patching provided scripts instead of retyping large code blocks. For executor and orchestrator skills, use `skills.read` and the available tools; do not invent a local path.
|
||||
5) Reuse provided assets or templates through the same source access mechanism instead of recreating them.
|
||||
- Coordination and sequencing:
|
||||
- If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them.
|
||||
@@ -387,6 +387,23 @@ fn path_aliases_retain_every_skill_under_budget_pressure() {
|
||||
assert!(!body.contains("additional skills omitted"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn executor_aliases_preserve_literal_backslashes_in_package_ids() {
|
||||
let root = r"skill://executor/workspace/foo\bar/skills";
|
||||
let package = format!("{root}/demo");
|
||||
let entry = SkillCatalogEntry::new(
|
||||
SkillPackageId(package.clone()),
|
||||
SkillAuthority::new(SkillSourceKind::Executor, "env-1"),
|
||||
"demo",
|
||||
"Description.",
|
||||
SkillResourceId::new(format!("{package}/SKILL.md")),
|
||||
)
|
||||
.with_alias_root(root);
|
||||
let plan = build_alias_plan(&[&entry]).expect("alias plan should build");
|
||||
|
||||
assert_eq!(render_skill_locator_with_aliases(&entry, &plan), "e0/demo");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn host_alias_roots_follow_core_discovery_order() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let unique = SystemTime::now().duration_since(UNIX_EPOCH)?.as_nanos();
|
||||
@@ -507,7 +524,7 @@ fn mixed_catalogs_keep_absolute_authority_aware_rendering_under_budget_pressure(
|
||||
|
||||
assert!(!body.contains("### Skill roots"));
|
||||
assert!(body.contains(&format!("(file: {root}/skill-0/SKILL.md)")));
|
||||
assert!(body.contains("(environment resource: skill://executor/demo/SKILL.md)"));
|
||||
assert!(body.contains("(executor package: executor-skill)"));
|
||||
assert!(body.contains("For a `file` entry, open the listed path."));
|
||||
assert!(!body.contains("additional skills omitted"));
|
||||
}
|
||||
@@ -522,7 +539,7 @@ fn mixed_catalog_reserves_executor_omission_marker_by_omitting_host_first() {
|
||||
};
|
||||
let executor_entry = |name: &str, resource: &str| {
|
||||
SkillCatalogEntry::new(
|
||||
SkillPackageId(name.to_string()),
|
||||
SkillPackageId(resource.to_string()),
|
||||
SkillAuthority::new(SkillSourceKind::Executor, "env-1"),
|
||||
name,
|
||||
"",
|
||||
@@ -574,7 +591,7 @@ fn mixed_catalog_reserves_executor_omission_marker_by_omitting_host_first() {
|
||||
assert_eq!(
|
||||
executor.skill_lines,
|
||||
vec![
|
||||
"- e1: (environment resource: skill://executor/one)".to_string(),
|
||||
"- e1: (executor package: skill://executor/one)".to_string(),
|
||||
"- 1 additional skill omitted from this bounded skills list.".to_string(),
|
||||
]
|
||||
);
|
||||
@@ -595,14 +612,15 @@ fn mixed_catalogs_alias_all_skill_sources_under_budget_pressure() {
|
||||
entries: (0..3)
|
||||
.map(|index| {
|
||||
let name = format!("{prefix}-{index}");
|
||||
let package = format!("{root}/{name}");
|
||||
let locator = match source {
|
||||
SkillSourceKind::Orchestrator => format!("{root}/{name}"),
|
||||
SkillSourceKind::Orchestrator => package.clone(),
|
||||
SkillSourceKind::Host
|
||||
| SkillSourceKind::Executor
|
||||
| SkillSourceKind::Custom(_) => format!("{root}/{name}/SKILL.md"),
|
||||
| SkillSourceKind::Custom(_) => format!("{package}/SKILL.md"),
|
||||
};
|
||||
SkillCatalogEntry::new(
|
||||
SkillPackageId(locator.clone()),
|
||||
SkillPackageId(package),
|
||||
SkillAuthority::new(source.clone(), authority),
|
||||
name,
|
||||
"Description.",
|
||||
@@ -657,7 +675,7 @@ fn mixed_catalogs_alias_all_skill_sources_under_budget_pressure() {
|
||||
executor
|
||||
.skill_lines
|
||||
.iter()
|
||||
.any(|line| line.contains("(environment resource: e0/executor-0/SKILL.md)"))
|
||||
.any(|line| line.contains("(executor package: e0/executor-0)"))
|
||||
);
|
||||
assert!(
|
||||
orchestrator
|
||||
@@ -696,7 +714,7 @@ fn mixed_catalog_prefers_executor_inclusion_over_total_aliased_inclusion() {
|
||||
};
|
||||
let executor_entry = |name: &str, resource: &str| {
|
||||
SkillCatalogEntry::new(
|
||||
SkillPackageId(name.to_string()),
|
||||
SkillPackageId(resource.to_string()),
|
||||
SkillAuthority::new(SkillSourceKind::Executor, "env-1"),
|
||||
name,
|
||||
"",
|
||||
|
||||
Reference in new issue
Block a user