GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: handle both string[] and object[] formats in provider-models cache by rooftop-Owl · Pull Request #1509 · code-yeongyu/oh-my-openagent

Conversation

@rooftop-Owl

@rooftop-Owl rooftop-Owl commented Feb 5, 2026 •
edited by cubic-dev-ai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Fixes category delegation failing when provider-models.json contains model objects with metadata instead of plain strings.

Root Cause: Line 196 in model-availability.ts assumes string[] format when iterating over cached models, but manually-populated caches (like Ollama) use object[] 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)

// Before (line 196)
for (const modelId of modelIds) {
  modelSet.add(`${providerId}/${modelId}`)  // ❌ Breaks with objects
}

// After
for (const modelItem of modelIds) {
  const modelId = typeof modelItem === 'string' 
    ? modelItem 
    : (modelItem as any)?.id  // ✅ Handles both formats
  
  if (modelId) {
    modelSet.add(`${providerId}/${modelId}`)
  }
}

Type Safety (connected-providers-cache.ts)

interface ProviderModelsCache {
  models: Record<string, string[] | ModelMetadata[]>  // Now accepts both
  connected: string[]
  updatedAt: string
}

Test Coverage (model-availability.test.ts)

Added 4 test cases:

  • ✅ Handle object[] format with metadata (Ollama-style)
  • ✅ Handle mixed string[] and object[] across providers
  • ✅ Skip invalid entries gracefully
  • ✅ Backward compatibility with legacy string[] format

Testing

npm test -- src/shared/model-availability.test.ts
# ✅ 48 pass (including 4 new tests)

npm run typecheck
# ✅ No errors

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:

  • Fixes [Bug]: Category delegation fails to resolve Ollama models despite correct configuration #1508
  • Complements PR docs: add Ollama streaming NDJSON issue guide and workaround #1197 (NDJSON streaming fix)

Backward Compatibility

✅ Fully backward compatible - handles both legacy string[] and new object[] 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.

  • Bug Fixes
    • Parse both string[] and object[] when building available models; skip invalid entries.
    • Updated ProviderModelsCache types and added tests for object[], mixed formats, and legacy compatibility.

Written for commit bd3a3bc. Summary will update on new commits.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rooftop-Owl
fix: handle both string[] and object[] formats in provider-models cache
bd3a3bc
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
cubic-dev-ai[bot]
cubic-dev-ai Bot reviewed Feb 5, 2026
View reviewed changes

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Feb 5, 2026
Local Ollama models not included in model listing, breaking plugin model discovery anomalyco/opencode#12243
Closed
[Bug]: Category delegation fails to resolve Ollama models despite correct configuration #1508
Closed
@code-yeongyu
code-yeongyu merged commit 617d7f4 into code-yeongyu:dev Feb 5, 2026
6 of 7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cubic-dev-ai cubic-dev-ai[bot] cubic-dev-ai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Category delegation fails to resolve Ollama models despite correct configuration

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rooftop-Owl @code-yeongyu
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.