OpenAI-compatible and Anthropic-compatible chat/tool-calling instability under Sourcebot Ask workflow

未关闭
#109 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, node.js
领域
ai, api

调研方向

Start by reviewing the captured upstream traffic linked in the issue and the OpenAI-compatible /v1/chat/completions and Anthropic-compatible /anthropic/v1/messages request and response behavior. Check streaming termination and tool argument handling under the described Sourcebot Ask workflow, including tools, large multi-turn results, and Anthropic thinking. Done means identifying which compatibility behavior causes the malformed arguments or unterminated streams and documenting or fixing it; the issue does not name repository files or tests.

由索引模型根据 Issue 内容生成。

描述

Summary

We integrated MiniMax through Sourcebot Ask and captured the real upstream traffic with a transparent proxy. We found two classes of failures under the real tool-calling workflow:

  1. Streaming requests sometimes return 200 OK with text/event-stream but never terminate correctly, eventually ending in client-side timeout.
  2. In OpenAI-compatible tool-calling mode, some requests fail because the model / compatibility layer emits invalid function argument JSON.

This is reproducible under a real tool-calling workload, not only with trivial prompts.

Client context

Client stack:

  • Sourcebot Ask
  • Node 24
  • AI SDK-based provider integration
  • tested with both:
    • OpenAI-compatible /v1/chat/completions
    • Anthropic-compatible /anthropic/v1/messages

Failure 1: stream starts, then never ends

Observed behavior

For some requests, the server returns:

  • 200 OK
  • content-type: text/event-stream

Streaming begins, but the response never completes normally. The client later fails with read timeout:

  • read ETIMEDOUT
  • surface symptom in client: terminated

This is not a generic network issue:

  • the same host/container can complete independent long fetch/undici streams successfully
  • the problem appears only under the real Ask/tool-calling workflow
Request characteristics when this happens

Typical requests include:

  • stream=true
  • tool calling enabled
  • accumulated multi-turn messages
  • large tool result payloads
  • in Anthropic-compatible mode, thinking may also be enabled

Example sanitized evidence: https://gist.github.com/leozhengliu-pixel/6252d9b8415ab65dd106d11e2bf59da0

Failure 2: invalid function arguments in OpenAI-compatible mode

Observed behavior

A real OpenAI-compatible request produced this tool call:

{
  "id": "call_function_j32rtdm8f446_1",
  "type": "function",
  "function": {
    "name": "read_file",
    "arguments": "\"{\""
  }
}

This is not valid function argument JSON for the declared tool schema. The client then fails tool execution with:

Invalid input for tool read_file: JSON parsing failed: Text: {.
Error message: Expected property name or '}' in JSON at position 1 (line 1 column 2)

The upstream response for that request is 400 Bad Request.

Important detail

This is not only a small-model quality issue. We are seeing both:

  • malformed tool arguments
  • hanging SSE streams

So the compatibility problem appears broader than prompt quality.

What we need clarified

  1. In your OpenAI-compatible API, what exact guarantees do you provide for:
    • tool_calls[].function.arguments
    • streaming termination semantics
    • chunk / finish events
  2. In your Anthropic-compatible API, are there known limitations with:
    • tool use
    • thinking
    • long-running streamed responses
  3. Are there specific unsupported combinations such as:
    • thinking + tools
    • large multi-turn tool-result context
    • streaming + tool calling under compatibility mode
  4. Do you recommend disabling any of the following for compatibility:
    • streaming
    • thinking
    • automatic tool choice
    • title-generation style side requests

Evidence available

We have captured:

  • exact request payload characteristics
  • exact response status/headers
  • cases where stream starts but never completes
  • cases where tool arguments are malformed and rejected

I can provide more sanitized payloads if needed.

主要语言
没有语言数据
星标
2.6k
派生
216
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MiniMax-AI/MiniMax-M2 的其他 Issue

查看 MiniMax-AI/MiniMax-M2 的全部 Issue

相似的 Issue

更多 AI Infra & Agents Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。