Skip to content

fix(command-code): surface reasoning-only output as content when no text-delta (#10986) - #11063

Merged
diegosouzapw merged 1 commit into
release/v3.8.50from
fix/10986-command-code-reasoning-content
Aug 21, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.50from
fix/10986-command-code-reasoning-content

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #10986

Root cause

Command Code's /alpha/generate executor (open-sse/executors/commandCode.ts) aggregates only text-delta events into message.content. When a model (e.g. meta/muse-spark-1.2-contributor) emits its whole answer as reasoning-delta events and never a text-delta, state.content stays "" and the client gets a useless/empty content field with HTTP 200 — even though a real answer exists in reasoning_content. The report's metrics (Total Out: 64 / Reasoning: 61) match exactly.

Both createJsonResponse and createStreamResponse had the gap. The combo-routing validator (open-sse/services/combo/validateQuality.ts, from #2341/#3587) already defends this shape for combo-routed requests, but a direct single-model request bypasses it entirely.

Fix

Scoped to the executor (surgical, HR#18): when state.content is empty AND state.reasoning is non-empty AND there are no tool calls (the exact detection #3587 uses), fall back message.content to the reasoning text. reasoning_content stays populated for reasoning-aware clients. Behavior for the common text-delta case is unchanged (existing test text-delta + reasoning-delta mixed passes unmodified).

  • createJsonResponse: content fallback on the assembled message.
  • createStreamResponse: track whether any content delta was emitted; emit one synthetic content delta from the reasoning buffer at finish (and at stream-end) when none was sent.

Regression test (TDD, proved RED then GREEN)

tests/unit/command-code-executor.test.ts — 2 new cases (non-stream JSON + SSE-stream), added after a standalone probe confirmed RED (expected message.content to carry usable text, got: ""). Full file: 22/22 pass.

Gates

⚠️ base-red inherited: #9985 — src/lib/modelCapabilities.ts file-size drift (1072 > 1016 frozen) is pre-existing on the base tip (git show origin/release/v3.8.50 = 1071), not touched by this diff.

@diegosouzapw
diegosouzapw merged commit a928fad into release/v3.8.50 Aug 21, 2026
16 of 22 checks passed
@diegosouzapw
diegosouzapw deleted the fix/10986-command-code-reasoning-content branch August 23, 2026 21:45
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ext-delta (diegosouzapw#10986) (diegosouzapw#11063)

⭐5 — Fix do dono com TDD. Estado committed+pushed limpo (hold-vivo cedido por instrução direta do operador).
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.

[BUG] OpenAI API returns null content when model output consists of reasoning tokens (e.g. command-code/meta/muse-spark-1.2-contributor)

2 participants