Skip to content

fix(config): respect PR_AF_MODEL across all tiers; default to kimi-k2.5#18

Merged
AbirAbbas merged 1 commit into
mainfrom
fix/respect-user-model-config
May 5, 2026
Merged

fix(config): respect PR_AF_MODEL across all tiers; default to kimi-k2.5#18
AbirAbbas merged 1 commit into
mainfrom
fix/respect-user-model-config

Conversation

@AbirAbbas
Copy link
Copy Markdown
Contributor

Summary

Fixes a silent override where setting PR_AF_MODEL did not propagate to the budget tier (intake_gate / coverage_gate / dedup_gate), and cleans up stale defaults that pointed at minimax / gemini.

The leak (real silent override of user intent)

In _default_tier_map("opencode"), mid and premium tiers correctly fell back to ai_model (which honors PR_AF_MODELAI_MODELPR_AF_AI_MODEL), but budget was hardcoded to openrouter/google/gemini-2.5-flash. Setting PR_AF_MODEL=openrouter/moonshotai/kimi-k2.5 left the budget-tier gates running on gemini with no warning. Now budget falls back to ai_model like the other tiers, so a single PR_AF_MODEL env var actually applies everywhere.

PR_AF_MODEL_BUDGET still works for callers who want to keep gates cheap.

Default cleanup

  • AIIntegrationConfig.harness_model: minimax/minimax-m2.5openrouter/moonshotai/kimi-k2.5
  • AIIntegrationConfig.ai_model: minimax/minimax-m2.5openrouter/moonshotai/kimi-k2.5
  • _default_tier_map ai_model fallback: openrouter/google/gemini-2.5-flashopenrouter/moonshotai/kimi-k2.5
  • .env.example: updated documented examples + added a note that PR_AF_MODEL covers all tiers unless overridden per-tier.

Out of scope

  • The claude-code provider tier map (haiku / sonnet / opus) is left as-is — those identifiers are required by the Claude Agent SDK, not a configurable preference.
  • All router.app.harness(..., model=model or None) and router.app.ai(..., model=...) call sites already thread the user's model through correctly; no changes needed there.

Test plan

  • With no env vars set, confirm AIIntegrationConfig().harness_model == "openrouter/moonshotai/kimi-k2.5"
  • With PR_AF_MODEL=openrouter/moonshotai/kimi-k2.5, confirm _default_tier_map() returns kimi for budget/mid/premium
  • With PR_AF_MODEL_BUDGET=openrouter/google/gemini-2.5-flash and PR_AF_MODEL=openrouter/moonshotai/kimi-k2.5, confirm budget=gemini and mid/premium=kimi (per-tier override still wins)
  • Run a real PR review on Railway and confirm Kimi shows up in logs across intake/coverage gates (previously gemini)

🤖 Generated with Claude Code

The `_default_tier_map("opencode")` function previously hardcoded the
budget tier to gemini-2.5-flash, ignoring PR_AF_MODEL even though the
mid and premium tiers honored it. This caused the intake_gate,
coverage_gate, and dedup_gate to silently run on gemini when callers
expected their PR_AF_MODEL setting to apply everywhere. Budget now
falls back to ai_model like the other tiers; PR_AF_MODEL_BUDGET
remains available for callers who want to keep gates on a cheaper
model.

Also updates the stale fallback defaults (minimax-m2.5 / gemini-2.5-flash)
to openrouter/moonshotai/kimi-k2.5, matching the docker-compose env
override and what deployments actually use. .env.example documents
the new defaults and notes that PR_AF_MODEL covers all tiers unless
individually overridden.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AbirAbbas AbirAbbas merged commit 743f078 into main May 5, 2026
2 checks passed
@AbirAbbas AbirAbbas deleted the fix/respect-user-model-config branch May 5, 2026 20:09
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