makecindy / makecindy/cindy

bug: 伙伴会话隔天/后台一段时间后发消息全部报 [PRECONDITION_FAILED] 请先选择已开启的伙伴模型,需手动重选模型才恢复

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

Description

### 问题描述 / What happened

伙伴(Bot)会话在隔天重新打开、或应用在后台放置一段时间后,所有伙伴会话发消息均报错:

[PRECONDITION_FAILED] 请先选择已开启的伙伴模型

且模型设置页中之前选过的默认模型显示为“未选择”。在模型选择器里重新选一次模型后立即恢复。远端模型目录并未删除任何模型(对比 09-04 → 09-15 的 Cache/model-catalog 快照,只有新增),数据也在。

期望行为: 同 owner 的 generation bump / 应用后台恢复后,伙伴默认模型链应保持可用,或至少能自动恢复,不应把“镜像缺失”当成用户未配置模型抛错。

根因分析(代码级)

伙伴 profile modelChainOverride: null → followsCindyDefault,每次发送经 readEffectiveBotModelSelection(apps/desktop/src/main/maker-host/bot-model-chain-settings-store.ts)→ defaultBotModelChain(apps/desktop/src/shared/botDefaultModelChain.ts)动态计算模型链
动态链唯一来源 getSelectedNewMakerRoute(owner)(apps/desktop/src/main/maker-host/newMakerDefaultsCache.ts:257)是 renderer 经 SYNC_NEW_MAKER_DRAFT 推给 main 的纯内存镜像,围栏键为 mode:dataOwnerId:generation 精确匹配
同 owner Ghost projection 修复(apps/desktop/src/main/authManager.ts ~L2305-2350,forceBumpGeneration = true)使 generation +1 → activeOwnerScopeKey() 变化 → 镜像围栏失配 → 返回 undefined
renderer 仅在 ①挂载 ②本地草稿变化 ③[dataOwnerId, dataOwnerRecoveryEpoch] 变化 ④远程改默认 时重推(apps/desktop/src/renderer/App.tsx 中 syncNewMakerPrefs 调用点);同 owner 的 generation bump 不命中任何触发器,且 main 端 syncNewMakerDraftCache 校验失败时静默丢弃、无重试机制
defaultBotModelChain 拿不到 preferredRoute → 返回 [] → botModelRouteReconciler.ts:85 抛 PRECONDITION_FAILED
为何重选模型即恢复: 重选 → renderer 草稿变化 → subscribeDraft → syncNewMakerPrefs() 以当前(新)generation 重推 → 镜像恢复。修复后 DB 中 modelChainOverride 仍为 null,证明走的是重推镜像路径而非写入 per-bot 链。

### 环境 / Environment

Cindy 版本:0.1.81 → 0.1.82(beta channel,均复现)
平台:Windows 11 x64
安装方式:官方安装包(auto-update hotfix)
源码 commit:main @ f4422f816(botModelRouteReconciler 现行逻辑)

### 复现步骤 / Steps to reproduce

1. 伙伴使用默认模型链(bot profile modelChainOverride: null,跟随全局默认),正常使用后关闭前台/放置过夜(期间应用触发 token 刷新的同 owner Ghost projection 修复,generation +1;或 auto-update 重启)
2. 重新打开应用,向任意伙伴会话发消息
3. 每条消息(含 steer/retry 路径)均报 [PRECONDITION_FAILED] 请先选择已开启的伙伴模型
4. 打开模型选择器重新选择一次模型 → 立即恢复

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

[2026-09-14T19:30:04] WARN [auth-adapters:asset-prep] prepare shared global skills failed
{ error: 'Ghost skill projection is not stable for the active owner' }
[2026-09-14T19:30:33] WARN [maker-input-coordinator] pre-accept send failed; restored queue head
{ reason: 'enqueue-immediate', error: '[PRECONDITION_FAILED] 请先选择已开启的伙伴模型' }
[2026-09-14T19:30:54] 同上 { reason: 'resume' ... } ← 跨多个伙伴会话连续出现

[2026-09-15T12:36:17] auto-update relaunch → v0.1.82, app session committed generation 1
[2026-09-15T13:31:42] stable app session committed { mode:'cloud', dataOwnerId:'cmtw…', generation: 2 } ← 同 owner bump
[2026-09-15T13:55:30] 前台恢复清理
[2026-09-15T13:55:33] WARN Ghost skill projection is not stable for the active owner
[2026-09-15T13:55:34] WARN pre-accept send failed { reason:'enqueue-immediate',
error:'[PRECONDITION_FAILED] 请先选择已开启的伙伴模型' }
[2026-09-15T14:00-14:01] 同上 ×5 { reason:'steer-fallback'/'retry' }

Contributor guide

Open the contributing guide

Research direction

Start with apps/desktop/src/main/maker-host/newMakerDefaultsCache.ts and bot-model-chain-settings-store.ts, then trace defaultBotModelChain, authManager.ts, and App.tsx across the generation bump and draft-sync paths. Reproduce the background or next-day recovery flow and verify that the default bot model remains selected and messages no longer raise PRECONDITION_FAILED without manually reselecting a model.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.