fix(agent): keep tool loops alive with gated live SSE - #154
Open
GrothKeiran wants to merge 3 commits into
Open
Conversation
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.
概要
这是 #150 和 #151 的后续完整修复,解决 Codex、Claude Code、OpenClaw 等 Agent 通过 OpenAI
/v1/chat/completions使用 Qwen 网页上游时,模型仅输出计划、thinking-only 或不完整工具调用便被错误映射为正常stop,导致任务尚未完成就终止的问题。tool_calls、已验证完成/阻塞、显式错误finish_reason=stopresponse_id继续同一个 Qwen 对话delta.reasoning_content增量发送agent_final/agent_blocked包装体正文通过delta.content增量发送finish_reason=null;最终仅单独发送tool_calls、stop或真实截断原因stop为什么不会与流式输出冲突
SSE 内容增量和 Agent 终止状态被完全分离:
reasoning_content/content可以实时显示,但客户端只有在最终独立终止帧中收到finish_reason=tool_calls或经过门禁验证的finish_reason=stop。因此恢复正文流式输出不会重新引入提前停止。验证
npm test