feat: strip closed-turn thinking replay via kernel reasoningReplay (needs acp-kernel 0.0.60) - #338
feat: strip closed-turn thinking replay via kernel reasoningReplay (needs acp-kernel 0.0.60)#338ranxianglei wants to merge 4 commits into
Conversation
…needs acp-kernel 0.0.60) Fixes #336 (requires acp-kernel PR #225) - entriesToCoreMessages projects assistant thinking blocks as contentType 'reasoning' cores with deterministic base#r<n> sub-ids; companion text/call cores shift to sub-id form when thinking exists so the rebuild can filter per sub-id survival. - coreOutToAgentMessages filters original thinking blocks by surviving base#r<n> sub-ids, and syncs kernel-rewritten compress-call text (live-range filter + summary stubs) back into toolCall arguments. - AdapterConfig.reasoningReplay defaults to 'open-round' (kill-switch 'always'/'never', coreOverrides wins). Measured on the storm session: outgoing view 155K→49K (thinking 75.8K→0.9K).
[bot] 🏷 已接手。当前状态盘点: 阻塞点:acp-kernel 0.0.60 尚未上 npm
本 PR(#338,分支
我现在做的:用 npm 上的 0.0.60 上 npm 后的动作(我会跟进):rebase master → bump pin 0.0.56→0.0.60 + lockfile → 全套检查 → push;之后人工合并本 PR,再走 v0.1.61 release 分支(两版本字段提交)。 |
[bot] 🏷 预验证完成(本地,使用 acp-kernel PR #225 的 CI 构建产物): 阻塞状态:acp-kernel 0.0.60 尚未上 npm(最新 stable 0.0.59)。acp-kernel PR #225 全绿(pr-validation / test 22 / test 24 / build-artifact 均 success)、mergeable clean、非 draft——只差合并与发布(合并 PR 是 human-only,我这边不能代劳)。 本地预验证(按 AGENTS.md 流程,将
其他核查:
0.0.60 发布后的执行计划(默认按 AGENTS.md 惯例,有异议请指出):
若你希望先在 feature PR 上 bump pin(让 PR CI 在合并前转绿,release 提交只动 pi 版本),告诉我一声,我按那个流程走。 |
…ed reasoning, untestable) Explicit reasoningReplay in acp.json (or coreOverrides) always wins; qwen/glm verified open-round safe by live API matrix (delete/truncate/empty × closed and open tool rounds all 200).
开关语义(本次补充,commit a5025ff)
GPT 默认保守的依据:OpenAI Responses API 的 reasoning 是加密块、必须原样回传,且本地无 API 可验证(用户实测要求)。qwen3.8-27b(sglang 8199)与 glm-5.3(z.ai 代理 18081)已跑完整 API 矩阵:删除/截断/空串 × 闭合轮/工具未闭合轮,全部 200。 实现保证:从不截断 thinking 文本(存根化只作用于 compress 调用 args)、开轮永不碰(Anthropic 签名校验安全超集)。等 acp-kernel #225 合并发 0.0.60 后 bump pin 即可合并本 PR。 |
OpenAI reasoning items are opaque and must round-trip unmodified; untestable from here, so default GPT-family to legacy keep-everything. Explicit reasoningReplay config overrides the family default.
[bot] 🏷 已 review 新提交(a5025ff + 2407041)并重新预验证: 代码 review: 重新预验证(新 tip 2407041,kernel overlay 不变):
"7 例"对上了: 一个小问题:分支里提交了 8 个 阻塞未变:npm 上 acp-kernel 最新仍是 0.0.59( |
CompressSettings now carries reasoningReplay, resolved through the
existing global → providers.<name> → models.<id> deepest-wins merge,
so the GPT-family escape hatch is a plain per-provider setting:
{ "compress": { "providers": { "openai": { "reasoningReplay": "always" } } } }
Precedence: compress (any level) > coreOverrides.reasoningReplay >
family default.
|
Superseded: owner wants exact alignment with opencode-acp #377 (owner-locked design: compress-calls selector + char threshold + nested field-wise three-level config, adapter-level pass). Clean reimplementation coming on a fresh branch; kernel stays untouched. |
Fixes #336
依赖 acp-kernel PR #225(需先发布 0.0.60 并在此 bump pin)。
变更
contentType: "reasoning"core,子 idbase#r<n>(内核因此能看见并按策略剥离);带 thinking 的消息其 text/call core 一并转为子 id 形式(#t0/#callId),重建端按子 id 存活过滤。coreOutToAgentMessages按存活的base#r<n>过滤原始 thinking 块(内核剥掉的不再透传回 pi);同时把内核改写过的 compress 调用文本(活范围过滤+summary 存根)同步回 toolCall arguments——此前内核瘦身对 pi 出口无效。AdapterConfig.reasoningReplay默认"open-round"(闭合轮次剥离),kill-switch"always"/"never",coreOverrides优先。默认生效即修复 Protected-message exemption inflates the incompressible context floor: per-compression reasoning is never reclaimable (~83.5% of measured residual) #336 的不可压缩地板。实测(真实风暴会话重放,sessionTokens ~168K)
测试:全套 628 pass + 新增 messages-reasoning 7 例(投影/剥离/重建过滤/配置默认)。
合并后待办
package.jsonpin + lockfile + 发版(两版本字段提交)。