feat: add inherit model profile for OpenCode /model (#951)

This commit is contained in:
jorge g
2026-03-15 13:40:08 -04:00
committed by GitHub
parent 789cac127d
commit 698985feb1
14 changed files with 111 additions and 50 deletions

View File

@@ -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