Skip to content

[Bug] Cursor 中响应会被截断,且有时直接返回模型信息 JSON #185

@Chasen-Liao

Description

@Chasen-Liao

版本 / Version

v2.0.96

部署方式 / Deployment

自建服务器 / Self-hosted

问题描述 / What happened?

[Bug] Cursor 中响应会被截断,且有时直接返回模型信息 JSON

描述

在 Cursor 中接入 WindsurfAPI 使用时,回答会出现两类异常:

  1. 回复内容被中途截断,Cursor 界面里会直接显示类似:
    ... 具体请求被截断了 (85263 bytes truncated)
  2. 有时不会返回正常的 assistant 回复,而是直接显示一段 JSON,例如:
    {"name":"Cascade","provider":"Anthropic","model":"Claude","description":"..."}

这会导致在 Cursor 中的实际可用性较差,尤其是长回答或 Agent 场景下。

复现方式

  1. 按 README 配置 WindsurfAPI
  2. 在 Cursor 中配置为兼容接口使用
  3. 发起一个稍长一些的提问,或者让它先读取仓库文件再总结
  4. 可以较容易复现以下问题:
    • 回复中途被截断
    • 偶发直接返回 JSON,而不是正常自然语言内容

实际结果

  • Cursor 界面出现截断提示,回答不完整
  • 偶发直接输出模型元信息 JSON,而不是 assistant 正常响应

预期结果

  • 在 Cursor 中应返回完整可读的 assistant 内容
  • 不应把内部模型信息或中间 JSON 直接暴露给最终聊天界面

截图

已附图:

  • 图1:回答被截断,界面显示 85263 bytes truncated
  • 图2:直接返回 JSON,如 {"name":"Cascade","provider":"Anthropic",...}

可能相关

怀疑和以下方向有关:

  • SSE/stream 响应格式与 Cursor 的兼容性
  • Anthropic/OpenAI 兼容接口在某些消息块上的序列化问题
  • 长响应或工具调用后的内容拼装异常
  • 某些非最终消息块被当成最终 assistant 文本返回

环境

  • 客户端:Cursor
  • 项目:WindsurfAPI
  • 使用场景:将 WindsurfAPI 作为兼容接口接入 Cursor
  • 操作系统:Windows

如果需要,我可以再补充更具体的配置、请求方式或日志。

复现步骤 / Steps to reproduce

用cursor请求的

日志 / Logs

11:20:52
INFO
Chat[stream]: emulateTools=true but parser found 0 tool_calls (model=claude-opus-4.6-thinking provider=anthropic); markers=none; head="看到你发过来了 `yolomercury` 项目的 README 和 package.json,但你的具体请求被截断了(85263 bytes truncated)。 你需要我做什么?"
11:21:46
WARN
Account eaa51b62 (crosskairo88@gmail.com) inflight=1 stale >155s, auto-resetting
11:23:13
WARN
Cascade error step
11:23:13
ERROR
Stream error after retries: Encountered retryable error from model provider: context deadline exceeded (Client.Timeout or context cancellation while reading body)
11:23:13
WARN
Stream: partial response delivered then failed (Encountered retryable error from model provider: context deadline exceeded (Client.Timeout or context cancellation while reading body))
11:23:16
INFO
Probe[ri2svm]: model=sonnet-4.6 stream=true rf=none tools=19 reasoning=medium ctypes=[string] turns=34 lastUser=len=5494 hash=f4d43078319a4e10
11:23:16
INFO
Probe[ri2svm] msg[0] role=system len=12096 hash=0a1424f3e0f30729
11:23:16
INFO
Probe[ri2svm] msg[1] role=user len=25676 hash=9afaa97be1ddb655
11:23:16
INFO
Probe[ri2svm] msg[2] role=user len=34 hash=8066d8707d047935
11:23:16
WARN
Probe[ri2svm]: large system prompt 12KB — heavy clients (OpenClaw / Cline / opencode) may hit upstream panel-state retries above ~30KB
11:23:16
INFO
Chat[ri2svm]: routed claude-sonnet-4.6 -> claude-sonnet-4.6-thinking (wantThinking=true)
11:23:16
WARN
Probe[ri2svm]: toolPreamble 50KB exceeds soft cap 23KB; using schema-compact tier (8KB, 19 tools)
11:23:16
INFO
Chat[ri2svm]: env lifted into tool_calling_section: - Working directory: /Users/me/proj - Is the directory a git repo: Unknown - OS version: linux 6.1.115-1.2.2.lxc
11:23:16
INFO
Chat: model=sonnet-4.6 flow=cascade stream=true attempt=1 account=gibsoncristianibson@gmail.com ls=42101 turns=34 chars=141677
11:23:16
DEBUG
CascadeChat: uid=claude-sonnet-4-6-thinking enum=0 msgs=34 reuse=false
11:23:16
DEBUG
Cascade started: 0c7d608c-22c3-46cc-83d7-7ad3817fb3df
11:23:21
DEBUG
ToolParser: matched xml format, name=Shell
11:23:30
DEBUG
ToolParser: matched xml format, name=Shell
11:23:47
DEBUG
ToolParser: matched xml format, name=Shell
11:23:54
DEBUG
ToolParser: matched xml format, name=Shell
11:24:00
DEBUG
ToolParser: matched xml format, name=Shell
11:24:00
DEBUG
ToolParser: matched xml format, name=Read
11:24:15
DEBUG
ToolParser: matched xml format, name=Shell
11:24:17
DEBUG
ToolParser: matched xml format, name=Shell

模型 / Model

opus-4.6

环境 / Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaves incorrectly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions