fix(chat): a model switch on an unsaved new chat stays local (BUG-1259)
Since BUG-989 a new chat is saved on its first send, and that create already carries the session's model. selectSessionModel still PATCHed the session right away; with no row yet the route answered 404 and the composer showed 「云端同步失败」 although the local choice had taken effect. The selection now returns before any PATCH for an unsaved empty consultation (same predicate as the send path). Saved chats sync as before. Full suite 4988 / fail 24, identical to 11333460; build keeps / Static. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b339b8aec3
commit
0ed45a4b3a
+5
-3
@@ -16904,7 +16904,7 @@
|
||||
|
||||
## BUG-1259 | 新对话里还没发第一句就换模型,提示「云端同步失败」
|
||||
|
||||
- 状态:investigating(根因已确认,未修)
|
||||
- 状态:fixed-pending-verify(真机复核前不标 resolved)
|
||||
- 首次发现 / 最近更新:2026-10-07 / 2026-10-07
|
||||
- 来源:产品 iPhone 真机截图(staging 首页,新对话未发消息时切到 gpt-5.6-luna)。
|
||||
- 影响面:`use-session-management.ts` 的 `selectSessionModel` → `patchSessionModel` → `PATCH /api/sessions/{id}`;首页 / 新建的空对话。
|
||||
@@ -16912,6 +16912,8 @@
|
||||
- 触发条件:会话还没发过第一句(本地未落库的空咨询)时切换模型。
|
||||
- 根因:BUG-989(2026-09-21)把「新建对话」改成只在本地创建、第一问时才 `POST /api/sessions` 落库;`selectSessionModel` 没跟着改,仍对这个还不存在于服务器的会话发 `PATCH`,路由查不到行返回 404「聊天记录不存在或已被删除」,前端包装成「云端同步失败」。本地选择本身已生效(第一问落库时 `model_id` 取自本地会话),报错是多余的,但会让用户以为没切成功。
|
||||
- 复发自:无;BUG-989 漏改的调用点。BUG-989 的源码合同只锁了「新建无 POST / send 时 create」,没覆盖换模型。
|
||||
- 修复:待定(候选:未落库会话换模型只改本地,不发 PATCH;第一问落库时带上所选模型——现有 create 已带)。
|
||||
- 修复:`selectSessionModel` 在本地更新后,若会话仍是未落库的空咨询(与发送路径同一判据 `isUnsavedEmptyConsultation` 且不在 `cloudCreatedIds`),清掉该会话的同步失败标记后直接返回,不发 `PATCH`。第一问落库的 create 本来就写 `model_id: session.modelId`,所选模型随落库生效。已落库会话照旧同步。启动 / 回访时的模型下线回退(`applyWarmCatalog`)早已跳过未落库会话,未改。
|
||||
- 验证:`session-list-filter.test.ts` 新增 1 条源码合同(守卫在任何 PATCH 之前、清失败标记并 return、create 写入 `model_id`);去掉修复后该测试失败、恢复后通过。全量 4988 项 fail 24,与 `11333460` 逐条一致;tsc 0、lint 0 error;build `/` Static,首屏 gzip 568,343 → 568,362 B。
|
||||
- 防复发:上述测试;以后凡是对会话发 PATCH 的入口,先判断会话是否已落库(BUG-989 的「第一问才落库」)。
|
||||
- 相关记录:BUG-989、BUG-928。
|
||||
- 修复版本:—
|
||||
- 修复版本:待发布
|
||||
|
||||
Reference in New Issue
Block a user