fix: handle both string[] and object[] formats in provider-models cache#1509
Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom Feb 5, 2026
Conversation
Category delegation fails when provider-models.json contains model objects
with metadata (id, provider, context, output) instead of plain strings.
Line 196 in model-availability.ts assumes string[] format, causing:
- Object concatenation: `${providerId}/${modelId}` becomes "ollama/[object Object]"
- Empty availableModels Set passed to resolveModelPipeline()
- Error: "Model not configured for category"
This is the root cause of issue code-yeongyu#1508 where delegate_task(category='quick')
fails despite direct agent routing (delegate_task(subagent_type='explore'))
working correctly.
Changes:
- model-availability.ts: Add type check to handle both string and object formats
- connected-providers-cache.ts: Update ProviderModelsCache interface to accept both formats
- model-availability.test.ts: Add 4 test cases for object[] format handling
Direct agent routing bypasses fetchAvailableModels() entirely, explaining why
it works while category routing fails. This fix enables category delegation
to work with manually-populated Ollama model caches.
Fixes code-yeongyu#1508
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes category delegation failing when
provider-models.jsoncontains model objects with metadata instead of plain strings.Root Cause: Line 196 in
model-availability.tsassumesstring[]format when iterating over cached models, but manually-populated caches (like Ollama) useobject[]format with metadata ({id, provider, context, output}).Impact:
delegate_task(category='quick')→ ❌ "Model not configured for category"delegate_task(subagent_type='explore')→ ✅ Works (bypasses cache)Changes
Core Fix (
model-availability.ts)Type Safety (
connected-providers-cache.ts)Test Coverage (
model-availability.test.ts)Added 4 test cases:
object[]format with metadata (Ollama-style)string[]andobject[]across providersstring[]formatTesting
Context
This fix enables category-based delegation to work with manually-populated Ollama model caches, which is the intended approach per Vercel AI SDK (no
model.list()for local providers).Related:
Backward Compatibility
✅ Fully backward compatible - handles both legacy
string[]and newobject[]formats without breaking existing deployments.Summary by cubic
Fixes category delegation by supporting both string[] and object[] formats in provider-models.json. Prevents “Model not configured for category” errors with Ollama and other manually populated caches.
Written for commit bd3a3bc. Summary will update on new commits.