fix(cli): honor custom_providers in preflight shrink warning

Classic /model confirmation already threaded custom_providers into the
context display, but the shrink-warning path did not. Probe-down then
matched the hardcoded "qwen" catalog (131072) and falsely warned that a
1M custom endpoint had shrunk — while the status bar still showed 1M.

Pass the same fresh inventory list used by switch_model/TUI (with
agent-snapshot fallback), and fall back to agent._custom_providers inside
merge_preflight_compression_warning when the kwarg is omitted.
This commit is contained in:
HexLab98
2026-07-23 08:10:35 +07:00
committed by Teknium
parent b0b7f15598
commit c428e725aa
2 changed files with 34 additions and 5 deletions
+7
View File
@@ -83,6 +83,13 @@ def merge_preflight_compression_warning(
if cc is None:
return
# Classic CLI historically omitted custom_providers here while the /model
# confirmation display threaded agent._custom_providers — so the shrink
# warning fell through to the hardcoded catalog (e.g. "qwen" → 131072)
# even when custom_providers[].models.<id>.context_length was 1M.
if custom_providers is None:
custom_providers = getattr(agent, "_custom_providers", None)
old_ctx = int(getattr(cc, "context_length", 0) or 0)
new_ctx = resolve_display_context_length(
result.new_model,