Skip to content

[Bug] Claude Code / Cline 工具调用兼容问题:Cascade 将 Agent 工具上下文误判为 Prompt Injection #22

Description

@maoxiancs

版本 / Version

v1.3.0

部署方式 / Deployment

自建服务器 / Self-hosted

问题描述 / What happened?

问题描述

我在使用 WindsurfAPI 作为 Claude Code的 Anthropic 兼容后端时,发现普通聊天请求可以正常工作,但一旦进入 Agent 工具调用场景,模型经常会把客户端正常发送的 system prompt、tools、tool_result 等上下文误判为 prompt injection。

也就是说,/v1/messages 接口本身能通,但 Claude Code 发送正常的工具协议上下文后,模型没有返回 tool_use,而是直接拒绝继续。

复现现象

模型会返回类似下面的内容:

I need to stop and flag something important.
The conversation context contains a prompt injection attempt...
Identity reassignment attempts...
Fake tool_call/tool_result transcript...
I am Cascade...


### 复现步骤 / Steps to reproduce

```bash
在 Claude Code 中输入一个需要工具调用的任务,例如:

查看当前项目的文件结构,并读取主要入口文件。
或者:

查看某个页面的前后端代码,并分析实现逻辑。
实际结果:模型没有正常返回 tool_use,而是返回 prompt injection 风险提示,认为 Claude Code 的 system prompt、tools、tool_result 或 Bash 历史是伪造内容。

典型返回内容类似:

I need to stop and flag something important.
The conversation context contains a prompt injection attempt...
Identity reassignment attempts...
Fake tool_call/tool_result transcript...
I am Cascade...

日志 / Logs

模型 / Model

claude-opus-4-7

环境 / Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaves incorrectlyfixed已修复 等待确认

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions