Skip to content

[codex] Restore Akasha prompt cache boundary - #537

Merged
kachofugetsu09 merged 9 commits into
mainfrom
experiment/prompt-memory-frame
Sep 3, 2026
Merged

[codex] Restore Akasha prompt cache boundary#537
kachofugetsu09 merged 9 commits into
mainfrom
experiment/prompt-memory-frame

Conversation

@kachofugetsu09

@kachofugetsu09 kachofugetsu09 commented Sep 3, 2026

Copy link
Copy Markdown
Owner

问题与结果

  • 解决的问题:Akasha 检索记忆在插件重构后进入 system role,导致历史前缀无法复用 provider prompt cache。
  • 用户可见结果:动态记忆改为历史之后的 user-role <system-reminder> 第一块内容;同一历史下变更记忆仍可命中稳定前缀。
  • 本 PR 不处理:provider 缓存策略、模型队列和网络延迟。
  • CI 兼容:GitHub runner 的最新 AnyIO 新增一条 Starlette 导入弃用告警;保持 -W error,仅对该明确第三方告警增加窄过滤。

Change intent

  • change_type:fix
  • semantic_delta:compatible
  • capability_owner:mixed
  • consumer_scope:Core prompt render lifecycle 与 Akasha builtin plugin
  • runtime_patch:required
  • runtime_patch_reason:新增通用 context-frame 插入点并迁移 Akasha 使用方
  • authoritative_state_owner:SessionDB messages;本次只改变临时 prompt projection
  • client_only_alternative:not_applicable
  • concept_gate:required
  • concept_gate_reason:改变受保护的 prompt 插件扩展边界
  • 关联不变量:稳定 system/history 前缀先于动态 memory;动态块保持 user role
  • protected_state:sessions.db、workspace memory、plugin-data 均不修改
  • 允许的副作用:每轮 prompt 中 Akasha memory 的 role 和位置变化
  • 禁止的副作用:回写历史、改变检索内容、改变 provider 协议

改动范围

  • 主要文件:agent/lifecycle/types.pyagent/context.pyagent/lifecycle/phases/prompt_render.pyagent/prompting/assembler.pyplugins/akasha/plugin.pytests/test_plugin_composition_lifecycle.pypytest.ini.github/workflows/ci.yml
  • 配置或迁移影响:无
  • 已知 schema lineage 与最终 schema identity:不适用
  • 协议 source、runtime、provider 与 scenario 的不可变 revision:base 47896b4200731183a54081e2eca77602a0881a0a;CommandCode deepseek/deepseek-v4-flash-vision-exp
  • 回滚方式:回滚本提交并按 exact-commit release 流程重新激活上一代

验证

  • 相关 targeted tests 已通过:19 passed;测试预算保持 1080。
  • Python 类型检查已通过:0 errors(10 existing-class warnings)。
  • python docker/debug/gate.py run --base origin/main 已运行并通过。
  • sourceDigest:见 docker/debug/reports/change-gate/20260904-004633-24859293/gate.json
  • planDigestbd27179c...
  • 真实 provider 证据:读取正式历史 274 messages,约 63,990 prompt tokens;新布局第二轮 63,872 cached tokens(99.83%),旧布局 0%。TTFT delta 由 4.712s 降至 3.309s。
  • 未运行项与原因:真实设备不适用;完整 Python 回归已额外通过 1077 passed、5 skipped。

正交性与概念完整性

  • 是否属于架构性 PR 或大改动:yes
  • 独立 reviewer / model / reasoning:独立 Codex reviewer / gpt-5.6-terra / xhigh
  • 审查 head:1c1efa453f252446359926445ce362519447d4a7
  • 新增概念及其唯一 owner:context_frame_sections 由 Prompt render lifecycle 持有,Assembler 唯一组装
  • 无关设计轴的变化传播:无持久化、provider、client 或 retrieval 变化
  • 最短正常/失败/热更新链路:Akasha before_prompt_render → append section → Assembler sort/render;空检索不追加;插件 generation 生命周期不变
  • legacy/source-specific 残留扫描:Core 不识别 Akasha plugin id;保留 builtin active_skills 现有兼容路径
  • must-fix 及处置证据:无;非阻塞 P2 为旧注释清理,不扩大本修复范围
  • 最终结论:pass

工作手册

  • 已核对 projectneed.md、相关决策和 NOW.md
  • 本次没有长期产品语义变化。
  • 客户端不适用。
  • 当前没有对应 NOW.md 事项。

@kachofugetsu09
kachofugetsu09 merged commit 403e692 into main Sep 3, 2026
2 checks passed
@kachofugetsu09
kachofugetsu09 deleted the experiment/prompt-memory-frame branch September 3, 2026 17:49
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