mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:25:04 +00:00
Reduce skill catalog prompts with path aliases (#41011)
## Why Repeated skill locator roots can make catalog prompts larger even when the catalog fits within its metadata budget. ## What changed Evaluate aliased catalogs regardless of budget pressure and select them when they preserve skill inclusion and description content while reducing prompt size. Apply the same selection to combined host, executor, and orchestrator catalogs. ## Testing Add coverage for alias selection in full host-only catalogs and update skill, symlink, and orchestrator resource tests to expect shortened locators and their root mappings. GitOrigin-RevId: ccedd3f3f6c7efaa1e5177a2d8c3d81d59239f52
This commit is contained in:
1 parent
b68acc4d4b
commit
7c3747941a
5 files changed
+94
-87
No files matched your search
@@ -220,6 +220,20 @@ fn catalog_budget_uses_context_percentage_or_character_fallback() {
|
||||
#[test]
|
||||
fn host_only_prompts_preserve_existing_behavior_with_and_without_aliases() {
|
||||
let root = "/Users/test/.codex/plugins/cache/openai-curated/host-plugin/1.0.0/skills-with-a-long-shared-root";
|
||||
let unaliased_catalog = SkillCatalog {
|
||||
entries: [
|
||||
("alpha", "Alpha skill."),
|
||||
("beta", "Beta skill."),
|
||||
("gamma", "Gamma skill."),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|(name, description)| {
|
||||
entry(name, description, /*short_description*/ None)
|
||||
.with_display_path(format!("{root}/{name}/SKILL.md"))
|
||||
})
|
||||
.collect(),
|
||||
warnings: Vec::new(),
|
||||
};
|
||||
let catalog = SkillCatalog {
|
||||
entries: [
|
||||
("alpha", "Alpha skill."),
|
||||
@@ -237,7 +251,7 @@ fn host_only_prompts_preserve_existing_behavior_with_and_without_aliases() {
|
||||
};
|
||||
|
||||
let unaliased = available_skills_fragment(
|
||||
&catalog,
|
||||
&unaliased_catalog,
|
||||
/*include_skills_usage_instructions*/ true,
|
||||
SkillCatalogRenderPolicy::CoreCompatible,
|
||||
SkillMetadataBudget::Characters(usize::MAX),
|
||||
@@ -310,7 +324,7 @@ fn host_only_prompts_preserve_existing_behavior_with_and_without_aliases() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn path_aliases_are_not_used_without_budget_pressure() {
|
||||
fn path_aliases_are_used_without_budget_pressure_when_they_reduce_prompt_size() {
|
||||
let root = "/Users/test/.codex/plugins/cache/openai-curated/example/hash/skills";
|
||||
let catalog = SkillCatalog {
|
||||
entries: vec![
|
||||
@@ -332,12 +346,8 @@ fn path_aliases_are_not_used_without_budget_pressure() {
|
||||
)
|
||||
.expect("catalog should render");
|
||||
|
||||
assert!(!fragment.body().contains("### Skill roots"));
|
||||
assert!(
|
||||
fragment
|
||||
.body()
|
||||
.contains(&format!("(file: {root}/alpha/SKILL.md)"))
|
||||
);
|
||||
assert!(fragment.body().contains("### Skill roots"));
|
||||
assert!(fragment.body().contains("(file: r0/alpha/SKILL.md)"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user