Skip to content

fix: pick upstream compaction fixes #1984, #1988, #1994 - #63

Merged
kylinmac merged 4 commits into
mainfrom
fix/upstream-compaction
Oct 30, 2026
Merged

kylinmac merged 4 commits into
mainfrom
fix/upstream-compaction

Conversation

@kylinmac

Copy link
Copy Markdown
Owner

改动

从上游 PI-Desktop 单独挑入三个压缩修复,不是整体同步。fork 里原本没有这三处,和 #55、#59–#61 修的内容也不重叠。

三个都用 cherry-pick -x -m 1 挑入,没有冲突;提交说明里写了上游 PR 编号和原提交号。

为适配 mc-agent 改的地方(单独一个提交):

更新说明(用户可见)

  • 修复:使用部分 Responses 或 Codex 网关时,上下文接近上限不再因缓存命中没算进用量而错过压缩,导致下一轮请求超窗。
  • 修复:超长会话分块压缩时,第一块不再超出模型上下文窗口。
  • 修复:压缩摘要里的已读和已改文件清单,不再漏掉最近一段操作过的文件。

刻意未改

上游其余 230 多个提交本次不同步。README 的上游同步记录里写明了这次只挑入的三处,下次整体同步时应和上游保持一致。

验证

  • shared:1373 项通过(含 fix(agent-runtime): include cached usage in context budget vastsa/PI-Desktop#1994 新增)。
  • agent-runtime:1562 项通过(含三个上游修复自带的测试);类型检查通过。
  • desktop:类型检查通过,context-usage 19 项通过。
  • pnpm lint、git diff --check、文档检查(645 页)通过。
  • 上游的 scripts/e2e-context-usage-compaction.mjs 需要先构建 sidecar,本地没跑。

🤖 Generated with Claude Code

macheng and others added 4 commits October 30, 2026 03:14
Cherry-picked from upstream PI-Desktop vastsa#1984 (ec77831). The folded
tail is summarized too, but its Read/Write/Edit paths were not recorded,
so the checkpoint's read/modified file lists missed them.

(cherry picked from commit ec77831)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry-picked from upstream PI-Desktop vastsa#1988 (e8f315d). Chunk planning
reserved the carried summary at four characters per token while the
guard measures 3.5, so a first chunk could exceed its window.

(cherry picked from commit e8f315d)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry-picked from upstream PI-Desktop vastsa#1994 (4eea56e). A Responses
gateway can leave cached input out of total_tokens, so the compaction
budget was anchored too low and a turn could be sent without the
expected checkpoint. The runtime now uses the inspector's occupancy
calculation, taking the larger of the bucket sum and the reported total.

(cherry picked from commit 4eea56e7f5d0ef2eeaf30bf1bd1d0bcc3c48d5e0)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The upstream file-ops test answers completeSimple, but mc-agent streams
summaries since #55, so the fixture now answers streamSimple. The
context-usage fixture now sees the R21.2 post-compaction re-read and
records it as "restore", separate from the model's own tool call.
Records the pick in the docs so the next full sync knows these three
fixes are already in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kylinmac
kylinmac merged commit 46d2957 into main Oct 30, 2026
9 checks passed
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