Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jun 22, 2025

Description

This PR fixes a Zod validation error that occurs when Ollama returns null for the families field in model details.

Changes

  • Made the families field nullable and optional in OllamaModelDetailsSchema
  • Marked all unused properties as optional in Ollama schemas to prevent future validation errors
  • Only properties that are actually used in the code remain as required fields
  • Added comprehensive test cases to verify handling of null values

Properties marked as optional:

OllamaModelDetailsSchema:

  • families (nullable and optional)
  • format
  • parent_model
  • quantization_level

OllamaModelSchema:

  • digest
  • modified_at
  • size

OllamaModelInfoResponseSchema:

  • modelfile
  • parameters
  • template

Testing

  • Added test case for models with null families field
  • Added integration test to verify API response parsing with null values
  • All existing tests continue to pass

Related Issues

Fixes #5013


Important

Fixes Zod validation error by marking unused Ollama schema properties as optional and adding tests for null handling.

  • Schema Changes:
    • families field in OllamaModelDetailsSchema is now nullable and optional.
    • Marked unused properties as optional in OllamaModelDetailsSchema, OllamaModelSchema, and OllamaModelInfoResponseSchema.
  • Testing:
    • Added test case in ollama.test.ts for models with null families field.
    • Added integration test for API response parsing with null values.
  • Behavior:
    • Only required properties are those used in the code, reducing validation errors.

This description was created by Ellipsis for 0400f56. You can customize this summary. It will automatically update as commits are pushed.

- Updated OllamaModelDetailsSchema to make families field nullable and optional
- Made all unused properties optional in Ollama schemas to prevent validation errors
- Added test cases to verify handling of null families field
- Only required properties that are actually used in the code are now mandatory
- Fixes Zod validation error when Ollama returns null for families array
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners June 22, 2025 14:27
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jun 22, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Jun 22, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 22, 2025
@mrubens mrubens merged commit 02a4823 into main Jun 22, 2025
25 checks passed
@mrubens mrubens deleted the fix/ollama-families-null-handling branch June 22, 2025 14:55
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 22, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 22, 2025
cte pushed a commit that referenced this pull request Jun 24, 2025
fix: handle null families field in Ollama model details schema

- Updated OllamaModelDetailsSchema to make families field nullable and optional
- Made all unused properties optional in Ollama schemas to prevent validation errors
- Added test cases to verify handling of null families field
- Only required properties that are actually used in the code are now mandatory
- Fixes Zod validation error when Ollama returns null for families array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Ollama provider compatibility broken

4 participants