Skip to content

merge /api/ps across every ollama endpoint - #243

Merged
thushan merged 14 commits into
mainfrom
feature/ollama-ps-merge
Oct 27, 2026
Merged

thushan merged 14 commits into
mainfrom
feature/ollama-ps-merge

Conversation

@thushan

@thushan thushan commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Depends on #240. Merge that first.

Review as a unit or squash: 9c52f53 does not pass make ready on its own (lint); the final cc70454 does.

Summary

/olla/ollama/api/ps was forwarded to one arbitrary instance, so with several Ollama endpoints it reported a fraction of what was loaded.

The new handler_provider_ollama_ps.go queries every healthy Ollama endpoint and merges the models arrays. Entries are kept per host with an added olla_endpoint field. Failing endpoints are skipped and flagged with X-Olla-Partial (exposed to browsers in middleware/cors.go); all-failing is a 502 and no endpoints is an empty array. Each endpoint is queried with its own credentials only, through a pooled client that ignores HTTP_PROXY and refuses cross-host redirects. The URL is built with the proxy's path rules, so preserve_path is honoured. One response is capped at 4 MiB, the route is rate limited, and the failure WARN is sampled via reject_logs.go. /olla/proxy/api/ps is unchanged.

Also in server_routes.go:

  • POST /olla/ollama/api/blobs/{digest} returns 501 like the other model-management routes, which are now labelled ANY.
  • The made-up /olla/ollama/api/list stub is removed. Requests to it now reach the backend and get Ollama's own 404.

This branch also carries #240's profile path declarations, which /api/ps and /api/version need.

Type of change

  • Bug fix
  • Behaviour change (/api/list removed)
  • Documentation

How was this tested?

New tests in handler_provider_ollama_ps_test.go:

  • TestOllamaRunningModels_MergesPerInstance, _SkipsFailingInstances, _TimeoutDoesNotHoldTheAnswer, _AllFailingIs502_NoInstancesIsEmpty
  • TestOllamaRunningModels_SendsEndpointAuthAndRefusesRedirects, _CredentialsStayPerEndpoint, _RejectsOtherMethods
  • TestOllamaRunningModels_ShapeMatchesOllamaPlusTag, _EmptyResultsStayAnEmptyArray, _NoGoroutineLeak, _FailureWarnIsSampled
  • TestOllamaPSClient_PooledAndNeverProxied, TestOllamaPS_RouteIsRateLimited, TestFetchOllamaPS_BodyCap, TestFetchOllamaPS_HonoursPreservePath
  • TestRegisterProviderRoutes_OllamaPSAggregatedAndNoAPIList, TestRegisterProviderRoutes_OllamaModelManagementIs501AndLabelledANY, TestStaticProviders_OllamaRoutes

Tested together with the other October follow-up branches on a local integration branch at 0c25e0a:

  • make ready and make test-race pass at 0c25e0a
  • /olla-validate --quick: 42 pass, 0 fail (warnings and skips are nightly-only items)
  • tei-routing validation area: Section A 12/12, Section B B1 to B6 pass
  • /test-sticky-sessions: no new failures (the 7 provider-route 404s are the known shared-mock-URL limitation)
  • /claude-code-e2e against real Ollama: Tier A 16/0 on both the passthrough and translation legs, same as main
  • curl checks per feature against real Ollama and ollamock; log scan shows no panics, races or per-request WARN floods

Checklist

  • make ready passes at cc70454
  • Tests added or updated for the change
  • Documentation updated: docs/content/api-reference/ollama.md, docs/content/integrations/backend/ollama.md, v0.0.30 release note (notes the api/list removal)
  • No new dependencies added

@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between e8ef6af and cc70454.

Files selected for processing: 27
  • config/profiles/dmr.yaml
  • config/profiles/lemonade.yaml
  • config/profiles/litellm.yaml
  • config/profiles/llamacpp.yaml
  • config/profiles/lmdeploy.yaml
  • config/profiles/lmstudio.yaml
  • config/profiles/ollama.yaml
  • config/profiles/openai-compatible.yaml
  • config/profiles/sglang.yaml
  • config/profiles/vllm-mlx.yaml
  • config/profiles/vllm.yaml
  • docs/content/about/release-notes.md
  • docs/content/api-reference/ollama.md
  • docs/content/concepts/profile-system.md
  • docs/content/integrations/backend/ollama.md
  • internal/adapter/inspector/path_inspector_test.go
  • internal/adapter/registry/profile/loader.go
  • internal/app/handlers/handler_provider_ollama.go
  • internal/app/handlers/handler_provider_ollama_ps.go
  • internal/app/handlers/handler_provider_ollama_ps_test.go
  • internal/app/handlers/handler_proxy_profile_paths_test.go
  • internal/app/handlers/handler_translation.go
  • internal/app/handlers/reject_logs.go
  • internal/app/handlers/server_routes.go
  • internal/app/middleware/cors.go
  • internal/app/middleware/cors_test.go
  • internal/core/constants/content.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thushan
thushan merged commit 264d8c4 into main Oct 27, 2026
6 checks passed
@thushan
thushan deleted the feature/ollama-ps-merge branch October 27, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant