codex: support store-path skill sources

Handle per-skill values that come through as store-path strings, such as fetcher outputs with subdirectories appended. This restores the previously working pattern for packaged skill directories and adds a regression test for both directory and file sources.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2026-03-24 10:19:38 -05:00
parent 5068d0b03e
commit b8cb89f2c4
3 changed files with 41 additions and 2 deletions

View file

@ -150,9 +150,13 @@ in
# TODO: Remove this workaround once Codex supports symlinked SKILL.md
# files again. Upstream only supports symlinking the containing skill
# directory today: https://github.com/openai/codex/issues/10470
isStorePathString = content: builtins.isString content && lib.hasPrefix builtins.storeDir content;
isPathLikeContent = content: lib.isPath content || isStorePathString content;
mkSkillDir =
content:
pkgs.writeTextDir "SKILL.md" (if lib.isPath content then builtins.readFile content else content);
pkgs.writeTextDir "SKILL.md" (
if isPathLikeContent content then builtins.readFile content else content
);
skillSources =
if builtins.isAttrs cfg.skills then
cfg.skills
@ -162,7 +166,7 @@ in
{ };
mkSkillEntry =
name: content:
if lib.isPath content && lib.pathIsDirectory content then
if isPathLikeContent content && lib.pathIsDirectory content then
lib.nameValuePair "${skillsDir}/${name}" {
source = content;
}