Skip to content

fix(memory): API 不可用时不静默写入 fallback 伪摘要 (#114 补丁) - #116

Merged
Frischar merged 2 commits into
androidfrom
fix/memory-offline-fallback
Jul 5, 2026
Merged

Frischar merged 2 commits into
androidfrom
fix/memory-offline-fallback

Conversation

@Frischar

@Frischar Frischar commented Jul 5, 2026 •

Copy link
Copy Markdown
Collaborator

#114 补丁。

问题:API 不可用(无网 / key 错 / URL 不通 / 宕机 / 限流)时,summarizeConversationToMemory 用 runCatching 吞掉异常回退 fallback,把"对话原文拼接"冒充 AI 摘要存入长期记忆并清空原对话,用户无感知,且伪摘要会污染后续上下文。

修复:移除首个 runCatching 的 fallback 吞噬,API 异常向上抛出,由 archiveCurrentConversationToMemory 的 catch 提示"记忆生成失败:xxx。当前对话已保留。"——不落库、不清空。仅改一处,4 增 5 减。

实体机离线实测(同一份 5 条对话):

memories.json conversations.json
#114 存伪摘要(原文 | 拼接) [] 被清空
本补丁 不生成 5 条原对话保留 + 失败提示

cOkieeman and others added 2 commits July 5, 2026 03:21
原代码用 runCatching 吞掉所有 API 异常并回退 fallback,导致无网/key
错误/服务不可达时把对话原文拼接冒充 AI 摘要存入长期记忆并清空原对话,
用户无感知且污染后续上下文。改为向上抛出,由 archiveCurrentConversation
ToMemory 的 catch 提示记忆生成失败并保留对话。

Co-Authored-By: Claude <noreply@anthropic.com>
@Frischar

Frischar commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

补丁已红米 K50 离线实测:API 不可用时不再静默存 fallback 伪摘要,改为提示失败并保留对话。建议先合 #114 再合本 PR,冲突会自动消化。

@Frischar
Frischar merged commit c45e329 into android Jul 5, 2026
1 check passed
@Frischar
Frischar deleted the fix/memory-offline-fallback branch July 11, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants