makecindy / makecindy/cindy

[Bug] IM 渠道(Telegram)旧会话在渠道默认 provider 切换为 BYOM 后无法恢复:模型与 provider 不匹配,任务直接失败

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

Description

### 问题描述 / What happened

### 问题描述 / What happened

IM 渠道(Telegram)中,将 pi agent 的默认 provider 从 Cindy 网关切换为 BYOM provider(例如 opencode-go)后,在该渠道**已建立的旧会话**(切换前创建、会话记忆模型为 Claude 模型 claude-opus-5)中继续发消息,任务立即失败,且会话无法恢复:

```
pi: BYOM provider 'opencode-go' cannot serve model 'claude-opus-5' (provider absent, or it no longer offers this model); refusing to fall back to the Cindy gateway (would send prompts to the wrong endpoint).
```

会话被卡死:IM 渠道没有模型切换命令、没有重开/重置会话的路径,用户只能手动修改本机数据库(sessions 表的 model 字段)才能恢复。

### 实际行为与期望行为 / Actual vs expected behavior

- **实际**:任务直接失败;错误信息包含底层 pi 的 BYOM/provider 术语,IM 用户无法理解也无法操作;会话既无法使用旧模型,也无法自动使用新 provider 的默认模型(deepseek-v4-flash),形成死锁。
- **期望**:
1. 会话恢复时若会话记录的 model 与当前渠道 provider 的能力不匹配,应优雅降级为渠道默认模型(或当前 provider 提供的模型)并提示用户,而不是直接失败;
2. 若必须失败,应在 IM 渠道提供可执行的恢复路径(例如发送命令重置会话模型 / 重开会话)。

### 环境 / Environment

- Cindy 版本:0.1.36(macOS)
- 渠道:Telegram(IM 渠道),agentKind: pi
- 触发场景:渠道默认设置中 agents.pi.providerId 从 Cindy 网关切换为 opencode-go(BYOM),model 为 deepseek-v4-flash
- 旧会话状态:sessions 表 model=claude-opus-5(切换前记忆),provider_id=opencode-go(切换后渠道默认),两者不匹配

### 复现步骤 / Steps to reproduce

1. 在 Telegram 渠道与 Cindy 建立会话并正常对话(此时 provider 为 Cindy 网关,模型为 claude-opus-5)
2. 修改 IM 渠道默认设置(im-default-settings.json / 设置界面):agents.pi.providerId = "opencode-go",model = "deepseek-v4-flash"
3. 回到第 1 步建立的旧会话,发送任意消息
4. 任务立即失败,错误:pi: BYOM provider 'opencode-go' cannot serve model 'claude-opus-5' (provider absent, or it no longer offers this model); refusing to fall back to the Cindy gateway (would send prompts to the wrong endpoint).
5. 之后该会话每次发消息都失败,无法从 IM 渠道恢复,只能手动修改本机数据库

### 日志与截图 / Logs & screenshots

```
pi: BYOM provider 'opencode-go' cannot serve model 'claude-opus-5' (provider absent, or it no longer offers this model); refusing to fall back to the Cindy gateway (would send prompts to the wrong endpoint).
```

内部状态(已脱敏):
- sessions 表:model = claude-opus-5,provider_id = opencode-go
- im-default-settings.json(telegram 渠道):agents.pi.providerId = "opencode-go",model = "deepseek-v4-flash"
- 现象:provider 与 model 均在渠道默认设置中配置,但**旧会话的 model 未随渠道 provider 切换而更新**,恢复会话时两者不匹配导致失败

Contributor guide

Open the contributing guide

Research direction

Start by tracing Telegram/pi session restoration, using im-default-settings.json, the settings UI, and the sessions table state described in the report. Check how a stored model is handled when the channel provider changes, then verify the mismatch has either a safe default-model fallback with a user-facing notice or an executable IM recovery path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.