fix(agent): recover inline reasoning stripped by the think scrubber - #90417
SayHell0W0rld wants to merge 2 commits into
Conversation
|
Providers that inline reasoning (MiniMax-M3 streams <think>…</think> in content) never send a reasoning delta, so the desktop reasoning pane stays dead even though the reasoning happened (NousResearch#89647). StreamingThinkScrubber (NousResearch#17924) already strips inline blocks from streamed content but discarded the text. It now collects the stripped text (reasoning() accessor, tag markup removed), and _relay_final_response populates reasoning_content from the scrubber when the provider returned no reasoning delta.
…d request A credential marked exhausted by a transient rate-limit/billing wall stays exhausted even after the wall lifts and kernel-mediated requests succeed again (issue NousResearch#95166, gap 2). Add _mark_healthy() (symmetric to _mark_exhausted) and call it from _relay_final_response — the unified success exit for chat-completions mode — so pool readers don't see a stale exhausted verdict. 3 regression tests; 62/62 file pass; ruff + Windows footgun lint clean.
247d649 to
45c8d37
Compare
|
Requesting review — this PR is a small, self-contained fix with passing tests (full file green, ruff/footgun clean). Happy to address any feedback. |
Summary
Fixes #89647: providers that inline reasoning (MiniMax-M3 streams
<think>…</think>inside content) never send areasoning_contentdelta, so the desktop reasoning pane stays dead even though reasoning happened.Approach
StreamingThinkScrubber(agent/think_scrubber.py, [Bug] MiniMax reasoning content leaks to CLI output even with reasoning_effort: none #17924) already strips inline think blocks from streamed content but discarded the text. It now collects the stripped text (block content, closed pairs, end-of-stream tail) with areasoning()accessor that removes tag markup._relay_final_response(agent/chat_completion_helpers.py) populatesreasoning_contentfrom the scrubber when the provider returned no reasoning delta.Relation to #43827 / #43836
<think>blocks are already suppressed from visible output by the scrubber ([Bug] MiniMax reasoning content leaks to CLI output even with reasoning_effort: none #17924) — this PR recovers them intoreasoning_contentso the desktop reasoning pane populates.Test Plan
TestReasoningCollection(tests/agent/test_think_scrubber.py): split block across deltas / closed pair in one delta / no-reasoning empty / tag markup stripped / reset clears.ruff checkclean.Risk / Exclusions
References #89647
Update (2026-08-29): This PR now also carries the credential-pool heal fix (formerly #95351, closed). Both changes edit
_relay_final_response's success path, so they were merged into one branch to avoid a merge conflict between overlapping edits of the same function:last_statusafter a successful served request (xai-oauth: usage/limits visibility parity with openai-codex (fetch_usage), and heal credential_pool last_status on served requests #95166)Combined branch:
fix/minimax-reasoning-extraction(2 commits). 87/87 tests pass.