docs(architecture): audit context compaction - #4046
Conversation
Align the paired context-compaction chapters with checkpoint-first pruning, atomic SQLite projection writes, current replay policy, summary validation, and bounded malformed retries. Refresh the code and test verification map against the current tree. Refs apache#3522 Generated-by: OpenAI Codex
|
This is a synthesis of the independent blind review by @Sol-404ARE at exact head What I checked myself:
Findings from Sol's review (file:line anchored): Standards — GO (0 P0–P3)
Spec — NO-GO — 1×P2 (worst P2)
Remaining changed claims were verified as consistent: checkpoint replay before stale-result prune, AgentRun canonical event plus bounded projection committed atomically and recoverable from ledger, replay budget/strictly-smaller gate, structured summary/one-repair/16-entry fingerprint — all match implementation; the Chinese and English hunks are structurally synchronized and all 14 production paths + 10 test entries exist. Entropy is neutral. What I did not judge: the broader compaction loop beyond the two failure paths was not re-executed — verification was by code inspection and the referenced regression noted above. Gate: one P2 docs Spec remains;
|
Distinguish automatic pre-turn budget exhaustion from manual compaction's visible fail-open note in the paired architecture chapters. Generated-by: OpenAI Codex (GPT-5.6 Luna)
aae61dd to
38b79fc
Compare
|
Addressed the P2 finding in commit 38b79fc. The English and Chinese chapters now distinguish the two implemented failure paths:
Verified against The upstream workflow still requires maintainer approval before CI can run. |
YayoiNanoka
left a comment
There was a problem hiding this comment.
PR Assessment
What problem does this PR solve?
The paired context-compaction architecture chapters had drifted from the current Runtime and SQLite implementation. The stale claims covered checkpoint/prune ordering, checkpoint persistence, replay admission, structured-summary validation, and failure behavior.
How does this PR solve the problem?
It synchronizes the English and Chinese chapters with the current implementation. This is a documentation-only change; it does not alter Runtime behavior.
Is the problem correctly defined?
Correct.
The principal drift is confirmed against the implementation:
- checkpoint replay precedes stale Tool Result pruning;
- text compaction has no dedicated 4,096-token output cap, and output-length completions are rejected;
- structured summaries are validated, receive at most one repair attempt, and unchanged malformed inputs are circuit-broken;
- the canonical AgentRun event and bounded checkpoint projection are written in one SQLite transaction;
- replay is gated by the current history budget and, where comparable, must be strictly smaller than its source;
- automatic pre-turn failure and manual compaction failure have the distinct observable outcomes now documented by
38b79fc.
Review Findings
P1 Blocker
None.
P2 Should Fix
None.
Suggestion
Consider adding a focused failure-injection regression for the SQLite checkpoint projection: the cited sqlite-core-execution-store.test.ts verifies successful AgentRun persistence and a derived high-water update, but does not directly force a projection-write failure and prove that the canonical event rolls back with it. The source transaction is correct; this would strengthen executable evidence for the documented invariant.
Verification
- Base ref OID:
3e98eb225a78289b9b8f7ac76bb1014c8777ac78 - Head:
38b79fceba9e97339e9bd2f2678cebb0313f477a - Checked the exact-head diff, implementation call paths, documented production/test paths, English/Chinese structural synchronization,
git diff --check, and mergeability against the then-currentmain. - All 14 documented production paths and 10 test paths resolve; both chapters have 559 lines and 27 headings.
- No temporary test or workspace change was created.
- Hosted checks are not currently attached to this exact head and are not claimed green by this review.
Conclusion
Merge conditionally.
Approved at exact head 38b79fc for the reviewed documentation and code-risk scope. Required hosted checks and the project's remaining merge gates must still complete.
点击展开中文
PR 判断
这个 PR 解决了什么问题?
上下文压缩架构的中英文配对章节已经与当前 Runtime 和 SQLite 实现发生漂移。过时描述涉及 checkpoint/prune 顺序、checkpoint 持久化、replay admission、结构化摘要校验以及失败行为。
这个 PR 如何解决这个问题?
它让中英文两份章节重新与当前实现同步。这是纯文档改动,不改变 Runtime 行为。
这个问题定义得对吗?
Correct(正确)。
主要漂移均已结合实现确认:
- checkpoint replay 先于 stale Tool Result prune;
- 文本压缩没有专用的 4,096-token 输出上限,因输出长度结束的 completion 会被拒绝;
- 结构化摘要会被校验,最多修复一次,相同的 malformed input 会被 circuit-break;
- canonical AgentRun event 与 bounded checkpoint projection 在同一个 SQLite transaction 中写入;
- replay 必须符合当前 history budget;可比较时,替换结果还必须严格小于 source;
- automatic pre-turn failure 与 manual compaction failure 的可见结果确实不同,
38b79fc现在已经正确描述二者。
Review Findings
P1 阻塞
无。
P2 应该改
无。
建议
可以考虑为 SQLite checkpoint projection 增加一个定向 failure-injection 回归测试:当前引用的 sqlite-core-execution-store.test.ts 验证了成功的 AgentRun 持久化和 derived high-water 更新,但没有直接制造 projection 写入失败,并证明 canonical event 会一同回滚。源码中的 transaction 是正确的;这个测试可以增强该文档不变量的可执行证据。
验证
- Base ref OID:
3e98eb225a78289b9b8f7ac76bb1014c8777ac78 - Head:
38b79fceba9e97339e9bd2f2678cebb0313f477a - 已检查 exact-head diff、实现调用链、文档列出的生产/测试路径、中英文结构同步、
git diff --check,以及相对当时当前main的可合并性。 - 文档列出的 14 个生产路径和 10 个测试路径均存在;两份章节均为 559 行、27 个标题。
- 未创建临时测试或工作区改动。
- 当前 exact head 没有关联 hosted checks,本 review 不声称 CI 已通过。
结论
有条件合入。
已针对审查过的文档与代码风险范围批准精确 head 38b79fc。必需的 hosted checks 和项目剩余 merge gates 仍须完成。
Summary
last_verifieddate to 2026-08-28.Refs #3522
Verification
npm run format:check— passed (1,706 files)npm run lint— passed (2,845 files)npm run check:asf-headers— passednpm run build— passednpm run typecheck— passed after building workspace dependenciesAI use
Select exactly one:
Tool(s) and scope: OpenAI Codex audited the current implementation, drafted the synchronized English and Chinese corrections, ran verification, and submitted the PR under @fxl112233's direction. The commit includes the required
Generated-by: OpenAI Codextrailer.Checklist
Does this PR entail a change in behavior?