[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.
This commit is contained in:
alexsong-oai
2026-06-24 01:57:34 -07:00
committed by GitHub
Unverified
parent 3e39e92f03
commit f959e7fc98
+10 -2
View File
@@ -327,8 +327,16 @@ fn finalize_skill_outcome(
disabled_paths: HashSet<AbsolutePathBuf>,
) -> 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