fix: 30MB 超限防护 — 文档去重 + resume 自动重试 - #210
Conversation
|
Claude finished @lishuceo's task in 1m 28s —— View job PR Review: fix: 30MB 超限防护 — 文档去重 + resume 自动重试
|
会话累积多轮带 PDF 的 turn 后,resume 时 SDK 重放全部历史导致 API payload 超过 30MB 限制。检测到 "message size exceeds limit" 错误且处于 resume 模式时,自动丢弃旧 session 重试。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
根因:每条话题消息都会从引用的父消息下载 PDF,并从聊天历史中 再次下载。即使经过 dedup 去重,每个 turn 仍附带一份 PDF 副本。 SDK resume 会重放所有前序 turn,N turns × 5.9MB = 超 30MB 限制。 修复策略: - resume 时(canResume/activeConversationId)跳过合并历史文档和图片 - resume 时若当前消息非文件上传(messageType !== 'file'),清除从 引用父消息继承的 documents(已在前序 turn 中发送过) - 新增 messageType 字段贯穿 ParsedMessage → QueueTask → executor, 用于区分"用户上传新文件"与"引用父消息的旧文件" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8b0c86f to
88c8b08
Compare
|
Claude finished @lishuceo's task in 1m 44s —— View job PR Review: fix: 30MB 超限防护 — 文档去重 + resume 自动重试 (re-review after 88c8b08)
✅ Approved2 previous issues resolved — both inline comment threads have been addressed and resolved. The new commit (88c8b08) takes the right approach by fixing the root cause: on resume, history file attachments are now skipped entirely since the SDK replays all prior turns (files are already in the conversation). This makes the What's new in 88c8b08
AssessmentThe three-layer defense is sound:
No new issues found with confidence ≥ 75. |
* fix: resume 时 30MB 超限自动重试(不带 resume 开新会话) 会话累积多轮带 PDF 的 turn 后,resume 时 SDK 重放全部历史导致 API payload 超过 30MB 限制。检测到 "message size exceeds limit" 错误且处于 resume 模式时,自动丢弃旧 session 重试。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume 时跳过已在对话中的文件附件,从根源防止 PDF 膨胀 根因:每条话题消息都会从引用的父消息下载 PDF,并从聊天历史中 再次下载。即使经过 dedup 去重,每个 turn 仍附带一份 PDF 副本。 SDK resume 会重放所有前序 turn,N turns × 5.9MB = 超 30MB 限制。 修复策略: - resume 时(canResume/activeConversationId)跳过合并历史文档和图片 - resume 时若当前消息非文件上传(messageType !== 'file'),清除从 引用父消息继承的 documents(已在前序 turn 中发送过) - 新增 messageType 字段贯穿 ParsedMessage → QueueTask → executor, 用于区分"用户上传新文件"与"引用父消息的旧文件" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
deduplicateDocuments()按 fileName 去重 + 20MB 总量上限,应用于两个历史合并点downloadHistoryFiles按 fileKey 去重,避免重复下载Test plan
🤖 Generated with Claude Code