feat: add inherit model profile for OpenCode /model (#951)
This commit is contained in:
@@ -147,7 +147,7 @@ describe('resolveModelInternal', () => {
|
||||
describe('model profile structural validation', () => {
|
||||
test('all known agents resolve to a valid string for each profile', () => {
|
||||
const knownAgents = ['gsd-planner', 'gsd-executor', 'gsd-phase-researcher', 'gsd-codebase-mapper'];
|
||||
const profiles = ['quality', 'balanced', 'budget'];
|
||||
const profiles = ['quality', 'balanced', 'budget', 'inherit'];
|
||||
const validValues = ['inherit', 'sonnet', 'haiku', 'opus'];
|
||||
|
||||
for (const profile of profiles) {
|
||||
@@ -161,6 +161,14 @@ describe('resolveModelInternal', () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('inherit profile forces all known agents to inherit model', () => {
|
||||
const knownAgents = ['gsd-planner', 'gsd-executor', 'gsd-phase-researcher', 'gsd-codebase-mapper'];
|
||||
writeConfig({ model_profile: 'inherit' });
|
||||
for (const agent of knownAgents) {
|
||||
assert.strictEqual(resolveModelInternal(tmpDir, agent), 'inherit');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('override precedence', () => {
|
||||
@@ -195,6 +203,11 @@ describe('resolveModelInternal', () => {
|
||||
assert.strictEqual(resolveModelInternal(tmpDir, 'gsd-nonexistent'), 'sonnet');
|
||||
});
|
||||
|
||||
test('returns sonnet for unknown agent type even with inherit profile', () => {
|
||||
writeConfig({ model_profile: 'inherit' });
|
||||
assert.strictEqual(resolveModelInternal(tmpDir, 'gsd-nonexistent'), 'sonnet');
|
||||
});
|
||||
|
||||
test('defaults to balanced profile when model_profile missing', () => {
|
||||
writeConfig({});
|
||||
// balanced profile, gsd-planner -> opus -> inherit
|
||||
|
||||
@@ -255,6 +255,34 @@ describe('validate health command', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('accepts inherit model_profile as valid', () => {
|
||||
writeMinimalProjectMd(tmpDir);
|
||||
writeMinimalRoadmap(tmpDir, ['1']);
|
||||
writeMinimalStateMd(tmpDir);
|
||||
fs.writeFileSync(
|
||||
path.join(tmpDir, '.planning', 'config.json'),
|
||||
JSON.stringify({
|
||||
model_profile: 'inherit',
|
||||
workflow: {
|
||||
research: true,
|
||||
plan_check: true,
|
||||
verifier: true,
|
||||
nyquist_validation: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
assert.ok(
|
||||
!output.warnings.some(w => w.code === 'W004'),
|
||||
`Should not warn for inherit model_profile: ${JSON.stringify(output.warnings)}`
|
||||
);
|
||||
});
|
||||
|
||||
// ─── Check 6: Phase directory naming (NN-name format) ─────────────────────
|
||||
|
||||
test('warns about incorrectly named phase directories', () => {
|
||||
|
||||
Reference in New Issue
Block a user