fix: 在 reasoning_content 流式输出期间发送进度事件,防止 TUI 卡在 Thinking 状态#426
Merged
Nomikfk1215 merged 3 commits intoMay 10, 2026
Merged
Conversation
…nt TUI stuck on thinking DeepSeek-compatible models stream reasoning_content chunks before producing any text content or tool calls, which could last minutes. The OpenAI provider silently accumulated these into Message.Meta without notifying the TUI, leaving the UI stuck on thinking with no progress indication. Add EventThinkingProgress agent/TUI event type that carries only non-sensitive metadata (charCount, active) - never the reasoning text. - llm/types.go: add OnStreamProgress callback to ChatRequest - agent/events.go: add EventThinkingProgress and fields - provider/openai.go: fire OnStreamProgress on reasoning_content chunks - agent/completion_runtime.go: wire callback to emit progress events - tui: update thinking card with receiving hidden reasoning note - tests: verify reasoning_content triggers progress, never leaks to text Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| return runner.client.CreateMessage(ctx, request) | ||
| } | ||
|
|
||
| request.OnStreamProgress = func(charCount int, active bool) { |
There was a problem hiding this comment.
completeTurn overwrites any ChatRequest.OnStreamProgress callback that the caller may already have set. That makes the new hook non-composable and can silently break future call sites that want to observe provider progress themselves. Please capture the existing callback and invoke it from this wrapper instead of replacing it outright.
Cover the remaining uncovered branches in completion_runtime.go (0% → covered), tui_adapter.go (EventThinkingProgress mapping), and component_chat_stream.go (updateThinkingCard reasoning note + applyReasoningProgress edge cases). - agent: test that completeTurn wires OnStreamProgress and emits EventThinkingProgress - app: test mapAgentEvent maps ReasoningCharCount/ReasoningActive and mapAgentEventType handles EventThinkingProgress - tui: test updateThinkingCard preserves reasoning note; test applyReasoningProgress skips non-thinking items Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 10, 2026
Collaborator
Author
|
说明:首先先是合了最开始的fix #426 ,后面认为这个fix改得还不够充分想revert重新做,但是revert |
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.
#424 #425
问题
DeepSeek 兼容模型在生成任何文本内容或工具调用之前,会先流式输出大量 reasoning_content 分片,可能持续数分钟。OpenAI-compatible provider 静默将其累积到 Message.Meta 中,未通知 TUI,导致界面一直卡在 "thinking..." 无任何进度反馈。
修改
测试计划
🤖 Generated with Claude Code
@