Skip to content

stabilize LLM prefix caching context - #1

Draft
sunheyi6 wants to merge 1 commit into
mainfrom
codex/runtime-context-cache
Draft

stabilize LLM prefix caching context#1
sunheyi6 wants to merge 1 commit into
mainfrom
codex/runtime-context-cache

Conversation

@sunheyi6

Copy link
Copy Markdown
Owner

改动内容

  • 将 memory、lessons、日期和回复语言从 system prompt 迁移到可追加的 runtime_context
  • 冻结同一运行内的 system prompt 和工具定义,保留完整 provider-facing 工具调用历史
  • 分离 Renderer 可见消息与 Worker 模型历史投影,并持久化运行时上下文
  • 修复内部上下文被误判为真实用户的问题
  • 让 Subagent 继承 memory、lessons 和 language,保留稳定角色提示及命名会话工具链
  • 更新 system prompt、memory、lessons 和 tool calling 设计文档

原因与影响

此前每轮动态重建 system prompt 会改变请求前缀,降低供应商自动 KV 缓存命中率;Subagent 的回复语言和角色提示链路也不完整。改动后,动态状态通过追加消息表达,相邻请求能复用稳定前缀,同时避免内部上下文出现在 UI 或污染主会话 ledger。

验证

  • bun run typecheck
  • 相关测试 52/52 通过
  • bun run build
  • OpenCode Go / DeepSeek Flash 实测第二请求 cacheRead=128,未缓存输入 34 tokens
  • 全量测试 410/414 通过;剩余 4 项为改动前已有的无关失败

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.

1 participant