Skip to content

fix(ai): preserve final phase across resumed reasoning - #125149

Merged
obviyus merged 13 commits into
mainfrom
fix/interleaved-reasoning-visible-text-v2
Aug 17, 2026
Merged

obviyus merged 13 commits into
mainfrom
fix/interleaved-reasoning-visible-text-v2

Conversation

@obviyus

@obviyus obviyus commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

OpenAI-compatible streams shaped as reasoning -> interim content -> reasoning -> final content left both text segments unphased. Final delivery therefore joined the interim text into the user-visible answer. The failure also occurred with coalesced packets, structured reasoning_details, hidden reasoning, and a trailing reasoning-only suffix.

Root cause

The two OpenAI-completions producers decoded reasoning differently and treated resumed reasoning as another delta without closing the active text lane or retaining a boundary confirmed by later visible text. Packet boundaries accidentally determined text-block shape. The channel layer received ambiguous unphased text and correctly preserved it.

Fix

  • decode top-level and structured reasoning once at the shared OpenAI transport boundary
  • split the active text lane at producer-owned reasoning boundaries
  • retain pending and confirmed interruption boundaries separately
  • tag interrupted text commentary and the confirmed suffix final_answer
  • preserve encrypted tool signatures and compat-configured explicitly visible structured output
  • preserve visible -> thinking -> visible structured-detail order identically in both producers
  • preserve compat-declared visible-detail provenance across split packets
  • record the unresolved phase at the producer and defer live reply delivery until terminal classification
  • classify unresolved text as commentary on error or abort terminals
  • cover both producers, hidden reasoning, coalesced packets, structured content, and trailing reasoning

Supersedes #96969 with a producer-owned fix. Thanks @SymbolStar for the report and reproduction analysis. Addresses #96849.

Proof

  • pre-fix owner test: SDK producer merged structured Interim.Final. into one unphased block
  • exact-head focused suite: 6 requested files, 3 official Vitest shards, 170 tests passed
  • errored interleave parity: both producers retain the interim block only as commentary; subscriber emits no reply
  • broader focused suite before the final decoder-only consolidation: 17 files, 471 tests passed
  • targeted Oxlint, Oxfmt, and git diff --check: passed
  • assertion-safety ratchet: passed; baseline shrank for both touched producers
  • Distill: zero findings on the exact diff
  • Greybeard: zero findings on the exact diff
  • exact-head hosted CI: 179 passed, 50 skipped, 0 failed; production and test typechecks passed
  • unrelated hosted failure: Control UI startup gzip exceeded its budget in build-artifacts; this AI-only diff does not touch ui/ or its assets, and the same failure reproduced across all three proof heads
  • local repo-wide pnpm tsgo: blocked by untouched packages/terminal-core/src/ansi.ts:194 (TS2554); hosted exact-head production and test type checks passed

Exact pushed head: 370f3067dfa71d7b80be1fe4da168bf0e160dc10.

Production delta: +434/-146. Growth centralizes structured reasoning decoding, records pending/confirmed phase boundaries across the two existing producer implementations, retains explicit visible-detail provenance, exposes one allocation-free Markdown parser ownership fact, and carries one terminal-phase delivery fact. No channel/provider-specific guard or compatibility path. Test delta: +553/-6; assertion-safety baseline: +2/-2.

Delivery policy

Phase-ambiguous OpenAI-compatible reasoning streams intentionally use terminal-only user-visible delivery. A transient interim message or edit is the reported bug, not an acceptable streaming state. Ordinary completions without the producer-owned terminal-phase fact retain live partial delivery; compat-declared explicit visible details retain their visible provenance.

Phase-aware delivery contract

The owner regression drives both production producers through:

reasoning_details(A) -> content(INTERIM) -> reasoning_details(B) -> content(FINAL) -> stop

Both now emit thinking A, INTERIM as commentary, thinking B, and FINAL as final_answer. Canonical delivery therefore returns only FINAL. A trailing reasoning-only suffix leaves the last confirmed final boundary intact.

Exact-head redacted trace through processCompletionsStream and the canonical embedded-agent delivery extractor:

{
  "exactHead": "370f3067dfa71d7b80be1fe4da168bf0e160dc10",
  "transport": "openai-completions",
  "blocks": [
    { "type": "thinking", "text": "[redacted]" },
    { "type": "text", "text": "INTERMEDIATE_MARKER", "phase": "commentary" },
    { "type": "thinking", "text": "[redacted]" },
    { "type": "text", "text": "FINAL_MARKER", "phase": "final_answer" }
  ],
  "delivered": "FINAL_MARKER",
  "intermediateDelivered": false,
  "finalDelivered": true,
  "hiddenReasoningDelivered": false
}

Exact-head Telegram proof

