fix: guard cursor-acp/copilot-acp before config lookup, fall through on all-invalid list

Addresses Greptile review feedback on PR #5313:
1. Move cursor-acp/copilot-acp guard before step 0 so a stray config
   entry can't surface unsupported effort options for those providers.
2. Only short-circuit when the filtered list is non-empty; an all-invalid
   list (e.g. typos) falls through to heuristics instead of hiding
   reasoning support from the UI.
This commit is contained in:
Charles Inglis 2026-06-30 23:27:56 -05:00
parent 26fb3745f9
commit b80ea016b1

View file

@ -3340,10 +3340,17 @@ def resolve_model_reasoning_efforts(
provider = _resolve_provider_alias(provider)
# IDE-copilot providers never expose reasoning effort options.
# Guard early so a stray config entry can't override this.
if provider in {"cursor-acp", "copilot-acp"}:
return []
# 0. Provider config: providers.<name>.reasoning_efforts
# When the user has explicitly listed valid efforts for a provider,
# return that list directly — no heuristics, no models.dev lookup.
# Handles both custom:<name> and bare registered provider names (e.g. wandb).
# Only short-circuits when the filtered list is non-empty; an all-invalid
# list (e.g. typos) falls through to heuristics instead of hiding reasoning.
_prov_name = None
if provider and provider.startswith("custom:"):
_prov_name = provider.split(":", 1)[1]
@ -3362,9 +3369,6 @@ def resolve_model_reasoning_efforts(
except Exception:
pass
if provider in {"cursor-acp", "copilot-acp"}:
return []
hinted_model = _strip_provider_hint_for_reasoning(model)
if _nested_route_reasoning_denied(hinted_model):