refactor: hard-fork GSD -> MSD (Make Software Done)

Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
This commit is contained in:
Jakub Zych
2026-10-06 01:47:40 +02:00
parent fe069b2a56
commit a9a7a328e6
2763 changed files with 78465 additions and 78434 deletions

View File

@@ -3,12 +3,12 @@
/**
* Agent Install Check Module — behaviour tests (#1268 T0, T1 #1277)
*
* Seam: gsd-core/bin/lib/agent-install-check.cjs
* Seam: msd-core/bin/lib/agent-install-check.cjs
* Interface: getAgentsDir, checkAgentsInstalled
*
* Verifies:
* 1. getAgentsDir behaviour: GSD_AGENTS_DIR override, claude path, non-claude path
* 2. checkAgentsInstalled behaviour against temp dirs via GSD_AGENTS_DIR:
* 1. getAgentsDir behaviour: MSD_AGENTS_DIR override, claude path, non-claude path
* 2. checkAgentsInstalled behaviour against temp dirs via MSD_AGENTS_DIR:
* - missing dir → agents_installed:false, missing_agents = all expected
* - existing-but-empty dir → installed_agents:[], agents_installed:false
* - no manifest → completeness skipped (incomplete_agents empty)
@@ -23,25 +23,25 @@ const path = require('node:path');
const { createTempDir, cleanup, captureFdSync } = require('./helpers.cjs');
const AGENT_INSTALL_CHECK_PATH = path.join(
__dirname, '..', 'gsd-core', 'bin', 'lib', 'agent-install-check.cjs'
__dirname, '..', 'msd-core', 'bin', 'lib', 'agent-install-check.cjs'
);
const RUNTIME_HOMES_PATH = path.join(
__dirname, '..', 'gsd-core', 'bin', 'lib', 'runtime-homes.cjs'
__dirname, '..', 'msd-core', 'bin', 'lib', 'runtime-homes.cjs'
);
const agentInstallCheck = require(AGENT_INSTALL_CHECK_PATH);
const { getGlobalConfigDir } = require(RUNTIME_HOMES_PATH);
const { getDirName } = require(path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'runtime-name-policy.cjs'));
const { getDirName } = require(path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'runtime-name-policy.cjs'));
// Get EXPECTED_AGENTS from model-profiles (same source of truth)
const MODEL_PROFILES = require(path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'model-profiles.cjs')).MODEL_PROFILES;
const MODEL_PROFILES = require(path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'model-profiles.cjs')).MODEL_PROFILES;
const EXPECTED_AGENTS = Object.keys(MODEL_PROFILES);
// #3242 — single source of truth for the Anthropic-flavored alias/id set (Phase 1
// moved the predicate here), so the posture tests below can't silently drift from
// what the posture check is actually supposed to reject.
const { CLAUDE_AGENT_ALIASES } = require(
path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'model-catalog.cjs'),
path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'model-catalog.cjs'),
);
// ─── Environment isolation ────────────────────────────────────────────────────
@@ -51,24 +51,24 @@ let savedRuntime;
let savedCodexHome;
beforeEach(() => {
savedAgentsDir = process.env['GSD_AGENTS_DIR'];
savedRuntime = process.env['GSD_RUNTIME'];
savedAgentsDir = process.env['MSD_AGENTS_DIR'];
savedRuntime = process.env['MSD_RUNTIME'];
savedCodexHome = process.env['CODEX_HOME'];
delete process.env['GSD_AGENTS_DIR'];
delete process.env['GSD_RUNTIME'];
delete process.env['MSD_AGENTS_DIR'];
delete process.env['MSD_RUNTIME'];
delete process.env['CODEX_HOME'];
});
afterEach(() => {
if (savedAgentsDir === undefined) {
delete process.env['GSD_AGENTS_DIR'];
delete process.env['MSD_AGENTS_DIR'];
} else {
process.env['GSD_AGENTS_DIR'] = savedAgentsDir;
process.env['MSD_AGENTS_DIR'] = savedAgentsDir;
}
if (savedRuntime === undefined) {
delete process.env['GSD_RUNTIME'];
delete process.env['MSD_RUNTIME'];
} else {
process.env['GSD_RUNTIME'] = savedRuntime;
process.env['MSD_RUNTIME'] = savedRuntime;
}
if (savedCodexHome === undefined) {
delete process.env['CODEX_HOME'];
@@ -84,25 +84,25 @@ function createCompleteAgents(agentsDir) {
}
}
function markLocalGsdInstall(configDir) {
function markLocalMsdInstall(configDir) {
fs.writeFileSync(
path.join(configDir, 'gsd-file-manifest.json'),
path.join(configDir, 'msd-file-manifest.json'),
JSON.stringify({ files: {} }),
);
}
function createCompleteLocalGsdInstall(configDir) {
function createCompleteLocalMsdInstall(configDir) {
const agentsDir = path.join(configDir, 'agents');
createCompleteAgents(agentsDir);
markLocalGsdInstall(configDir);
markLocalMsdInstall(configDir);
return agentsDir;
}
// ─── 1. getAgentsDir behaviour ────────────────────────────────────────────────
describe('getAgentsDir', () => {
test('GSD_AGENTS_DIR override takes priority', () => {
process.env['GSD_AGENTS_DIR'] = '/tmp/x';
test('MSD_AGENTS_DIR override takes priority', () => {
process.env['MSD_AGENTS_DIR'] = '/tmp/x';
assert.strictEqual(agentInstallCheck.getAgentsDir(), '/tmp/x');
assert.strictEqual(agentInstallCheck.getAgentsDir('cursor'), '/tmp/x');
});
@@ -121,7 +121,7 @@ describe('getAgentsDir', () => {
// node_modules tree and ships its own agents/. Pre-fix, getAgentsDir
// resolved that bundled copy, so checkAgentsInstalled validated the
// package against itself and agents_installed could never be false.
const tmp = createTempDir('gsd-npm-global-');
const tmp = createTempDir('msd-npm-global-');
const savedClaudeDir = process.env['CLAUDE_CONFIG_DIR'];
t.after(() => cleanup(tmp));
t.after(() => {
@@ -132,10 +132,10 @@ describe('getAgentsDir', () => {
}
});
const pkgRoot = path.join(tmp, 'node_modules', '@opengsd', 'gsd-core');
const pkgRoot = path.join(tmp, 'node_modules', '@opengsd', 'msd-core');
fs.cpSync(
path.join(__dirname, '..', 'gsd-core', 'bin'),
path.join(pkgRoot, 'gsd-core', 'bin'),
path.join(__dirname, '..', 'msd-core', 'bin'),
path.join(pkgRoot, 'msd-core', 'bin'),
{ recursive: true }
);
// Bundled agents/ is always complete — that is exactly why the pre-fix
@@ -147,7 +147,7 @@ describe('getAgentsDir', () => {
}
// Config dir carries every expected agent except the first — the issue
// repro's negative control (gsd-verifier removed from ~/.claude/agents).
// repro's negative control (msd-verifier removed from ~/.claude/agents).
const configDir = path.join(tmp, 'claude-config');
const agentsDir = path.join(configDir, 'agents');
fs.mkdirSync(agentsDir, { recursive: true });
@@ -158,7 +158,7 @@ describe('getAgentsDir', () => {
process.env['CLAUDE_CONFIG_DIR'] = configDir;
const globalInstallCheck = require(
path.join(pkgRoot, 'gsd-core', 'bin', 'lib', 'agent-install-check.cjs')
path.join(pkgRoot, 'msd-core', 'bin', 'lib', 'agent-install-check.cjs')
);
// Pin the resolved directory, not just an /agents suffix — the pre-fix
// resolver also ended with /agents, which is how the bug survived.
@@ -176,22 +176,22 @@ describe('getAgentsDir', () => {
assert.strictEqual(agentInstallCheck.getAgentsDir(runtime), expected);
});
test('GSD_RUNTIME env var is respected when no argument provided', () => {
process.env['GSD_RUNTIME'] = 'codex';
test('MSD_RUNTIME env var is respected when no argument provided', () => {
process.env['MSD_RUNTIME'] = 'codex';
const expected = path.join(getGlobalConfigDir('codex'), 'agents');
assert.strictEqual(agentInstallCheck.getAgentsDir(), expected);
});
test('defaults to claude when no arg and no GSD_RUNTIME', () => {
test('defaults to claude when no arg and no MSD_RUNTIME', () => {
const fromModule = agentInstallCheck.getAgentsDir();
const fromClaude = agentInstallCheck.getAgentsDir('claude');
assert.strictEqual(fromModule, fromClaude);
});
test('a manifest-backed local runtime installation wins over global agents', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
const localAgentsDir = createCompleteLocalGsdInstall(path.join(projectRoot, '.codex'));
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
const localAgentsDir = createCompleteLocalMsdInstall(path.join(projectRoot, '.codex'));
t.after(() => cleanup(projectRoot));
t.after(() => cleanup(globalHome));
createCompleteAgents(path.join(globalHome, 'agents'));
@@ -201,13 +201,13 @@ describe('getAgentsDir', () => {
assert.strictEqual(agentInstallCheck.checkAgentsInstalled('codex', projectRoot).agents_installed, true);
});
test('GSD_AGENTS_DIR remains terminal when a local Codex installation exists', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
test('MSD_AGENTS_DIR remains terminal when a local Codex installation exists', (t) => {
const projectRoot = createTempDir('msd-local-codex-');
const overrideDir = path.join(projectRoot, 'override-agents');
createCompleteLocalGsdInstall(path.join(projectRoot, '.codex'));
createCompleteLocalMsdInstall(path.join(projectRoot, '.codex'));
t.after(() => cleanup(projectRoot));
fs.mkdirSync(overrideDir, { recursive: true });
process.env['GSD_AGENTS_DIR'] = overrideDir;
process.env['MSD_AGENTS_DIR'] = overrideDir;
const result = agentInstallCheck.checkAgentsInstalled('codex', projectRoot);
assert.strictEqual(result.agents_dir, overrideDir);
@@ -216,13 +216,13 @@ describe('getAgentsDir', () => {
});
test('a manifest-backed empty local directory is authoritative over complete global agents', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
const localAgentsDir = path.join(projectRoot, '.codex', 'agents');
t.after(() => cleanup(projectRoot));
t.after(() => cleanup(globalHome));
fs.mkdirSync(localAgentsDir, { recursive: true });
markLocalGsdInstall(path.dirname(localAgentsDir));
markLocalMsdInstall(path.dirname(localAgentsDir));
createCompleteAgents(path.join(globalHome, 'agents'));
process.env['CODEX_HOME'] = globalHome;
@@ -233,8 +233,8 @@ describe('getAgentsDir', () => {
});
test('Codex falls back to global agents when no local directory exists', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
t.after(() => cleanup(projectRoot));
t.after(() => cleanup(globalHome));
createCompleteAgents(path.join(globalHome, 'agents'));
@@ -246,8 +246,8 @@ describe('getAgentsDir', () => {
});
test('Codex falls back to global agents when the local candidate is a regular file', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
const localCandidate = path.join(projectRoot, '.codex', 'agents');
t.after(() => cleanup(projectRoot));
t.after(() => cleanup(globalHome));
@@ -262,14 +262,14 @@ describe('getAgentsDir', () => {
});
test('Codex falls back to global agents when the local candidate cannot be inspected', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
const localAgentsDir = path.join(projectRoot, '.codex', 'agents');
const realLstatSync = fs.lstatSync;
t.after(() => cleanup(projectRoot));
t.after(() => cleanup(globalHome));
fs.mkdirSync(localAgentsDir, { recursive: true });
markLocalGsdInstall(path.dirname(localAgentsDir));
markLocalMsdInstall(path.dirname(localAgentsDir));
createCompleteAgents(path.join(globalHome, 'agents'));
process.env['CODEX_HOME'] = globalHome;
t.mock.method(fs, 'lstatSync', function injectedLocalProbeFailure(target, ...args) {
@@ -285,8 +285,8 @@ describe('getAgentsDir', () => {
});
test('Codex does not follow a symlinked local agents directory', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
const localConfigDir = path.join(projectRoot, '.codex');
const localAgentsDir = path.join(localConfigDir, 'agents');
const symlinkTarget = path.join(projectRoot, 'shared-agents');
@@ -294,7 +294,7 @@ describe('getAgentsDir', () => {
t.after(() => cleanup(globalHome));
createCompleteAgents(symlinkTarget);
fs.mkdirSync(localConfigDir, { recursive: true });
markLocalGsdInstall(localConfigDir);
markLocalMsdInstall(localConfigDir);
createCompleteAgents(path.join(globalHome, 'agents'));
process.env['CODEX_HOME'] = globalHome;
try {
@@ -312,9 +312,9 @@ describe('getAgentsDir', () => {
assert.strictEqual(result.agents_installed, true);
});
test('a project-native agents directory without a GSD manifest does not override global agents', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const globalHome = createTempDir('gsd-global-codex-');
test('a project-native agents directory without a MSD manifest does not override global agents', (t) => {
const projectRoot = createTempDir('msd-local-codex-');
const globalHome = createTempDir('msd-global-codex-');
const localAgentsDir = path.join(projectRoot, '.codex', 'agents');
t.after(() => cleanup(projectRoot));
t.after(() => cleanup(globalHome));
@@ -328,8 +328,8 @@ describe('getAgentsDir', () => {
});
test('a manifest-backed Cursor installation resolves from the project root', (t) => {
const projectRoot = createTempDir('gsd-local-cursor-');
const localAgentsDir = createCompleteLocalGsdInstall(path.join(projectRoot, getDirName('cursor')));
const projectRoot = createTempDir('msd-local-cursor-');
const localAgentsDir = createCompleteLocalMsdInstall(path.join(projectRoot, getDirName('cursor')));
t.after(() => cleanup(projectRoot));
assert.strictEqual(agentInstallCheck.getAgentsDir('cursor', projectRoot), localAgentsDir);
@@ -337,8 +337,8 @@ describe('getAgentsDir', () => {
});
test('a manifest-backed Cline installation resolves from the project root', (t) => {
const projectRoot = createTempDir('gsd-local-cline-');
const localAgentsDir = createCompleteLocalGsdInstall(projectRoot);
const projectRoot = createTempDir('msd-local-cline-');
const localAgentsDir = createCompleteLocalMsdInstall(projectRoot);
t.after(() => cleanup(projectRoot));
assert.strictEqual(agentInstallCheck.getAgentsDir('cline', projectRoot), localAgentsDir);
@@ -346,15 +346,15 @@ describe('getAgentsDir', () => {
});
test('a partial manifest-backed local installation remains selected and incomplete', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const projectRoot = createTempDir('msd-local-codex-');
const localConfigDir = path.join(projectRoot, '.codex');
const localAgentsDir = createCompleteLocalGsdInstall(localConfigDir);
const localAgentsDir = createCompleteLocalMsdInstall(localConfigDir);
const partialAgent = EXPECTED_AGENTS[0];
t.after(() => cleanup(projectRoot));
fs.writeFileSync(path.join(localAgentsDir, `${partialAgent}.md`), `# ${partialAgent}\n`);
fs.unlinkSync(path.join(localAgentsDir, `${partialAgent}.toml`));
fs.writeFileSync(
path.join(localConfigDir, 'gsd-file-manifest.json'),
path.join(localConfigDir, 'msd-file-manifest.json'),
JSON.stringify({ files: { [`agents/${partialAgent}.md`]: {}, [`agents/${partialAgent}.toml`]: {} } }),
);
@@ -366,9 +366,9 @@ describe('getAgentsDir', () => {
});
test('Claude and other runtimes ignore a supplied Codex-local candidate', (t) => {
const projectRoot = createTempDir('gsd-local-codex-');
const projectRoot = createTempDir('msd-local-codex-');
t.after(() => cleanup(projectRoot));
createCompleteLocalGsdInstall(path.join(projectRoot, '.codex'));
createCompleteLocalMsdInstall(path.join(projectRoot, '.codex'));
assert.strictEqual(
agentInstallCheck.getAgentsDir('claude', projectRoot),
@@ -387,9 +387,9 @@ describe('checkAgentsInstalled', () => {
let tmpDir;
beforeEach(() => {
tmpDir = createTempDir('gsd-agent-check-');
// Point GSD_AGENTS_DIR at a path we control
process.env['GSD_AGENTS_DIR'] = path.join(tmpDir, 'agents');
tmpDir = createTempDir('msd-agent-check-');
// Point MSD_AGENTS_DIR at a path we control
process.env['MSD_AGENTS_DIR'] = path.join(tmpDir, 'agents');
});
afterEach(() => {
@@ -455,7 +455,7 @@ describe('checkAgentsInstalled', () => {
const manifest = { files: manifestFiles };
fs.writeFileSync(
path.join(tmpDir, 'gsd-file-manifest.json'),
path.join(tmpDir, 'msd-file-manifest.json'),
JSON.stringify(manifest)
);
@@ -475,7 +475,7 @@ describe('checkAgentsInstalled', () => {
}
// Write malformed manifest
fs.writeFileSync(path.join(tmpDir, 'gsd-file-manifest.json'), '{not json"');
fs.writeFileSync(path.join(tmpDir, 'msd-file-manifest.json'), '{not json"');
let result;
assert.doesNotThrow(() => {
@@ -492,7 +492,7 @@ describe('checkAgentsInstalled', () => {
fs.mkdirSync(agentsDir, { recursive: true });
const result = agentInstallCheck.checkAgentsInstalled('cursor');
// GSD_AGENTS_DIR overrides, so agents_dir = our tmp path
// MSD_AGENTS_DIR overrides, so agents_dir = our tmp path
assert.strictEqual(result.agents_dir, agentsDir);
assert.strictEqual(result.agent_runtime, 'cursor');
});
@@ -500,7 +500,7 @@ describe('checkAgentsInstalled', () => {
// ─── 3. checkCodexModelPosture behaviour (#3242, ADR-2313 D6) ─────────────────
//
// Spec: .gsd/phase/feat-3242-codex-posture-health-check/{40-design,50-test-matrix}.md
// Spec: .msd/phase/feat-3242-codex-posture-health-check/{40-design,50-test-matrix}.md
// Interface (not yet implemented — every test below is red until it lands):
// POSTURE_REASON: frozen enum { ANTHROPIC_FLAVORED_MODEL, ORPHANED_REASONING_EFFORT,
// UNREADABLE, NOT_CODEX, AGENTS_DIR_MISSING }
@@ -565,9 +565,9 @@ describe('checkCodexModelPosture', () => {
let agentsDir;
beforeEach(() => {
tmpDir = createTempDir('gsd-posture-check-');
tmpDir = createTempDir('msd-posture-check-');
agentsDir = path.join(tmpDir, 'agents');
process.env['GSD_AGENTS_DIR'] = agentsDir;
process.env['MSD_AGENTS_DIR'] = agentsDir;
});
afterEach(() => {
@@ -618,8 +618,8 @@ describe('checkCodexModelPosture', () => {
test('row 4: clean .toml (no model, no effort) — ok:true, no violations', () => {
writeAgentToml(
agentsDir,
'gsd-clean',
'name = "gsd-clean"\ndescription = "a clean agent"\ndeveloper_instructions = \'\'\'\nDo the work.\n\'\'\'\n',
'msd-clean',
'name = "msd-clean"\ndescription = "a clean agent"\ndeveloper_instructions = \'\'\'\nDo the work.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -632,18 +632,18 @@ describe('checkCodexModelPosture', () => {
test('row 5: model = "sonnet" — ANTHROPIC_FLAVORED_MODEL naming the agent and the value', () => {
writeAgentToml(
agentsDir,
'gsd-planner',
'name = "gsd-planner"\nmodel = "sonnet"\ndeveloper_instructions = \'\'\'\nPlan.\n\'\'\'\n',
'msd-planner',
'name = "msd-planner"\nmodel = "sonnet"\ndeveloper_instructions = \'\'\'\nPlan.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
assert.strictEqual(result.ok, false);
assert.strictEqual(result.violations.length, 1);
assert.strictEqual(result.violations[0].agent, 'gsd-planner');
assert.strictEqual(result.violations[0].agent, 'msd-planner');
assert.strictEqual(result.violations[0].reason, agentInstallCheck.POSTURE_REASON.ANTHROPIC_FLAVORED_MODEL);
assert.strictEqual(result.violations[0].value, 'sonnet');
assert.ok(result.violations[0].file.endsWith('gsd-planner.toml'));
assert.ok(result.violations[0].file.endsWith('msd-planner.toml'));
});
// # 6 — table-driven over the full bare-alias set, sourced from model-catalog's
@@ -653,8 +653,8 @@ describe('checkCodexModelPosture', () => {
test(`row 6: bare Claude alias "${alias}" — ANTHROPIC_FLAVORED_MODEL`, () => {
writeAgentToml(
agentsDir,
'gsd-alias-agent',
`name = "gsd-alias-agent"\nmodel = "${alias}"\ndeveloper_instructions = '''\nWork.\n'''\n`,
'msd-alias-agent',
`name = "msd-alias-agent"\nmodel = "${alias}"\ndeveloper_instructions = '''\nWork.\n'''\n`,
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -671,8 +671,8 @@ describe('checkCodexModelPosture', () => {
test(`row 7: Claude model id "${modelId}" — ANTHROPIC_FLAVORED_MODEL`, () => {
writeAgentToml(
agentsDir,
'gsd-id-agent',
`name = "gsd-id-agent"\nmodel = "${modelId}"\ndeveloper_instructions = '''\nWork.\n'''\n`,
'msd-id-agent',
`name = "msd-id-agent"\nmodel = "${modelId}"\ndeveloper_instructions = '''\nWork.\n'''\n`,
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -687,8 +687,8 @@ describe('checkCodexModelPosture', () => {
test('row 8: model = "gpt-5.6-sol" — no violation (not an allowlist)', () => {
writeAgentToml(
agentsDir,
'gsd-gpt-agent',
'name = "gsd-gpt-agent"\nmodel = "gpt-5.6-sol"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-gpt-agent',
'name = "msd-gpt-agent"\nmodel = "gpt-5.6-sol"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -701,8 +701,8 @@ describe('checkCodexModelPosture', () => {
test('row 9: model = "some-future-model-id" — no violation', () => {
writeAgentToml(
agentsDir,
'gsd-future-agent',
'name = "gsd-future-agent"\nmodel = "some-future-model-id"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-future-agent',
'name = "msd-future-agent"\nmodel = "some-future-model-id"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -712,12 +712,12 @@ describe('checkCodexModelPosture', () => {
});
// # 10 — #838 coupling: a static reasoning-effort with no model pin means Codex
// is inheriting the session model while GSD's effort pin silently disagrees.
// is inheriting the session model while MSD's effort pin silently disagrees.
test('row 10: model_reasoning_effort with no model — ORPHANED_REASONING_EFFORT', () => {
writeAgentToml(
agentsDir,
'gsd-orphan-agent',
'name = "gsd-orphan-agent"\nmodel_reasoning_effort = "high"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-orphan-agent',
'name = "msd-orphan-agent"\nmodel_reasoning_effort = "high"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -725,15 +725,15 @@ describe('checkCodexModelPosture', () => {
assert.strictEqual(result.ok, false);
assert.strictEqual(result.violations.length, 1);
assert.strictEqual(result.violations[0].reason, agentInstallCheck.POSTURE_REASON.ORPHANED_REASONING_EFFORT);
assert.strictEqual(result.violations[0].agent, 'gsd-orphan-agent');
assert.strictEqual(result.violations[0].agent, 'msd-orphan-agent');
});
// # 11 — the legal pinned pair: model + matching reasoning effort is intentional.
test('row 11: model + model_reasoning_effort, model legal — no violation', () => {
writeAgentToml(
agentsDir,
'gsd-pinned-agent',
'name = "gsd-pinned-agent"\nmodel = "gpt-5-codex"\nmodel_reasoning_effort = "high"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-pinned-agent',
'name = "msd-pinned-agent"\nmodel = "gpt-5-codex"\nmodel_reasoning_effort = "high"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -750,8 +750,8 @@ describe('checkCodexModelPosture', () => {
test('row 12 (negative proof): service_tier + model_verbosity, no model — no violation', () => {
writeAgentToml(
agentsDir,
'gsd-light-agent',
'name = "gsd-light-agent"\nservice_tier = "flex"\nmodel_verbosity = "low"\ndeveloper_instructions = \'\'\'\nWork fast.\n\'\'\'\n',
'msd-light-agent',
'name = "msd-light-agent"\nservice_tier = "flex"\nmodel_verbosity = "low"\ndeveloper_instructions = \'\'\'\nWork fast.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -761,15 +761,15 @@ describe('checkCodexModelPosture', () => {
});
// # 13 — NEGATIVE PROOF. Catches: implementing the check as a whitelist over the
// whole TOML document (flagging any key GSD doesn't itself emit) instead of a
// whole TOML document (flagging any key MSD doesn't itself emit) instead of a
// predicate on exactly the two fields the posture owns (`model`,
// `model_reasoning_effort`). A hand-added `approval_policy` is legitimate and
// must never be flagged.
test('row 13 (negative proof): extra hand-added key (approval_policy) — no violation', () => {
writeAgentToml(
agentsDir,
'gsd-custom-agent',
'name = "gsd-custom-agent"\napproval_policy = "on-request"\ndeveloper_instructions = \'\'\'\nFollow policy.\n\'\'\'\n',
'msd-custom-agent',
'name = "msd-custom-agent"\napproval_policy = "on-request"\ndeveloper_instructions = \'\'\'\nFollow policy.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -788,7 +788,7 @@ describe('checkCodexModelPosture', () => {
// If this test passed against a whole-file scanner it would prove nothing; it
// must fail against one.
test('row 14 (negative proof, headline): model = inside developer_instructions block — no violation', () => {
copyFixtureToml(agentsDir, 'gsd-planner', 'model-in-developer-instructions.toml');
copyFixtureToml(agentsDir, 'msd-planner', 'model-in-developer-instructions.toml');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -799,7 +799,7 @@ describe('checkCodexModelPosture', () => {
// # 15 — NEGATIVE PROOF. Catches: a header-slice scan that doesn't skip comment
// lines, so a commented-out `# model = "sonnet"` still counts as a live pin.
test('row 15 (negative proof): commented-out model pin — no violation', () => {
copyFixtureToml(agentsDir, 'gsd-reviewer', 'commented-model-pin.toml');
copyFixtureToml(agentsDir, 'msd-reviewer', 'commented-model-pin.toml');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -811,7 +811,7 @@ describe('checkCodexModelPosture', () => {
// (e.g. a bare `/model/` test) instead of anchoring on the full key name, so
// `model_verbosity` gets misidentified as a `model` pin.
test('row 16 (negative proof): model_verbosity only (key-prefix collision) — no violation', () => {
copyFixtureToml(agentsDir, 'gsd-analyst', 'model-verbosity-prefix-collision.toml');
copyFixtureToml(agentsDir, 'msd-analyst', 'model-verbosity-prefix-collision.toml');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -821,7 +821,7 @@ describe('checkCodexModelPosture', () => {
// # 17 — boundary: whitespace around a REAL key must still be recognized as a pin.
test('row 17: indented / inner-spaced model pin — IS a violation', () => {
copyFixtureToml(agentsDir, 'gsd-tester', 'whitespace-indented-model-pin.toml');
copyFixtureToml(agentsDir, 'msd-tester', 'whitespace-indented-model-pin.toml');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -834,10 +834,10 @@ describe('checkCodexModelPosture', () => {
// # 18 — cross-platform: CRLF and BOM must parse identically to plain LF.
test('row 18a: CRLF file with a pinned model — parsed identically to LF (still a violation)', () => {
const lfContent =
'name = "gsd-scribe"\ndescription = "Writes changelog entries from merged PRs"\n' +
'name = "msd-scribe"\ndescription = "Writes changelog entries from merged PRs"\n' +
'model = "sonnet"\ndeveloper_instructions = \'\'\'\n' +
'Write a changelog entry summarizing the merged pull request.\n\'\'\'\n';
writeAgentToml(agentsDir, 'gsd-scribe', toCrlf(lfContent));
writeAgentToml(agentsDir, 'msd-scribe', toCrlf(lfContent));
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -847,7 +847,7 @@ describe('checkCodexModelPosture', () => {
});
test('row 18b: BOM-prefixed file with a pinned model — parsed identically to a BOM-free file', () => {
copyFixtureToml(agentsDir, 'gsd-archivist', 'bom-pinned-model.toml');
copyFixtureToml(agentsDir, 'msd-archivist', 'bom-pinned-model.toml');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -861,28 +861,28 @@ describe('checkCodexModelPosture', () => {
test('row 19: several agents, some violating — one entry per offender, deterministic order, clean absent', () => {
writeAgentToml(
agentsDir,
'gsd-alpha',
'name = "gsd-alpha"\ndeveloper_instructions = \'\'\'\nClean.\n\'\'\'\n',
'msd-alpha',
'name = "msd-alpha"\ndeveloper_instructions = \'\'\'\nClean.\n\'\'\'\n',
);
writeAgentToml(
agentsDir,
'gsd-bravo',
'name = "gsd-bravo"\nmodel = "opus"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-bravo',
'name = "msd-bravo"\nmodel = "opus"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
writeAgentToml(
agentsDir,
'gsd-charlie',
'name = "gsd-charlie"\nmodel_reasoning_effort = "medium"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-charlie',
'name = "msd-charlie"\nmodel_reasoning_effort = "medium"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
assert.strictEqual(result.ok, false);
assert.strictEqual(result.violations.length, 2);
assert.strictEqual(result.violations[0].agent, 'gsd-bravo');
assert.strictEqual(result.violations[1].agent, 'gsd-charlie');
assert.strictEqual(result.violations[0].agent, 'msd-bravo');
assert.strictEqual(result.violations[1].agent, 'msd-charlie');
assert.ok(
!result.violations.some((v) => v.agent === 'gsd-alpha'),
!result.violations.some((v) => v.agent === 'msd-alpha'),
'clean agent must not appear in violations at all',
);
assert.strictEqual(result.checked.length, 3);
@@ -900,8 +900,8 @@ describe('checkCodexModelPosture', () => {
test('quoted key "model" = "sonnet" (double-quoted) — still ANTHROPIC_FLAVORED_MODEL', () => {
writeAgentToml(
agentsDir,
'gsd-quoted-double',
'name = "gsd-quoted-double"\n"model" = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-quoted-double',
'name = "msd-quoted-double"\n"model" = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -915,8 +915,8 @@ describe('checkCodexModelPosture', () => {
test("quoted key 'model' = \"sonnet\" (single-quoted) — still ANTHROPIC_FLAVORED_MODEL", () => {
writeAgentToml(
agentsDir,
'gsd-quoted-single',
'name = "gsd-quoted-single"\n\'model\' = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-quoted-single',
'name = "msd-quoted-single"\n\'model\' = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -933,8 +933,8 @@ describe('checkCodexModelPosture', () => {
test('a description value quoting the marker text does not hide a real model pin before it', () => {
writeAgentToml(
agentsDir,
'gsd-decoy-marker',
'name = "gsd-decoy-marker"\n' +
'msd-decoy-marker',
'name = "msd-decoy-marker"\n' +
'description = "mentions developer_instructions = \'\'\' as an example string"\n' +
'model = "sonnet"\n' +
'developer_instructions = \'\'\'\nWork.\n\'\'\'\n',
@@ -954,8 +954,8 @@ describe('checkCodexModelPosture', () => {
test('a model pin placed AFTER the developer_instructions block is still flagged', () => {
writeAgentToml(
agentsDir,
'gsd-reordered',
'name = "gsd-reordered"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\nmodel = "sonnet"\n',
'msd-reordered',
'name = "msd-reordered"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\nmodel = "sonnet"\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -974,8 +974,8 @@ describe('checkCodexModelPosture', () => {
test('a file with no developer_instructions block at all is fully scanned', () => {
writeAgentToml(
agentsDir,
'gsd-noblock',
'name = "gsd-noblock"\ndescription = "no prompt block on this agent"\n"model" = "sonnet"\n',
'msd-noblock',
'name = "msd-noblock"\ndescription = "no prompt block on this agent"\n"model" = "sonnet"\n',
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -991,9 +991,9 @@ describe('checkCodexModelPosture', () => {
// monkeypatch/restore (see withInjectedReadFailure) rather than chmod 0o000,
// which root bypasses under Docker/CI.
test('row 21: unreadable .toml (EACCES) — UNREADABLE violation naming the file, other agents still checked, no throw', () => {
writeAgentToml(agentsDir, 'gsd-bad', 'name = "gsd-bad"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
writeAgentToml(agentsDir, 'gsd-good', 'name = "gsd-good"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
const badPath = path.join(agentsDir, 'gsd-bad.toml');
writeAgentToml(agentsDir, 'msd-bad', 'name = "msd-bad"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
writeAgentToml(agentsDir, 'msd-good', 'name = "msd-good"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
const badPath = path.join(agentsDir, 'msd-bad.toml');
const injected = Object.assign(new Error('injected EACCES'), { code: 'EACCES' });
const result = withInjectedReadFailure(badPath, injected, () =>
@@ -1001,13 +1001,13 @@ describe('checkCodexModelPosture', () => {
);
assert.strictEqual(result.ok, false);
const unreadable = result.violations.find((v) => v.agent === 'gsd-bad');
const unreadable = result.violations.find((v) => v.agent === 'msd-bad');
assert.ok(unreadable, 'unreadable file must produce a named violation, not a silent skip');
assert.strictEqual(unreadable.reason, agentInstallCheck.POSTURE_REASON.UNREADABLE);
assert.ok(unreadable.file.endsWith('gsd-bad.toml'));
assert.ok(unreadable.file.endsWith('msd-bad.toml'));
assert.strictEqual(result.checked.length, 2, 'the unreadable file must still be counted as checked');
assert.ok(
!result.violations.some((v) => v.agent === 'gsd-good'),
!result.violations.some((v) => v.agent === 'msd-good'),
'the still-readable sibling must be checked and found clean',
);
});
@@ -1022,7 +1022,7 @@ describe('checkCodexModelPosture', () => {
const targetPath = path.join(tmpDir, 'outside-target.toml');
fs.writeFileSync(targetPath, 'model = "sonnet"\n');
fs.mkdirSync(agentsDir, { recursive: true });
const symlinkPath = path.join(agentsDir, 'gsd-linked.toml');
const symlinkPath = path.join(agentsDir, 'msd-linked.toml');
try {
fs.symlinkSync(targetPath, symlinkPath, 'file');
} catch (error) {
@@ -1043,7 +1043,7 @@ describe('checkCodexModelPosture', () => {
test('broken symlink in agents dir does not crash the scan — other agents still checked', (t) => {
fs.mkdirSync(agentsDir, { recursive: true });
const brokenTarget = path.join(tmpDir, 'does-not-exist.toml');
const brokenSymlink = path.join(agentsDir, 'gsd-broken.toml');
const brokenSymlink = path.join(agentsDir, 'msd-broken.toml');
try {
fs.symlinkSync(brokenTarget, brokenSymlink, 'file');
} catch (error) {
@@ -1053,7 +1053,7 @@ describe('checkCodexModelPosture', () => {
}
throw error;
}
writeAgentToml(agentsDir, 'gsd-good', 'name = "gsd-good"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
writeAgentToml(agentsDir, 'msd-good', 'name = "msd-good"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
let result;
assert.doesNotThrow(() => {
@@ -1061,16 +1061,16 @@ describe('checkCodexModelPosture', () => {
});
assert.strictEqual(result.ok, true);
assert.deepStrictEqual(result.violations, []);
assert.deepStrictEqual(result.checked, ['gsd-good'], 'the broken symlink must be excluded, the other agent still checked');
assert.deepStrictEqual(result.checked, ['msd-good'], 'the broken symlink must be excluded, the other agent still checked');
});
test('a regular .toml file is still scanned normally (guard against over-filtering)', () => {
writeAgentToml(agentsDir, 'gsd-planner', 'name = "gsd-planner"\nmodel = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
writeAgentToml(agentsDir, 'msd-planner', 'name = "msd-planner"\nmodel = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
assert.strictEqual(result.ok, false);
assert.deepStrictEqual(result.checked, ['gsd-planner']);
assert.deepStrictEqual(result.checked, ['msd-planner']);
assert.strictEqual(result.violations.length, 1);
assert.strictEqual(result.violations[0].reason, agentInstallCheck.POSTURE_REASON.ANTHROPIC_FLAVORED_MODEL);
assert.strictEqual(result.violations[0].value, 'sonnet');
@@ -1078,7 +1078,7 @@ describe('checkCodexModelPosture', () => {
// # 22 — boundary: empty / whitespace-only .toml pins nothing.
test('row 22: empty / whitespace-only .toml — no violation', () => {
writeAgentToml(agentsDir, 'gsd-blank', ' \n\n\t\n');
writeAgentToml(agentsDir, 'msd-blank', ' \n\n\t\n');
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -1094,8 +1094,8 @@ describe('checkCodexModelPosture', () => {
const oversized = `claude-${'x'.repeat(80)}`; // 87 chars, Anthropic-flavored (contains "claude")
writeAgentToml(
agentsDir,
'gsd-oversized-agent',
`name = "gsd-oversized-agent"\nmodel = "${oversized}"\ndeveloper_instructions = '''\nWork.\n'''\n`,
'msd-oversized-agent',
`name = "msd-oversized-agent"\nmodel = "${oversized}"\ndeveloper_instructions = '''\nWork.\n'''\n`,
);
const result = agentInstallCheck.checkCodexModelPosture('codex', tmpDir);
@@ -1114,8 +1114,8 @@ describe('checkCodexModelPosture', () => {
test('row 25 (negative proof): non-codex runtime with a stray violating .toml present — still NOT_CODEX, file never inspected', (t) => {
writeAgentToml(
agentsDir,
'gsd-stray',
'name = "gsd-stray"\nmodel = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
'msd-stray',
'name = "msd-stray"\nmodel = "sonnet"\ndeveloper_instructions = \'\'\'\nWork.\n\'\'\'\n',
);
const reads = [];
t.mock.method(fs, 'readFileSync', (...args) => {
@@ -1173,10 +1173,10 @@ describe('cmdValidateAgents surfaces the Codex posture result (#3242 row 20)', (
let agentsDir;
beforeEach(() => {
tmpDir = createTempDir('gsd-posture-wiring-');
tmpDir = createTempDir('msd-posture-wiring-');
agentsDir = path.join(tmpDir, 'agents');
process.env['GSD_AGENTS_DIR'] = agentsDir;
process.env['GSD_RUNTIME'] = 'codex';
process.env['MSD_AGENTS_DIR'] = agentsDir;
process.env['MSD_RUNTIME'] = 'codex';
});
afterEach(() => {
@@ -1185,7 +1185,7 @@ describe('cmdValidateAgents surfaces the Codex posture result (#3242 row 20)', (
test('row 20: validate agents output carries the posture result for a violating install', () => {
const { cmdValidateAgents } = require(
path.join(__dirname, '..', 'gsd-core', 'bin', 'lib', 'verify.cjs'),
path.join(__dirname, '..', 'msd-core', 'bin', 'lib', 'verify.cjs'),
);
writeAgentToml(
agentsDir,
@@ -1226,9 +1226,9 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
let agentsDir;
beforeEach(() => {
tmpDir = createTempDir('gsd-agent-check-schema-');
tmpDir = createTempDir('msd-agent-check-schema-');
agentsDir = path.join(tmpDir, 'agents');
process.env['GSD_AGENTS_DIR'] = agentsDir;
process.env['MSD_AGENTS_DIR'] = agentsDir;
fs.mkdirSync(agentsDir, { recursive: true });
for (const agent of EXPECTED_AGENTS) {
fs.writeFileSync(path.join(agentsDir, `${agent}.md`), `# ${agent}\n`);
@@ -1245,7 +1245,7 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
const manifestFiles = {};
for (const agent of EXPECTED_AGENTS) manifestFiles[`agents/${agent}.md`] = 'somehash';
fs.writeFileSync(
path.join(tmpDir, 'gsd-file-manifest.json'),
path.join(tmpDir, 'msd-file-manifest.json'),
JSON.stringify({
version: '1.49.0',
timestamp: '2026-05-10T00:00:00.000Z',
@@ -1266,7 +1266,7 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
const manifestFiles = {};
for (const agent of EXPECTED_AGENTS) manifestFiles[`agents/${agent}.md`] = 'somehash';
fs.writeFileSync(
path.join(tmpDir, 'gsd-file-manifest.json'),
path.join(tmpDir, 'msd-file-manifest.json'),
JSON.stringify({
manifestVersion: 2,
version: '1.60.0',
@@ -1304,7 +1304,7 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
for (const agent of EXPECTED_AGENTS) manifestFiles[`agents/${agent}.md`] = 'somehash';
manifestFiles[`agents/${targetAgent}.toml`] = 'somehash';
fs.writeFileSync(
path.join(tmpDir, 'gsd-file-manifest.json'),
path.join(tmpDir, 'msd-file-manifest.json'),
JSON.stringify({
manifestVersion: 2,
version: '1.60.0',
@@ -1331,8 +1331,8 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
// blast-radius table), so a manifest path that is itself a SYMLINK is
// still ignored, exactly as before the substitution.
test('A5: getAgentsDir still ignores a symlinked manifest', (t) => {
const projectRoot = createTempDir('gsd-local-codex-schema-');
const globalHome = createTempDir('gsd-global-codex-schema-');
const projectRoot = createTempDir('msd-local-codex-schema-');
const globalHome = createTempDir('msd-global-codex-schema-');
const localConfigDir = path.join(projectRoot, '.codex');
const localAgentsDir = path.join(localConfigDir, 'agents');
const realManifestTarget = path.join(projectRoot, 'real-manifest.json');
@@ -1343,7 +1343,7 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
fs.writeFileSync(path.join(localAgentsDir, `${agent}.toml`), `name = "${agent}"\n`);
}
fs.writeFileSync(realManifestTarget, JSON.stringify({ files: {} }));
const manifestPath = path.join(localConfigDir, 'gsd-file-manifest.json');
const manifestPath = path.join(localConfigDir, 'msd-file-manifest.json');
createCompleteAgents(path.join(globalHome, 'agents'));
process.env['CODEX_HOME'] = globalHome;
try {
@@ -1367,7 +1367,7 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
// ─── 4. Sandbox-mode drift (#3897 rung 3, ADR-3473 §8.3 criterion 3) ──────────
//
// Spec: .gsd/phase/feat-3897-adr3473-83-rungs/{40-design,50-test-matrix}.md, S8/T28.
// Spec: .msd/phase/feat-3897-adr3473-83-rungs/{40-design,50-test-matrix}.md, S8/T28.
//
// `checkAgentsInstalled` above (and `checkCodexModelPosture`, the established
// sibling pattern for a codex-only posture check — #3242, "A new sibling
@@ -1384,21 +1384,21 @@ describe('checkAgentsInstalled — unchanged by the manifest-reader substitution
// RED today: the export does not exist at all.
describe('checkCodexSandboxPosture (#3897 rung 3 — not yet implemented, RED until it lands)', () => {
test('T28 validateAgentsFailsOnSandboxDrift_3897: a TOML whose sandbox_mode disagrees with the derived expectation must fail, naming role/expected/found', (t) => {
const globalHome = createTempDir('gsd-sandbox-drift-');
const globalHome = createTempDir('msd-sandbox-drift-');
t.after(() => cleanup(globalHome));
const agentsDir = path.join(globalHome, 'agents');
fs.mkdirSync(agentsDir, { recursive: true });
// gsd-executor declares tools: Read, Write, Edit (agents/gsd-executor.md) —
// msd-executor declares tools: Read, Write, Edit (agents/msd-executor.md) —
// it MUST derive workspace-write. Install a drifted TOML claiming
// read-only instead, matching the shape generateCodexAgentToml emits.
fs.writeFileSync(
path.join(agentsDir, 'gsd-executor.toml'),
'name = "gsd-executor"\ndescription = "Executes plans"\nsandbox_mode = "read-only"\n' +
path.join(agentsDir, 'msd-executor.toml'),
'name = "msd-executor"\ndescription = "Executes plans"\nsandbox_mode = "read-only"\n' +
"developer_instructions = '''\nExecute.\n'''\n",
);
for (const agent of EXPECTED_AGENTS) {
if (agent === 'gsd-executor') continue;
if (agent === 'msd-executor') continue;
fs.writeFileSync(path.join(agentsDir, `${agent}.toml`), `name = "${agent}"\n`);
}
process.env['CODEX_HOME'] = globalHome;
@@ -1415,7 +1415,7 @@ describe('checkCodexSandboxPosture (#3897 rung 3 — not yet implemented, RED un
false,
'a TOML whose sandbox_mode disagrees with the expected derived value must fail the check',
);
const violation = result.violations.find((v) => v.agent === 'gsd-executor');
const violation = result.violations.find((v) => v.agent === 'msd-executor');
assert.ok(violation, 'the violation must name the drifted agent');
assert.equal(violation.expected, 'workspace-write', 'the violation must name the EXPECTED sandbox_mode');
assert.equal(violation.found, 'read-only', 'the violation must name the FOUND (installed) sandbox_mode');
@@ -1429,31 +1429,31 @@ describe('checkCodexSandboxPosture (#3897 rung 3 — not yet implemented, RED un
// legitimately discuss). The naive regex misread that prose as a live
// value and manufactured a FALSE violation.
test('a sandbox_mode-shaped line INSIDE developer_instructions is never read as a live value (no false violation)', (t) => {
const globalHome = createTempDir('gsd-sandbox-block-aware-');
const globalHome = createTempDir('msd-sandbox-block-aware-');
t.after(() => cleanup(globalHome));
const agentsDir = path.join(globalHome, 'agents');
fs.mkdirSync(agentsDir, { recursive: true });
// gsd-nyquist-auditor's real canonical tools: declares Write/Edit, so the
// msd-nyquist-auditor's real canonical tools: declares Write/Edit, so the
// derived expectation is workspace-write. Install a TOML that correctly
// has NO header sandbox_mode pin, but whose developer_instructions block
// contains a line that is shaped exactly like a live sandbox_mode pin.
fs.writeFileSync(
path.join(agentsDir, 'gsd-nyquist-auditor.toml'),
'name = "gsd-nyquist-auditor"\ndescription = "Fills Nyquist validation gaps"\n' +
path.join(agentsDir, 'msd-nyquist-auditor.toml'),
'name = "msd-nyquist-auditor"\ndescription = "Fills Nyquist validation gaps"\n' +
"developer_instructions = '''\n" +
'When configuring the sandbox, use:\n' +
'sandbox_mode = "workspace-write"\n' +
"'''\n",
);
for (const agent of EXPECTED_AGENTS) {
if (agent === 'gsd-nyquist-auditor') continue;
if (agent === 'msd-nyquist-auditor') continue;
fs.writeFileSync(path.join(agentsDir, `${agent}.toml`), `name = "${agent}"\n`);
}
process.env['CODEX_HOME'] = globalHome;
const result = agentInstallCheck.checkCodexSandboxPosture('codex');
const violation = result.violations.find((v) => v.agent === 'gsd-nyquist-auditor');
const violation = result.violations.find((v) => v.agent === 'msd-nyquist-auditor');
assert.equal(
violation,
undefined,
@@ -1467,25 +1467,25 @@ describe('checkCodexSandboxPosture (#3897 rung 3 — not yet implemented, RED un
// not, so an oversized (or secret-shaped) sandbox_mode value could reach
// `validate agents --raw` output at full length.
test('an oversized sandbox_mode value is truncated in the emitted violation (CLI JSON)', (t) => {
const globalHome = createTempDir('gsd-sandbox-truncate-');
const globalHome = createTempDir('msd-sandbox-truncate-');
t.after(() => cleanup(globalHome));
const agentsDir = path.join(globalHome, 'agents');
fs.mkdirSync(agentsDir, { recursive: true });
const oversized = 'x'.repeat(300);
fs.writeFileSync(
path.join(agentsDir, 'gsd-executor.toml'),
`name = "gsd-executor"\ndescription = "Executes plans"\nsandbox_mode = "${oversized}"\n` +
path.join(agentsDir, 'msd-executor.toml'),
`name = "msd-executor"\ndescription = "Executes plans"\nsandbox_mode = "${oversized}"\n` +
"developer_instructions = '''\nExecute.\n'''\n",
);
for (const agent of EXPECTED_AGENTS) {
if (agent === 'gsd-executor') continue;
if (agent === 'msd-executor') continue;
fs.writeFileSync(path.join(agentsDir, `${agent}.toml`), `name = "${agent}"\n`);
}
process.env['CODEX_HOME'] = globalHome;
const result = agentInstallCheck.checkCodexSandboxPosture('codex');
const violation = result.violations.find((v) => v.agent === 'gsd-executor');
const violation = result.violations.find((v) => v.agent === 'msd-executor');
assert.ok(violation, 'the violation must name the drifted agent');
assert.ok(
violation.found.length <= 65,