The real-user Telegram harness drove the changed openai-completions path on 370f3067dfa71d7b80be1fe4da168bf0e160dc10. The fixture emitted hidden reasoning A, interim content, hidden reasoning B, then final content. Telegram recorded one SUT message at 4097 ms containing only OPENCLAW_E2E_REASONING_FINAL: zero edits, deletions, typing events, intermediate markers, or hidden-reasoning markers.

ClawSweeper rank-up skip: no separate Telegram Desktop transcript. The exact-head real-user TDLib recording is stronger for this defect because it exhaustively records transient messages, edits, deletions, and typing events while driving the changed provider path; a Desktop snapshot would duplicate the final-state evidence without proving those absences.

The ephemeral harness set agents.defaults.heartbeat.target=none with strict readback so an unrelated background heartbeat could not contaminate the turn. It recorded one provider request, drained zero pending updates, removed its scratch directory, and left no persistent config mutation.

Pre-fix compatible-provider capture

Redacted Telegram harness capture on main drove the documented generic openai-completions route with:

reasoning_content([redacted A]) -> content(INTERMEDIATE) ->
reasoning_content([redacted B]) -> content(FINAL)

Gateway evidence recorded provider=openai and api=openai-completions. Telegram received one final SUT message after 4111 ms containing both INTERMEDIATE and FINAL, with neither hidden reasoning marker. This proves the reported stream shape leaked interim visible content on main; it does not claim that the current MiniMax service still emits that shape. Bundled MiniMax defaults to anthropic-messages, while its optional OpenAI-compatible configuration remains documented.

Overlap

Open PR #96969 is the only exact overlap. Its consumer heuristic drops legitimate unphased text across providers; this PR replaces it at the producer owner boundary. Broad searches found no second open repair.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 17, 2026
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 5:17 AM ET / 09:17 UTC.

ClawSweeper review

What this changes

This PR marks OpenAI-compatible completion text interrupted by resumed reasoning as commentary or final answer, then defers channel delivery until that phase is terminally known.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

Keep open for maintainer review. The producer-owned approach matches the current ownership boundary and the supplied latest patch addresses the prior structured-output finding, but this checkout cannot load the exact PR head for a complete source review; the PR also carries the protected maintainer label.

Priority: P1
Reviewed head: 370f3067dfa71d7b80be1fe4da168bf0e160dc10

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real transport proof is strong, while a local exact-head retrieval failure prevents a complete branch-level source verdict.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head real-user Telegram transport evidence that the changed stream delivered only the final text; the unavailable local branch object is a reviewer limitation, not missing contributor proof.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head real-user Telegram transport evidence that the changed stream delivered only the final text; the unavailable local branch object is a reviewer limitation, not missing contributor proof.
Evidence reviewed 6 items Current source exposes the owner-boundary gap: Current main decodes reasoning and visible content separately but does not assign text phase when reasoning resumes, so interrupted visible spans remain unphased.
Current delivery consumes the final visible extraction: The subscriber derives final visible text at message end, so phase metadata must be correct before this consumer boundary.
Existing regression surface: Current main tests preserve visible–thinking–visible structured-detail order but do not phase the interrupted text; the supplied branch patch adds the missing phase assertions.
Findings None None.
Security None None.

How this fits together

OpenAI-compatible completion streams become assistant text and thinking blocks in two producers, then the embedded-agent subscriber extracts and sends visible text to channels. The PR carries a producer-owned terminal-phase fact into that delivery decision.

flowchart LR
  A[Provider stream] --> B[Completion producers]
  B --> C[Thinking and text blocks]
  C --> D[Terminal phase classification]
  D --> E[Embedded-agent subscriber]
  E --> F[Channel-visible reply]
Loading

Before merge

  • Resolve merge risk (P1) - The bug fix adds production +288 lines across two producers and the delivery boundary; exact-head review should confirm the duplicated phase state cannot be absorbed further by the shared decoder/helper.
  • Resolve merge risk (P1) - The branch is behind current main and its exact objects were unavailable locally, so its producer-to-subscriber proof should be refreshed against the actual merge result before landing.
  • Complete next step (P2) - The protected maintainer label and unavailable exact PR object require a maintainer-facing merge-result refresh rather than automated repair or closure.
Agent review details

Security

None.

PR surface

Source +294, Tests +541, Other 0. Total +835 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 9 440 146 +294
Tests 4 547 6 +541
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 14 989 154 +835

Review metrics

Metric Value Why it matters
Production versus test delta production +288 (+434/-146); tests +547 (+553/-6); assertion baseline 2 changed The positive production growth is substantial for a bug fix and spans both stream producers plus channel delivery.

Stored data model

Persistent data-model change detected: serialized state: src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.reasoning-delivery.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh the exact merge result (recommended)
    Rebase or inspect GitHub’s merge result and rerun the focused producer and subscriber regressions before merge.
  2. Accept terminal-only latency
    Merge with the approved terminal-only behavior for phase-ambiguous streams, accepting delayed partial output only for that affected stream shape.

Technical review

Best possible solution:

Keep producer-owned phase classification, then refresh the exact merge result and verify both completion producers and terminal subscriber delivery still produce only the final text.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: an OpenAI-compatible stream with reasoning, interim text, resumed reasoning, and final text reaches the unphased completion block path on current main. The reviewer did not execute the live provider flow in this read-only environment.

Is this the best way to solve the issue?

Yes in principle: the producer alone retains the raw reasoning/text ordering needed to classify phases, whereas the related consumer heuristic cannot reliably distinguish compatible-provider semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7ce934a8b5d0.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Phase-ambiguous OpenAI-compatible streams intentionally change from live partial delivery to terminal-only delivery.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head real-user Telegram transport evidence that the changed stream delivered only the final text; the unavailable local branch object is a reviewer limitation, not missing contributor proof.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head real-user Telegram transport evidence that the changed stream delivered only the final text; the unavailable local branch object is a reviewer limitation, not missing contributor proof.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Incorrectly combining interim and final model text produces a wrong user-visible channel reply.
  • merge-risk: 🚨 compatibility: Phase-ambiguous OpenAI-compatible streams intentionally change from live partial delivery to terminal-only delivery.
  • merge-risk: 🚨 message-delivery: The PR changes which streamed assistant text is allowed to reach channel reply callbacks.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head real-user Telegram transport evidence that the changed stream delivered only the final text; the unavailable local branch object is a reviewer limitation, not missing contributor proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head real-user Telegram transport evidence that the changed stream delivered only the final text; the unavailable local branch object is a reviewer limitation, not missing contributor proof.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The changed behavior is visible in Telegram chat and can be demonstrated by a short interleaved-reasoning delivery transcript.

Evidence

Acceptance criteria:

  • [P1] Inspect the exact merge result for both OpenAI-completions producers and the embedded-agent subscriber.
  • [P1] Run the focused structured-reasoning and embedded-agent delivery regression suites on the exact head.

What I checked:

Likely related people:

  • Peter Steinberger: Current-main history shows the phase helper and split subscriber source files were introduced together in the closest available provenance commit. (role: current source-file introducer; confidence: medium; commits: 3010318ba3fe; files: packages/ai/src/utils/assistant-text-phase.ts, src/agents/embedded-agent-subscribe.handlers.messages.update.ts)
  • Ayaan: The PR discussion records Ayaan's approval of terminal-only delivery for phase-ambiguous completion streams. (role: delivery-policy approver; confidence: medium; files: src/agents/embedded-agent-subscribe.handlers.messages.update.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the focused review against the exact merge result.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-17T07:45:06.027Z sha 466aa01 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T08:05:39.553Z sha 6cbd3ca :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T08:21:49.313Z sha 91eff2221934e051212b378d9160049001853ce3 :: found issues before merge. :: [P1] Preserve explicit structured output across packet boundaries

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Aug 17, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@obviyus
obviyus force-pushed the fix/interleaved-reasoning-visible-text-v2 branch from f59b749 to 370f306 Compare August 17, 2026 08:54
@obviyus

obviyus commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (Ayaan, 2026-08-17): approve terminal-only channel delivery for phase-ambiguous reasoning-capable OpenAI-completions streams. The no-transient-interim-text guarantee takes priority over partial-reply latency on those streams; ordinary completions retain live partial delivery. Exact head 370f306 remains fully checked: 179 passed, 50 skipped, 0 failed, including production and test typechecks.

@obviyus obviyus self-assigned this Aug 17, 2026
@obviyus
obviyus merged commit 78b8f8c into main Aug 17, 2026
236 checks passed
@obviyus
obviyus deleted the fix/interleaved-reasoning-visible-text-v2 branch August 17, 2026 09:18
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
Classify text interrupted by resumed reasoning at the OpenAI-completions producer boundary, so channels deliver only the confirmed final answer.

Defer phase-ambiguous replies until terminal classification while preserving live partial delivery for ordinary completions.

Co-authored-by: Ayaan Zaidi <[email protected]>
leapdragon added a commit to leapdragon/openclaw-upstream that referenced this pull request Sep 17, 2026
Since openclaw#125149 any OpenAI-completions stream that carries native reasoning
hides every byte of visible text until the stream ends: the first reasoning
chunk marks the message terminal-bound and arms the reasoning-tag partitioner's
strict mode, and text sharing a chunk with reasoning is routed through the
tag-aware path, which also arms strict mode. With a reasoning model on vLLM
the answer therefore arrives as one delta at the end, minutes after the
reasoning finished, even though the server streamed it token by token.

That deferral exists so text interrupted by resumed reasoning can be
classified as commentary or final answer at terminal. Reasoning that precedes
every visible byte leaves nothing to reclassify, so defer only when reasoning
resumes after visible text: mark the message terminal-bound and switch the
partitioner to strict mode only then, and route same-chunk text through the
tag-aware path only once the message is terminal-bound. Resumed-reasoning
streams behave exactly as before.

Measured against vLLM (qwen38-flash-next, reasoning low): before, one
2,924-character text delta at 16.8 s; after, 92 deltas starting 50 ms after
the last thinking delta.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
leapdragon added a commit to leapdragon/openclaw-upstream that referenced this pull request Oct 8, 2026
Since openclaw#125149 any OpenAI-completions stream that carries native reasoning
hides every byte of visible text until the stream ends: the first reasoning
chunk marks the message terminal-bound and arms the reasoning-tag partitioner's
strict mode, and text sharing a chunk with reasoning is routed through the
tag-aware path, which also arms strict mode. With a reasoning model on vLLM
the answer therefore arrives as one delta at the end, minutes after the
reasoning finished, even though the server streamed it token by token.

That deferral exists so text interrupted by resumed reasoning can be
classified as commentary or final answer at terminal. Reasoning that precedes
every visible byte leaves nothing to reclassify, so defer only when reasoning
resumes after visible text: mark the message terminal-bound and switch the
partitioner to strict mode only then, and route same-chunk text through the
tag-aware path only once the message is terminal-bound. Resumed-reasoning
streams behave exactly as before.

Measured against vLLM (qwen38-flash-next, reasoning low): before, one
2,924-character text delta at 16.8 s; after, 92 deltas starting 50 ms after
the last thinking delta.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
steipete added a commit that referenced this pull request Oct 10, 2026
…0685)

* fix(ai): stream completions text live when reasoning precedes it

Since #125149 any OpenAI-completions stream that carries native reasoning
hides every byte of visible text until the stream ends: the first reasoning
chunk marks the message terminal-bound and arms the reasoning-tag partitioner's
strict mode, and text sharing a chunk with reasoning is routed through the
tag-aware path, which also arms strict mode. With a reasoning model on vLLM
the answer therefore arrives as one delta at the end, minutes after the
reasoning finished, even though the server streamed it token by token.

That deferral exists so text interrupted by resumed reasoning can be
classified as commentary or final answer at terminal. Reasoning that precedes
every visible byte leaves nothing to reclassify, so defer only when reasoning
resumes after visible text: mark the message terminal-bound and switch the
partitioner to strict mode only then, and route same-chunk text through the
tag-aware path only once the message is terminal-bound. Resumed-reasoning
streams behave exactly as before.

Measured against vLLM (qwen38-flash-next, reasoning low): before, one
2,924-character text delta at 16.8 s; after, 92 deltas starting 50 ms after
the last thinking delta.

* fix(ai): stream reasoning completions before final classification

Stream visible Chat Completions text through initial and resumed reasoning while keeping final delivery limited to the confirmed answer. Preserve unfinished reasoning-tag privacy and content followed only by reasoning.

Co-authored-by: Aron Hsiao <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Aron Hsiao <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…nclaw#150685)

* fix(ai): stream completions text live when reasoning precedes it

Since openclaw#125149 any OpenAI-completions stream that carries native reasoning
hides every byte of visible text until the stream ends: the first reasoning
chunk marks the message terminal-bound and arms the reasoning-tag partitioner's
strict mode, and text sharing a chunk with reasoning is routed through the
tag-aware path, which also arms strict mode. With a reasoning model on vLLM
the answer therefore arrives as one delta at the end, minutes after the
reasoning finished, even though the server streamed it token by token.

That deferral exists so text interrupted by resumed reasoning can be
classified as commentary or final answer at terminal. Reasoning that precedes
every visible byte leaves nothing to reclassify, so defer only when reasoning
resumes after visible text: mark the message terminal-bound and switch the
partitioner to strict mode only then, and route same-chunk text through the
tag-aware path only once the message is terminal-bound. Resumed-reasoning
streams behave exactly as before.

Measured against vLLM (qwen38-flash-next, reasoning low): before, one
2,924-character text delta at 16.8 s; after, 92 deltas starting 50 ms after
the last thinking delta.

* fix(ai): stream reasoning completions before final classification

Stream visible Chat Completions text through initial and resumed reasoning while keeping final delivery limited to the confirmed answer. Preserve unfinished reasoning-tag privacy and content followed only by reasoning.

Co-authored-by: Aron Hsiao <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Aron Hsiao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant