Skip to content

fix(agents): skip Ollama discovery when explicit models are configured#28827

Merged
vincentkoc merged 10 commits intoopenclaw:mainfrom
Kansodata:kansodata/fix-pr28793-ollama-types
Feb 28, 2026
Merged

fix(agents): skip Ollama discovery when explicit models are configured#28827
vincentkoc merged 10 commits intoopenclaw:mainfrom
Kansodata:kansodata/fix-pr28793-ollama-types

Conversation

@Kansodata
Copy link
Copy Markdown
Contributor

@Kansodata Kansodata commented Feb 27, 2026

Summary

Why

Current main still calls buildOllamaProvider -> discoverOllamaModels during implicit provider resolution even when explicit Ollama models are already configured. That can add avoidable startup delay/timeouts for remote Ollama hosts.

Changes

  • src/agents/models-config.providers.ts
    • Detect explicit non-empty models.providers.ollama.models.
    • In that case, build provider from explicit config and skip discovery.
    • Preserve explicit apiKey when env/profile key is not available.
    • Keep existing discovery path and warning behavior for non-explicit-model cases.
  • src/agents/models-config.providers.ollama.test.ts
    • Covers explicit-model skip behavior.
    • Asserts fetch is not called in explicit-model mode.
    • Asserts explicit apiKey is preserved when skip-discovery is used.

Validation

  • pnpm vitest run src/agents/models-config.providers.ollama-autodiscovery.test.ts src/agents/models-config.providers.ollama.test.ts
  • pnpm check

Credit

Related

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 27, 2026

Greptile Summary

This PR fixes a TypeScript type error in the Ollama provider test that was breaking pnpm check. The fix adds an explicit type assertion as Array<"text" | "image"> to the input field in the test's explicitModels array, narrowing the type from the inferred string[] to the expected union type defined in ModelDefinitionConfig.

  • Fixed type error by adding explicit type assertion to input field in test
  • Added import for ModelDefinitionConfig type
  • CHANGELOG entry appropriately documents the user-facing fix (skipping discovery for explicit models)

Confidence Score: 5/5

  • This PR is safe to merge - it's a minimal, targeted fix for a TypeScript type error in a test file
  • The change is straightforward and correct: adds a type assertion to fix a TypeScript compilation error. The test properly validates the new skip-discovery behavior, and the CHANGELOG entry is appropriate. No logic changes or potential runtime issues.
  • No files require special attention

Last reviewed commit: 7761a08

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7761a08a99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/models-config.providers.ts Outdated
@Kansodata
Copy link
Copy Markdown
Contributor Author

Status follow-up by @Kansodata:

  • Merge state: UNSTABLE
  • Failing checks: none
  • Pending checks:
    • checks-windows (node, test, 1, 2, pnpm canvas:a2ui:bundle && pnpm test)
    • checks-windows (node, test, 2, 2, pnpm canvas:a2ui:bundle && pnpm test)
    • checks-windows (node, protocol, 0, 1, pnpm protocol:check)

I can take the next fix pass to move this to green without conflicts.

Copy link
Copy Markdown

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

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

Correct type fix. Aligns the test typing with ModelDefinitionConfig. Needed for #28793 to pass CI.

@Kansodata
Copy link
Copy Markdown
Contributor Author

Addressed in 1a4b1befc.

Fix applied:

  • preserve api: "ollama" when explicit Ollama models are configured and provider-level api is omitted
  • keep explicit models path (skip discovery) without regressing native Ollama routing
  • add regression test: should default api to ollama when explicit models omit provider api

Validation:

  • pnpm vitest run src/agents/models-config.providers.ollama.test.ts (pass)

@Kansodata Kansodata force-pushed the kansodata/fix-pr28793-ollama-types branch from 1a4b1be to af9fa90 Compare February 28, 2026 16:43
@vincentkoc vincentkoc force-pushed the kansodata/fix-pr28793-ollama-types branch from af9fa90 to a5da297 Compare February 28, 2026 17:08
@vincentkoc vincentkoc changed the title test(ollama): fix explicit model input typing in provider test fix(agents): skip Ollama discovery when explicit models are configured Feb 28, 2026
@vincentkoc vincentkoc force-pushed the kansodata/fix-pr28793-ollama-types branch from ec70987 to 9cf7d68 Compare February 28, 2026 17:22
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Feb 28, 2026
@vincentkoc
Copy link
Copy Markdown
Member

@Kansodata stop touching the PR im finalizing to merge

@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Feb 28, 2026
@vincentkoc vincentkoc merged commit 62179c8 into openclaw:main Feb 28, 2026
3 checks passed
nsd97 pushed a commit to nsd97/openclaw that referenced this pull request Feb 28, 2026
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ollama model discovery always runs at startup even when explicit models are configured, causing 5s timeout for remote Ollama hosts

4 participants