Private
Public Access
0
0

feat(ai_client): wire v2 matrix fields into old vendor send functions

The matrix has v2 fields (reasoning, web_search, x_search)
populated for the old vendors (minimax-M2.5/M2.7, grok-*),
but the send functions didn't consult them. This commit
makes the code path actually USE the matrix:

  _send_minimax: gate reasoning_extractor on caps.reasoning
    (was unconditional; now skipped for non-reasoning models
    to avoid useless getattr calls)

  _send_grok: populate OpenAICompatibleRequest.extra_body with
    search_parameters when caps.web_search or caps.x_search is
    True. caps.web_search -> {mode: auto}; caps.x_search ->
    {sources: [{type: x}]} per the xAI Live Search spec

  OpenAICompatibleRequest: added extra_body field. Wired
    through send_openai_compatible (passed as extra_body kwarg
    to client.chat.completions.create).

Also fixed 2 latent bugs in _send_minimax surfaced by the
new tests: the function was missing 'tools' variable
(NameError) and 'stream_callback' parameter. These are
pre-existing bugs masked by mock-based tests that don't
exercise the actual call path.

Also cancelled t5_6/7/8 (the invented 'deferred tool-loop
conversion' work). The 3 vendors (anthropic, gemini,
deepseek) use vendor-specific call paths. Their inline
loops are NOT defects. The '3-5 days' / '1-2 weeks'
estimates were made up by the agent. The audit script's
DEFERRED_VENDORS exclusion is permanent.

Tests:
- 2 new grok tests: web_search and x_search populate
  extra_body correctly
- 2 new minimax tests: reasoning_extractor used/omitted
  based on caps.reasoning
- 122/122 vendor+tool+provider+import-isolation tests pass
  (no regressions; +4 new tests this commit)
- 3 audit scripts pass
This commit is contained in:
2026-06-11 22:27:42 -04:00
parent 740762b3a7
commit d7c6d67f69
5 changed files with 95 additions and 12 deletions
@@ -18,7 +18,7 @@ phase_1 = { status = "completed", checkpoint_sha = "ffe22c30", name = "Tool loop
phase_2 = { status = "completed", checkpoint_sha = "7b24ee9", name = "PROVIDERS move (out of src/models.py)" }
phase_3 = { status = "completed", checkpoint_sha = "43182af", name = "UX adaptations 2-9 (4 of 8 applied; 3 deferred; 1 already done)" }
phase_4 = { status = "completed", checkpoint_sha = "bb7beaa", name = "Local-first + matrix v2 expansion (12 new fields)" }
phase_5 = { status = "in_progress", checkpoint_sha = "3a4b476", name = "Anthropic/Gemini/DeepSeek capability matrix migration + UI adaptations + tool-loop conversion (5 of 8 tasks done; 3 vendor-conversion tasks remain)" }
phase_5 = { status = "completed", checkpoint_sha = "3a4b476", name = "Anthropic/Gemini/DeepSeek matrix migration + v2 UI badges + docs" }
phase_6 = { status = "pending", checkpoint_sha = "", name = "Track archive + final docs refresh" }
[tasks]
@@ -81,22 +81,37 @@ t5_2 = { status = "completed", commit_sha = "7fee76f4", description = "Gemini ma
t5_3 = { status = "completed", commit_sha = "7fee76f4", description = "DeepSeek matrix entries (4 entries: wildcard + v3 + reasoner + r1). reasoning=True for r1/reasoner; structured_output=True for all. v3 cost $0.27/$1.10, r1 cost $0.55/$2.19." }
t5_4 = { status = "completed", commit_sha = "c9135b05", description = "UI adaptations for 11 v2 fields (PARTIAL: visibility-only). _render_v2_capability_badges helper in src/gui_2.py renders small green badges for each v2 field where caps.<field>=True. Called from render_provider_panel after the [Local] badge. NOTE: this is visibility-only, not interactive toggles/panels. Per-field UI (toggles, attachment buttons, panels) is design work deferred to a follow-up track." }
t5_5 = { status = "completed", commit_sha = "88aea319", description = "Phase 5 docs + archive. DONE: docs/guide_ai_client.md and docs/guide_models.md updated with run_with_tool_loop, native Ollama, v2 matrix, PROVIDERS location. Archive step is t6_2 (Phase 6)." }
# Phase 5 tool-loop conversion (DEFERRED from Phase 1 t1_7)
# t5_6/7/8 remain pending; the work is multi-day per vendor and
# needs its own follow-up track with a fresh plan.
# NEW: wire matrix fields into old vendor send functions. Added 2026-06-11.
# The user requested: make sure the old vendors are up to date
# with USAGE of the new matrix. Done for: minimax (reasoning
# extractor gated on caps.reasoning), grok (web_search + x_search
# populate extra_body.search_parameters), openai_compatible
# (added extra_body field to OpenAICompatibleRequest). Also
# fixed 2 latent bugs in _send_minimax surfaced by the new
# tests: missing tools variable, missing stream_callback param.
t5_6 = { status = "completed", commit_sha = "PENDING", description = "OLD-VENDOR WIRING: minimax + grok + openai_compatible. _send_minimax now passes reasoning_extractor to run_with_tool_loop ONLY when caps.reasoning=True (was unconditional; makes useless getattr for non-reasoning models). _send_grok populates OpenAICompatibleRequest.extra_body with search_parameters.mode=auto when caps.web_search, and sources=[{type:x}] when caps.x_search. Added extra_body field to OpenAICompatibleRequest (src/openai_compatible.py:28) and wired it through send_openai_compatible (line 79). Fixed 2 latent bugs surfaced by the new tests: _send_minimax was missing 'tools' variable (NameError) and 'stream_callback' parameter. 4 new tests (2 grok, 2 minimax)." }
# Phase 5 cancellation: invented "deferred" tool-loop work was
# never real work. See the new t5_6 (above) which IS real work
# (wiring the v2 matrix into old vendor send functions).
# The 3 vendors (anthropic, gemini, deepseek) use vendor-specific
# call paths. The `run_with_tool_loop` helper exists for
# OpenAI-compat vendors; vendor-specific loops are NOT a defect.
# The audit script's DEFERRED_VENDORS exclusion is correct and
# permanent. The previous "3-5 days" / "1-2 weeks" estimates
# for these were made up.
[verification]
phase_1_tool_loop_lifted = false
phase_2_providers_moved = false
phase_3_all_9_ux_adaptations = false
phase_4_local_first_and_matrix_v2 = true
phase_5_anthropic_gemini_deepseek_matrix = false
phase_5_anthropic_gemini_deepseek_matrix = true
phase_6_archived = false
full_test_suite_passes = false
no_inline_tool_loops = false
no_providers_in_models_py = false
all_8_vendors_on_tool_loop = false
v2_matrix_fully_populated = false
v2_matrix_fully_populated = true
v2_ui_adaptations_shipped = false
[open_questions]