Repository navigation
Conversation
Second pass over both llm-compaction-events-log-projection-draft documents (en and synced zh-CN), read against the current implementation. One drift fixed: the prior-history path now lives in AiSdkTurn.buildPriorMessages() (packages/runtime/src/ai-sdk-turn.ts), not AiSdkBackend.buildPriorMessages() — the method moved out of the backend since the first pass. Everything else re-verified and holds: the Code map's 14 source paths and 10 test paths, HistoryCompactCheckpoint schema V2/V3 (openai_codex_remote_v2), matchHistoryCompactCheckpointPrefix, history_compact_checkpoint_recorded, RuntimeKernel.compactSession, context_compaction_failed_open, the 8,000-token compaction output cap (DEFAULT_HISTORY_COMPACT_MAX_OUTPUT_TOKENS), the reply reserve of min(2 x last reply, 8,000) (MAX_REPLY_RESERVE_TOKENS), the 16-entry malformed-input fingerprint circuit, the 10,000/200 large-fold summary floor, the 7,500-byte tool-result prune page, toolResultPrune.enabled, and the maka://runtime/tool-results/ address scheme. last_verified and the in-body currency date refresh to 2026-10-10 in both languages. Refs apache#3522 Generated-by: GLM-5.3-Flash (ZCode)
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
[P2] Correct the remaining implementation claims in both verified chapters. Updating last_verified to October 10 and marking these translations synced leaves several factual discrepancies:
- The Chinese chapter at lines 166 and 175 still describes stale pruning of only the uncovered remainder.
AiSdkCompaction.prepareContextBudgetPolicy()first commits/prunes through durable transitions (ai-sdk-compaction.ts:683), then checks the raw checkpoint prefix and effective covered digest (:709–729);context-budget.ts:108explicitly removes the former stale-prune stage. The English explanation already reflects this durable-transition model. - Chinese line 456 says 7,500 serialized characters; the actual threshold is 7,500 UTF-8 bytes (
read-page.ts:25,tool-result-archive-transition.ts:237–242), as the English counterpart correctly says. Chinese-heavy results therefore prune at a different boundary than this translation describes. - Both schema diagrams at line 149 and native-replay explanations at line 243 use
connectionSlug. The persisted V3 field and replay comparison useconnectionId(history-compact-checkpoint.ts:128–133,410–422); the shape-validation regression explicitly rejects a slug-only checkpoint (__tests__/history-compact-checkpoint.test.ts:199–207). - English line 188 says compaction is entered at most once per send. Successful provider steps reset the shaping budget (
ai-sdk-turn.ts:1854), andmid-turn-capacity-backend.test.ts:1199–1226verifies two successful folds in one send. Document the per-step recovery boundary separately from the turn-scoped summarizer-failure circuit. - Both native-compaction sections at line 239 claim an 8,000-token output cap. Only the text summarizer supplies that cap (
history-compact-summarizer.ts:142,177). The nativestreamTextcall does not pass it (openai-codex-history-compactor.ts:113–122). A mock-provider probe supplyingmaxOutputTokens: 8000captured no dispatched maximum whilecompactionTriggerwas true. Restrict this claim to the text-summary route rather than promising a native cap.
Please synchronize the corrections and the verification metadata; no runtime change is needed for these documentation errors.
At d69f4ec140bd87a28f78dd8c3e11fa3a839a7f4d, this changes only two paired documents: verification dates and AiSdkBackend.buildPriorMessages() to AiSdkTurn.buildPriorMessages(). The renamed method exists in ai-sdk-turn.ts:2716; the remaining discrepancies above mean the full-document verification is incomplete.
I checked both complete chapters against their source and test references, including prefix/Tool-pair safety, raw and effective digests, V2/V3 admission and replay, rolling successors, persist-before-apply, SQLite atomic append/projection, damaged-projection recovery, provider fallback, pruning, and manual compaction. All 14 cited source paths and 10 named test files exist. Seven package builds and 348 selected Runtime/Storage tests passed; the native-cap probe used a synthetic provider, not a live subscription. The summary's 200-token usage floor applies to an initial fold with reported usage, not a rolling increment. The code map's request-construction entry should also point to ai-sdk-turn.ts and ai-sdk-message-projection.ts, with ai-sdk-backend.ts identified as their session-level wiring.
No protocol epoch, dependency, database schema, or runtime behavior changes. GitHub reports this exact head mergeable with successful checks. I did not verify live model summary quality or native endpoint behavior, and passing implementation tests cannot establish documentation accuracy.
…che#3522) Review findings on the verification pass (Astro-Han, five factual points): - The schema diagram and native-replay text use connectionId — the persisted V3 field and replay comparison key on connectionId, and the shape-validation regression rejects a slug-only checkpoint. - The overflow-recovery boundary is per step: a successful provider step resets the shaping budget, so recovery stays available on later steps; the summarizer-failure circuit is what stays turn-scoped. - The 8,000-token output cap belongs to the portable text summarizer; the native Codex compaction call passes no output cap. - zh: the stale-prune step and explanation now match the durable transition model the English edition already describes. - zh: the 7,500 threshold is UTF-8 bytes, not serialized characters. Generated-by: GLM-5.3-Flash (ZCode)
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
At 23102e66cd2d271ba95800aec9bd7bdffec1398e, all five factual points in the earlier P2 finding are corrected: both chapters use the persisted connectionId; overflow shaping resets after an accepted provider step while the summarizer-failure budget remains turn-scoped; the 8,000-token cap is limited to the portable text summarizer; and the Chinese chapter now correctly describes durable prune transitions and the 7,500 UTF-8-byte threshold.
P2 — retain the correct prior-history owner. Both documents at docs/architecture/llm-compaction-events-log-projection-draft.md:160 and its .zh-CN.md counterpart now point back to AiSdkBackend.buildPriorMessages(). This follow-up reverted the correction already present in the previous reviewed head d69f4ec1. That method does not exist on AiSdkBackend: the call and implementation are in packages/runtime/src/ai-sdk-turn.ts:1163,2716. Restore AiSdkTurn.buildPriorMessages() in both editions so the verified implementation map does not direct readers to a nonexistent entry point. No runtime edit is necessary.
P3 — align the verification dates with the description. Both editions' line 10 reverted to August 28 and line 41 to August 30, while the PR description still promises an October 10 refresh. Preserve the intended dates or explicitly explain the older verification boundary.
I compared the two reviewed heads, read the current PR diff, and checked each correction against its actual source and regression tests, including V3 shape/replay checks, prune-before-checkpoint validation, byte sizing, accepted-step shaping reset and native request construction. The increment changes only the two documents; production source and lockfile inputs are unchanged. The same freshly installed and normally built dependency/source closure was reused after checking that equality. Four complete compaction/checkpoint suites passed all 168 tests at this head; the synthetic native-compactor probe supplied an 8,000-token input limit but captured no dispatched output cap, matching the revised explanation.
Protocol epoch and database schema are unchanged. GitHub reports this exact head mergeable with a successful test check, and merge-tree against fetched main 16a8f5b8 is clean. I did not rerun the whole monorepo or call a live native endpoint; passing implementation tests cannot certify prose accuracy.
Summary
Second verification pass over the Context-and-compaction slice of #3522: both
llm-compaction-events-log-projection-draftdocuments (en + synced zh-CN), read line-by-line against currentmain. First pass was #4046; this one re-checks the chapter after the recent compaction-area changes (#5893, #5931, #5792, #5362, #5980).One drift fixed: the prior-history path is
AiSdkTurn.buildPriorMessages()(packages/runtime/src/ai-sdk-turn.ts:2716, class at:613) — notAiSdkBackend.buildPriorMessages(). The method moved out of the backend since the first pass; both language editions corrected.Everything else re-verified and holds:
packages/runtime/src,packages/storage/src,packages/runtime-host/src/serversqlite-core-execution-store.test.ts— theagent-run-store.test.tscitation flagged on the issue was already corrected in #4046)HistoryCompactCheckpointschema V2/V3,openai_codex_remote_v2varianthistory-compact-checkpoint.ts:122,129,139,220matchHistoryCompactCheckpointPrefix()history-compact-checkpoint.ts:569history_compact_checkpoint_recordeddurable eventagent-run.ts:814RuntimeKernel.compactSession(),context_compaction_failed_openruntime-kernel.ts:183(+ai-sdk-turn.ts)DEFAULT_HISTORY_COMPACT_MAX_OUTPUT_TOKENS = 8_000(ai-sdk-compaction-contract.ts:41)min(2 × last reply, 8,000)replyReserveTokens()/MAX_REPLY_RESERVE_TOKENS = 8_000(ai-sdk-compaction.ts:1440)ai-sdk-compaction.ts:528history-compact-summary-validation.ts:78-83toolResultPrune.enabledread-page.ts:25;context-budget-policy.ts:51maka://runtime/tool-results/<event-id>addresstool-result-archive-resource.ts:192compactionTrigger: true,openai.compactioncustom partopenai-codex-history-compactor.ts:65,327AiSdkBackend→AiSdkTurnlast_verifiedand the in-body currency date refresh to 2026-10-10 in both language editions.Verification
grepagainst source, not dist).npm run check:asf-headers: green.AI use
Generated with an AI coding assistant (ZCode / GLM-5.3-Flash) under human direction; every table row was checked against the repository by the assistant and verified by me.
Checklist
translation_status: syncedpreserved)Refs #3522