makecindy / makecindy/cindy

[Bug] 模型切换后继续任务失败:function call ID 不兼容

Open
#4,023 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 问题描述

在 Cindy AI 自有网关中,同一个任务先使用 GPT-5.6 Sol,再切换到 Grok 4.6,之后切回 GPT-5.6 Sol。此时继续发送消息,网关请求失败,当前任务无法继续。

## 环境信息

- Cindy 版本:`cn 0.1.74 beta`
- 操作系统:Windows 11
- 网关:Cindy AI 内置网关
- 模型切换路径:`GPT-5.6 Sol → Grok 4.6 → GPT-5.6 Sol`
- 相关功能:`cindy_memory` 工具调用
- 发生时间:2026 年 9 月 7 日

## 复现步骤

1. 创建一个新任务,选择 GPT-5.6 Sol。
2. 发送:

```text
现在请记住数字17,请回复以记住
```

3. 确认记忆写入成功。

4. 将模型切换为 Grok 4.6。
5. 发送:

```text
我刚才让你记住的数字是多少
```
6. 再切换回 GPT-5.6 Sol。
7. 在同一个任务中继续发送:

```text
数字还是多少
```

## 实际结果

`cindy_memory` 检索可以正常执行,并能返回之前保存的数字,但随后网关请求失败,界面显示错误:

```text
litellm.BadRequestError: OpenAIException - {
"error": {
"code": "invalid_value",
"message": "Invalid 'input[25].id': 'fc_00187e31-6371-95f6-bea8-58bac2bb58f9_0'. Expected an ID that begins with 'ctc'.",
"param": "input[25].id",
"type": "invalid_request_error"
}
}
```

## 预期结果

切换模型后,当前任务应该能够继续使用,并保留已有上下文。

如果不同模型产生的 tool/function call ID 格式不兼容,网关应在模型切换时正确转换、过滤或重建相关历史消息,避免将不兼容的 ID 直接发送给目标模型接口。

## 初步判断

问题可能出在模型切换后的会话历史重放或消息转换逻辑:

- Grok 生成了 `fc_...` 格式的 function call ID;
- 切回 GPT-5.6 Sol 后,OpenAI 接口要求该字段使用 `ctc...` 格式;
- 网关将 Grok 产生的原始 ID 直接传给了 OpenAI 接口,最终触发 400 错误。

因此,初步判断这不是 `cindy_memory` 的读写故障,而是跨模型切换时的会话历史兼容性问题。

仓库中已有与 Grok 输入兼容性相关的 PR:#2909。当前问题的方向似乎相反(Grok 产生的历史被带回 OpenAI 模型),但可能涉及同一层的历史消息归一化逻辑,供维护者参考。

## 影响

模型切换后,原任务无法继续。新建任务可以暂时绕过问题,但会丢失原任务上下文。

## 临时规避方式

在调用过工具的任务中尽量不要切换模型;如果已经触发错误,只能新建任务继续。

## 附件

已附上错误界面截图。

Image

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the model-switch sequence and tracing the session history normalization or message conversion layer. Compare that path with PR #2909, which addresses Grok input compatibility. Done means switching between GPT-5.6 Sol and Grok 4.6 after a tool call preserves the task and avoids sending incompatible call IDs to the gateway.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai-infra-agents, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.