fix(agents): queued CLI reasoning bridge + thinking token progress for claude-cli's withheld-text wire - #100148
Merged
Merged
Conversation
This was referenced Jul 5, 2026
This was referenced Jul 5, 2026
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #99401, #68374, #97526
What Problem This Solves
Fixes an issue where
/reasoning streamon claude-cli backends produced nothing on any surface — users enabled reasoning, saw tool progress and the final answer, but never any thinking. Two defects and one upstream reality:thinking_deltacarriesthinking: ""plusestimated_tokens; assistant snapshots and even the on-disk session transcripts store thinking blocks with empty text and only a continuity signature (verified on live captures from 2.1.200 and 2.1.201, and across production transcripts). feat(cli): render claude CLI native thinking with /reasoning gating #99401's parser awaited API-shaped thinking text that this CLI generation never emits — its fixtures modeled a wire that does not ship.Why This Change Was Made
createCliReasoningStreamBridge) now serves both the direct and followup paths; the followup gap is closed.thinking_deltaframes withestimated_tokensinto a distinct thinking-progress signal (cumulative per message; real-wire capture proves the estimates are per-frame, so summation is correct). No fake text is synthesized.🧠 Thinking… (~N tokens)— gated only on the window being active, like tool lines: it is run metadata, not reasoning content, so no/reasoningopt-in is required.content_block_start/stop) is included as defense.User Impact
CLI-backed agents now show live thinking activity during long reasoning stretches instead of a dead-silent window. Actual reasoning text remains unavailable on claude-cli by upstream design — operators wanting readable reasoning need the embedded API backend, where the existing pipeline already works.
Evidence
test/fixtures/cli/claude-2.1-thinking-progress.jsonl); fail-confirmed: pre-fix the fixture produces zero signals, post-fix cumulative 50/200/300.[]pre-fix.git diff --checkclean; re-verified post-rebase.Note for #68374/#97526 followers: native reasoning text from claude-cli is blocked upstream, not in OpenClaw — this ships the honest telemetry the wire actually provides.