Skip to content

fix: OpenAI-compatible legacy tool_call XML and inflight stream snapshots#72

Merged
ZYKJShadow merged 1 commit into
masterfrom
fix/openai-legacy-tool-calls-stream-snapshot
May 19, 2026
Merged

fix: OpenAI-compatible legacy tool_call XML and inflight stream snapshots#72
ZYKJShadow merged 1 commit into
masterfrom
fix/openai-legacy-tool-calls-stream-snapshot

Conversation

@ZYKJShadow
Copy link
Copy Markdown
Owner

Summary

  • Parse legacy <tool_call> XML in assistant text for OpenAI-compatible gateways (e.g. Xiaomi) so Agent mode can execute tools instead of stopping after plain text.
  • Strip the same markup from Ask/Plan streaming replies so users do not see raw tool tags.
  • Preserve per-thread streaming drafts when switching threads during an in-flight IPC stream (snapshot + reload skip).

Fixes #71.

Test plan

  • Xiaomi (or similar) model + OpenAI Compatible + Agent mode: tool calls run and the loop continues.
  • Same model + Ask mode: no raw <tool_call> in the final message.
  • Start a stream on thread A, switch to thread B and back: partial assistant output is restored.
  • npm testlegacyToolCallFromText, streamInflightSnapshot, threadReloadSkip

Made with Cursor

Parse <tool_call> blocks in assistant text from some OpenAI-compatible gateways (e.g. Xiaomi) so Agent mode executes tools and Ask mode no longer shows raw XML. Preserve per-thread streaming drafts when switching threads during an in-flight IPC stream.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ZYKJShadow ZYKJShadow merged commit f4bba44 into master May 19, 2026
1 check passed
@ZYKJShadow ZYKJShadow deleted the fix/openai-legacy-tool-calls-stream-snapshot branch May 19, 2026 02:44
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.

选择智能体后怎么都用不了,然后用问答模式后能返回内容,但是后面跟着<tool_call>

1 participant