fix: stabilize cache-aware context handling#410
Conversation
|
Thank you for submitting this PR and participating in Tencent Rhino-bird Open-source Training Program! |
|
Triage note: #375 is now the canonical scoped runtime mitigation for #120. This PR is much broader than the immediate #120 fix: it changes recall mode defaults, adds session snapshots, tool-result offload/read tooling, cache epoch helpers, and task snapshot/delta helpers. Those may be useful independently, but they should not be merged as a single duplicate #120 implementation. Recommendation: split this into separate PRs after #375: one for any remaining recall-cache behavior, one for tool-result offload/read, and one for cache-epoch/task snapshot helpers. The current PR is too large for the corrected #120 scope. |
|
Thanks for the triage. I have split #410 into three scoped PRs based on the requested boundaries:
The recall PR excludes behavior already covered by #375. The other follow-up PRs are scoped independently for narrower review. Local docs, logs, experiment artifacts, machine-specific config, and credentials are not included in the submitted diffs. |
|
Follow-up cleanup note now that the split PRs exist: This large PR should be considered superseded for review purposes. The immediate #120 runtime mitigation is already covered by the approved #375, and the remaining parts have been split into narrower follow-ups:
Recommendation: close this PR and continue review on the split PRs only. Keeping #410 open alongside the split follow-ups makes the #120 queue look duplicated and increases the chance that the same behavior is reviewed twice. |
|
Acknowledged, and thanks for the clarification. #410 will be treated as superseded going forward. The immediate runtime mitigation directly related to #120 is tracked in #375, and the remaining parts from #410 have been split into #446, #447, and #448. Further discussion and review will continue on the split PRs. |
Description | 描述
本 PR 针对 #120 中的 prompt cache 不稳定问题,调整插件上下文构建方式,减少每轮动态数据对可复用 prompt 前缀的影响。
核心目标:
主要改动:
src/core/session/session-snapshot.ts,用于构建确定性 session snapshot。recall.mode = "tool-only",同时保留recall.mode = "auto"兼容旧的自动召回路径。showInjected与persistInjected语义;当persistInjected=false时,在持久化消息前清理<relevant-memories>注入块。refs/*.md,历史中只保留 compact metadata。tdai_offload_read,支持按result_ref、query 和行号范围受控读取完整结果片段。Related Issue | 关联 Issue
Fix #120
Change Type | 修改类型
Self-test Checklist | 自测清单
本地验证命令:
验证结果:
13个测试文件通过。82个测试通过。dist/index.mjs语法检查通过。额外做过本地长上下文验证:
83.9% - 86.5%。97.8%。result_ref恢复链路检查为333/333。上述长上下文数据仅作为本地验证证据,不作为公开 benchmark 结论。Toolathlon、SWE-bench / Claw-SWE-Bench、WideSearch 等应作为后续独立 benchmark gate。
Additional Notes | 其他说明
兼容性说明:
recall.mode = "auto"启用。showInjected仍控制当前轮是否展示注入召回内容。persistInjected=false现在会阻止注入召回块进入持久化对话历史。tdai_offload_read只允许读取安全的refs/*.md相对路径,并应用读取预算限制。