Skip to content

feat(selfhost): support per-repo model overrides for ollama/openai/anthropic providers #3902

Description

@JSONbored

Context

The per-repo reviewer model/effort override (review.ai_model in .gittensory.yml, parsed into SelfHostAiModelConfig{claudeModel,claudeEffort,codexModel,codexEffort}) is wired end-to-end only for the two CLI-subscription providers. createClaudeCodeAi/createCodexAi read the override per call, and configuredClaudeModel/configuredCodexModel explicitly prioritize the repo override over the global env var.

createOpenAiCompatibleAi (used for ollama, openai, openai-compatible) and createAnthropicAi bind their model only once at provider-construction time, from env-only lookups (OLLAMA_AI_MODEL/OPENAI_AI_MODEL/OPENAI_COMPATIBLE_AI_MODEL/ANTHROPIC_AI_MODEL) with no per-call override parameter at all. Since docker-compose.yml ships and documents an ollama profile as a first-class self-host deployment path, and the multi-provider chain (AI_PROVIDER=a,b,...) is explicitly designed for operators running many repos with different tuning needs, this is a concrete gap: an operator running Ollama or a BYOK-style OpenAI-compatible/Anthropic HTTP provider across multiple repos has no way to set a stronger/cheaper model per repo the way claude-code/codex operators already can — a review.ai_model entry is silently ignored (no warning) when the active provider isn't claude-code/codex.

Requirements

  • Extend SelfHostAiModelConfig (src/signals/focus-manifest.ts) and AiRunOptions (src/selfhost/ai.ts) with ollamaModel/openaiModel/openaiCompatibleModel/anthropicModel fields (plus matching effort fields where relevant).
  • Thread them through buildProvider() so createOpenAiCompatibleAi/createAnthropicAi read a per-call override the same way the CLI providers already do.
  • Update the review.ai_model YAML parser and self-hosting docs to document the wider field set.

Acceptance criteria

  • A per-repo model override is honored for every configured provider, not just claude-code/codex.
  • Tests cover the override precedence (repo override > global env var) for each new provider field.
  • npm run ui:openapi / .gittensory.yml schema regenerated if the config surface changes shape.

Parent: #1667

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions