From f959e7fc9832dfa0ebfb6542ab1bbf829638ac24 Mon Sep 17 00:00:00 2001 From: alexsong-oai Date: Wed, 24 Jun 2026 01:57:34 -0700 Subject: [PATCH] [codex] Emit implicit skill usage for support reads (#29731) ## Summary - Index all enabled skills for command-based usage detection, regardless of `allow_implicit_invocation`. - Preserve `allow_implicit_invocation` for the model-visible implicit routing list. - Add regression coverage for a support/preflight skill whose `SKILL.md` is read and whose script is run while implicit invocation is disabled. ## Root cause `allow_implicit_invocation` was used for both model routing and command-based usage-event detection. That meant support skills like `data-analytics:user-context` could be read or run by other skills, but those accesses could not emit implicit usage events. ## Validation - `just fmt` - `just test -p codex-core-skills service::tests::skills_for_config_indexes_usage_detection_for_non_implicit_skills` - `just test -p codex-core-skills` now has the new test passing, but 3 unrelated local tests fail because `/Users/alexsong/.agents/skills/test/SKILL.md` is invalid/missing YAML frontmatter. --- codex-rs/core-skills/src/service.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/codex-rs/core-skills/src/service.rs b/codex-rs/core-skills/src/service.rs index 1c956d79b..b4e0d7396 100644 --- a/codex-rs/core-skills/src/service.rs +++ b/codex-rs/core-skills/src/service.rs @@ -327,8 +327,16 @@ fn finalize_skill_outcome( disabled_paths: HashSet, ) -> SkillLoadOutcome { outcome.disabled_paths = disabled_paths; - let (by_scripts_dir, by_doc_path) = - build_implicit_skill_path_indexes(outcome.allowed_skills_for_implicit_invocation()); + // Usage-event detection should see any enabled skill file/script read, even when the + // skill is not model-routable through implicit invocation. + let (by_scripts_dir, by_doc_path) = build_implicit_skill_path_indexes( + outcome + .skills + .iter() + .filter(|skill| outcome.is_skill_enabled(skill)) + .cloned() + .collect(), + ); outcome.implicit_skills_by_scripts_dir = Arc::new(by_scripts_dir); outcome.implicit_skills_by_doc_path = Arc::new(by_doc_path); outcome