Repository navigation
Description
What happened
On the openai-chat wire protocol, Maka drops every prior assistant turn's reasoning before building the next request. The model re-derives its own earlier reasoning on each step from tool output alone.
DeepSeek's Thinking Mode contract requires the opposite: when a request carries tools, reasoning_content from intermediate assistant turns must be passed back in all subsequent requests, otherwise the API returns 400 "The reasoning_content in the thinking mode must be passed back to the API." A relay currently absorbs the error for us, so the violation surfaces as silent performance loss rather than a failure.
The round-trip machinery already exists — packages/runtime/src/kimi-openai-transport.ts handles both reasoning_content and reasoning field names, empty-reasoning restoration, and per-chunk recovery. It is gated on a provider name rather than on the protocol.
How to reproduce
- Configure any
openai-chatconnection whose model emitsreasoning_content(e.g. DeepSeek V4 Flash through an OpenAI-compatible relay). - Run a multi-step headless task so the model performs at least three tool calls.
- Inspect the outgoing request projection on step 3+: no prior assistant
reasoning_contentis present. - Observe reasoning tokens per request climbing monotonically as history grows.
Environment
- Maka commit:
17367dcaf - Surface: Headless (Harbor AI SDK path) — also affects Desktop and CLI on the same protocol
- OS: macOS 25.5.0
Logs, screenshots, or additional context
| Fact | Location |
|---|---|
| Three parallel one-off replay flags; DeepSeek matches none | packages/runtime/src/model-adapter.ts:140-148 |
usesKimiOpenAiChat hard-binds providerType === 'kimi-coding-plan' |
packages/runtime/src/model-adapter.ts:438-443 |
| Round-trip already implemented, Kimi-only | packages/runtime/src/kimi-openai-transport.ts |
Contract requiring the round-trip with tools |
https://api-docs.deepseek.com/guides/thinking_mode/ |
Measured on the Terminal-Bench 2.1 four-arm run (89 tasks, deepseek-v4-flash, effort max), median reasoning tokens per provider request by step bucket:
| step | Maka | Codex |
|---|---|---|
| 0–9 | 53 | ~150 |
| 30–39 | 244 | ~150 |
| 60–69 | 428 | ~150 |
Codex reaches the same model over openai-responses, where reasoning items are replayed with plaintext content. Four Maka cells in that run exhausted their budget outright: write-compressor, largest-eigenval, code-from-image, torch-pipeline-parallelism.
Proposed shape
Promote the Kimi transport into a protocol-level capability selected by the connection's declared thinking support, so unsignedThinking stops meaning "is this Kimi". Same illegal-state-unrepresentable argument as #2026. Related: #2219 asks for manual thinkingOptions on openai-compatible connections and would share the declaration surface. Note #2238 covers the native OpenAI Responses path only and does not touch this one.
Empty reasoning_content must still be sent — guard on presence, not truthiness, or empty strings get stripped and trigger the same 400.
Activity
Astro-Han commentedon Aug 5, 2026
I’m taking this. I’ll first add a durable-runtime replay regression that crosses Maka-owned provider steps, then centralize effective wire resolution so model construction and replay consume the same decision. The fix will generalize plaintext OpenAI Chat reasoning replay (including observed field names and empty reasoning) while leaving the merged Responses continuation transport and existing opaque part-metadata paths unchanged.