Fix Codex skill version metadata (#703)

Move Codex and .agents skill versions under metadata while keeping all version readers compatible with legacy top-level frontmatter.\n\nAI assistance: prepared with Codex under maintainer direction.
This commit is contained in:
Paul Bakaus
2026-09-01 20:21:01 -04:00
committed by GitHub
parent 4981192613
commit 482368511a
11 changed files with 192 additions and 15 deletions
+18 -2
View File
@@ -1465,11 +1465,11 @@ describe('context.mjs update check', () => {
const cachePath = () => path.join(scratch, 'update-check.json');
function setup(cacheObj, { disable = false, host } = {}) {
function setup(cacheObj, { disable = false, host, skillFrontmatter } = {}) {
const skillScript = stageContextBundle(path.join(scratch, 'skill', 'scripts'));
fs.writeFileSync(
path.join(scratch, 'skill', 'SKILL.md'),
`---\nname: impeccable\nversion: ${LOCAL_VERSION}\n---\n\nbody\n`,
`---\n${skillFrontmatter || `name: impeccable\nversion: ${LOCAL_VERSION}`}\n---\n\nbody\n`,
);
fs.writeFileSync(cachePath(), JSON.stringify(cacheObj));
const project = path.join(scratch, 'project');
@@ -1522,6 +1522,22 @@ describe('context.mjs update check', () => {
assert.match(res.stdout, /^# PRODUCT\.md/);
});
it('reads metadata.version and prefers it over the legacy top-level key', () => {
const metadataOnly = run(
{ lastCheck: Date.now(), latestVersion: '2.0.0' },
{ skillFrontmatter: `name: impeccable\nmetadata:\n version: ${LOCAL_VERSION}` },
);
assert.equal(metadataOnly.status, 0);
assert.match(metadataOnly.stdout, /installed v1\.0\.0, latest v2\.0\.0/);
const both = run(
{ lastCheck: Date.now(), latestVersion: '2.0.0' },
{ skillFrontmatter: `name: impeccable\nversion: 9.0.0\nmetadata:\n version: ${LOCAL_VERSION}` },
);
assert.equal(both.status, 0);
assert.match(both.stdout, /installed v1\.0\.0, latest v2\.0\.0/);
});
// The directive used to say "ask once" and "if they agree, run it" while also
// saying to continue without waiting. Nothing gated the run on an answer that
// could not arrive, so the command read as the next step. It now forbids