Skip to content

fix(model): route chat_optimizer through minimax_chat (not just chat_target)#116

Merged
Yif-Yang merged 1 commit into
microsoft:mainfrom
jcforever1:fix/minimax-chat-optimizer-dispatch
Jul 12, 2026
Merged

fix(model): route chat_optimizer through minimax_chat (not just chat_target)#116
Yif-Yang merged 1 commit into
microsoft:mainfrom
jcforever1:fix/minimax-chat-optimizer-dispatch

Conversation

@jcforever1

Copy link
Copy Markdown
Contributor

Summary

Two missing pieces in the minimax_chat dispatch chain prevented the optimizer side of any SkillOpt training run from working when optimizer_backend='minimax_chat':

  1. minimax_backend.py did not define chat_optimizer — only chat_target / chat_target_messages existed. Any caller using optimizer_backend='minimax_chat' would hit AttributeError or silently fall through to the Azure path.
  2. skillopt/model/__init__.py chat_optimizer and chat_optimizer_messages dispatchers checked claude_chat and qwen_chat but NOT minimax_chat, so minimax users would silently fall through to _openai.chat_optimizer (Azure) which fails with "Azure OpenAI endpoint is not configured for optimizer." for any user without AZURE_OPENAI_* env vars.

Symptoms before the fix

  • Train log repeatedly shows [skip] no usable patches — skill unchanged and total tokens: N (calls=6) — only the target side ran, optimizer was bypassed
  • Final summary reports accept=0 reject=0 skip=N regardless of baseline quality, even when baseline is 0% and edits would clearly help
  • Affects any user running minimax_chat (or any non-OpenAI/Azure backend that wraps claude-agent-sdk-style chat) as the optimizer — silently produces no training improvement

What this PR changes

  • Adds chat_optimizer function to minimax_backend.py (mirrors chat_target via _chat_messages_impl)
  • Adds minimax_chat branches to both chat_optimizer and chat_optimizer_messages dispatchers in skillopt/model/__init__.py

Verification

Local 1-epoch training on a 4-item SearchQA-format dataset went from [skip] no usable patches — skill unchanged (baseline 0.5, optimizer bypassed) to accept_new_best with success_patches=1 per step and the skill expanding from 451 chars to 951 chars. Total LLM calls went from 6 (target-only) to 12 (target + optimizer), confirming both sides of the pipeline now run.

Motivation

The skillopt 0.2.0 release notes list "Multi-backend support (OpenAI / Azure / Claude / Qwen / MiniMax)" — but on MiniMax the optimizer side was never actually wired. Anyone who picked minimax_chat based on that list would hit the bug. This was confirmed during a parallel-training bench run on macOS with ANTHROPIC_AUTH_TOKEN routed to MiniMax's anthropic-compat proxy.

Backwards compatibility

  • Pure addition (new function + 2 new dispatcher branches); no existing behavior changes
  • Existing claude_chat / qwen_chat / openai_chat callers unaffected

Test plan

  • Verify skillopt-train runs end-to-end with optimizer_backend=minimax_chat
  • Verify skillopt-sleep run works in the same backend (uses chat_target, already worked)
  • Run existing searchqa smoke test and confirm success_patches > 0 instead of [skip] no usable patches

…target)

Two missing pieces in the minimax_chat dispatch chain:

1. minimax_backend.py did not define chat_optimizer or chat_optimizer_messages;
   only chat_target / chat_target_messages existed. Any caller using
   optimizer_backend='minimax_chat' would hit AttributeError or fall through
   to _openai (Azure).

2. skillopt/model/__init__.py's chat_optimizer and chat_optimizer_messages
   dispatchers checked claude_chat and qwen_chat but not minimax_chat,
   so minimax_chat callers would silently fall through to _openai.chat_optimizer
   (the Azure path), which fails with 'Azure OpenAI endpoint is not configured'
   on any setup without AZURE_OPENAI_* env vars.

Adds chat_optimizer to minimax_backend.py (mirrors chat_target via
_chat_messages_impl) and minimax_chat branches to both
chat_optimizer / chat_optimizer_messages dispatchers.

Verified locally: 1-epoch training on a 4-item SearchQA-format dataset
went from '[skip] no usable patches — skill unchanged' (baseline fallback)
to a successful accept_new_best with success_patches=1 per step.

Co-authored-by: jc <jc@users.noreply.github.com>
@Yif-Yang Yif-Yang merged commit 19d98ea into microsoft:main Jul 12, 2026
1 check was pending
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.

2 participants