Browse Source

fix(agents): use council master model for councillor agent registration (#302)

* fix(agents): use council master model for councillor agent registration

Councillor fell through to DEFAULT_MODELS['councillor'] (hardcoded to
openai/gpt-5.4-mini) instead of using the configured council master
model. This caused ProviderModelNotFoundError when the hardcoded
provider wasn't available, and used the wrong model even when it was.

* test(agents): add councillor model resolution tests
Dusan Kovacevic 3 months ago
parent
commit
59a0680155
2 changed files with 28 additions and 1 deletions
  1. 25 0
      src/agents/index.test.ts
  2. 3 1
      src/agents/index.ts

+ 25 - 0
src/agents/index.test.ts

@@ -374,6 +374,31 @@ describe('council agent model resolution', () => {
     const councilMaster = agents.find((a) => a.name === 'council-master');
     expect(councilMaster?.config.model).toBe(DEFAULT_MODELS['council-master']);
   });
+
+  test('councillor agent uses config.council.master.model', () => {
+    const config = {
+      council: {
+        master: { model: 'anthropic/claude-sonnet-4-6' },
+        presets: {
+          default: {
+            councillors: {
+              alpha: { model: 'test/alpha-model' },
+            },
+            master: undefined,
+          },
+        },
+      },
+    } as unknown as PluginConfig;
+    const agents = createAgents(config);
+    const councillor = agents.find((a) => a.name === 'councillor');
+    expect(councillor?.config.model).toBe('anthropic/claude-sonnet-4-6');
+  });
+
+  test('councillor agent falls back to default without council config', () => {
+    const agents = createAgents();
+    const councillor = agents.find((a) => a.name === 'councillor');
+    expect(councillor?.config.model).toBe(DEFAULT_MODELS.councillor);
+  });
 });
 
 describe('options passthrough', () => {

+ 3 - 1
src/agents/index.ts

@@ -147,7 +147,9 @@ export function createAgents(config?: PluginConfig): AgentDefinition[] {
     // config.council.master.model so the TUI validates the user's
     // actual model, not the hardcoded default
     if (
-      (name === 'council' || name === 'council-master') &&
+      (name === 'council' ||
+        name === 'council-master' ||
+        name === 'councillor') &&
       config?.council?.master?.model
     ) {
       return config.council.master.model;