diff --git a/packages/core/src/subagents/model-selection.test.ts b/packages/core/src/subagents/model-selection.test.ts index aaa2624f8..ce7c5ca96 100644 --- a/packages/core/src/subagents/model-selection.test.ts +++ b/packages/core/src/subagents/model-selection.test.ts @@ -36,9 +36,17 @@ describe('parseSubagentModelSelection', () => { }); }); - it('rejects invalid authType prefixes', () => { - expect(() => parseSubagentModelSelection('invalid:glm-5')).toThrow( - /Invalid authType prefix/, - ); + it('treats unknown prefix as bare model ID (colon in model ID)', () => { + expect(parseSubagentModelSelection('invalid:glm-5')).toEqual({ + modelId: 'invalid:glm-5', + inherits: false, + }); + }); + + it('treats model IDs with colons as bare model IDs', () => { + expect(parseSubagentModelSelection('gpt-4o:online')).toEqual({ + modelId: 'gpt-4o:online', + inherits: false, + }); }); }); diff --git a/packages/core/src/subagents/model-selection.ts b/packages/core/src/subagents/model-selection.ts index cea1ef97d..f9c909f78 100644 --- a/packages/core/src/subagents/model-selection.ts +++ b/packages/core/src/subagents/model-selection.ts @@ -38,10 +38,10 @@ export function parseSubagentModelSelection( const maybeAuthType = trimmed.slice(0, colonIndex).trim(); const modelId = trimmed.slice(colonIndex + 1).trim(); + // If the prefix isn't a known AuthType, treat the whole string as a bare + // model ID. Model IDs can legitimately contain colons (e.g. gpt-4o:online). if (!AUTH_TYPES.has(maybeAuthType as AuthType)) { - throw new Error( - `Invalid authType prefix "${maybeAuthType}". Expected one of: ${Object.values(AuthType).join(', ')}`, - ); + return { modelId: trimmed, inherits: false }; } if (!modelId) { diff --git a/packages/core/src/subagents/validation.test.ts b/packages/core/src/subagents/validation.test.ts index 5b525db29..99f2de30f 100644 --- a/packages/core/src/subagents/validation.test.ts +++ b/packages/core/src/subagents/validation.test.ts @@ -247,13 +247,17 @@ describe('SubagentValidator', () => { expect(result.errors).toContain('Model must be a non-empty string'); }); - it('should reject invalid authType prefixes', () => { + it('should accept model IDs containing colons with unknown prefix', () => { const result = validator.validateModel('invalid:glm-5'); - expect(result.isValid).toBe(false); - expect(result.errors[0]).toContain('Invalid authType prefix'); + expect(result.isValid).toBe(true); }); - it('should reject missing model IDs after authType prefixes', () => { + it('should accept model IDs with colons (e.g. gpt-4o:online)', () => { + const result = validator.validateModel('gpt-4o:online'); + expect(result.isValid).toBe(true); + }); + + it('should reject missing model IDs after valid authType prefixes', () => { const result = validator.validateModel('openai:'); expect(result.isValid).toBe(false); expect(result.errors).toContain(