← Back to Pull requests

docs: verify the compaction projection docs against main (#3522) #6052

Closed
unknown closed this pull request without merging on Oct 13, 2026 00:47 UTC
View on GitHub
unknown unknown commented on Oct 10, 2026 10:23 UTC
Author

Summary

Second verification pass over the Context-and-compaction slice of #3522: both llm-compaction-events-log-projection-draft documents (en + synced zh-CN), read line-by-line against current main. 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) — not AiSdkBackend.buildPriorMessages(). The method moved out of the backend since the first pass; both language editions corrected.

Everything else re-verified and holds:

| Claim | Verified against |
| --- | --- |
| Code map: 14 source paths | all exist under packages/runtime/src, packages/storage/src, packages/runtime-host/src/server |
| Verification entry points: 10 test paths | all exist (incl. sqlite-core-execution-store.test.ts — the agent-run-store.test.ts citation flagged on the issue was already corrected in #4046) |
| HistoryCompactCheckpoint schema V2/V3, openai_codex_remote_v2 variant | history-compact-checkpoint.ts:122,129,139,220 |
| matchHistoryCompactCheckpointPrefix() | history-compact-checkpoint.ts:569 |
| history_compact_checkpoint_recorded durable event | agent-run.ts:814 |
| RuntimeKernel.compactSession(), context_compaction_failed_open | runtime-kernel.ts:183 (+ ai-sdk-turn.ts) |
| 8,000-token compaction output cap | DEFAULT_HISTORY_COMPACT_MAX_OUTPUT_TOKENS = 8_000 (ai-sdk-compaction-contract.ts:41) |
| Reply reserve min(2 × last reply, 8,000) | replyReserveTokens() / MAX_REPLY_RESERVE_TOKENS = 8_000 (ai-sdk-compaction.ts:1440) |
| 16-entry malformed-input fingerprint circuit | ai-sdk-compaction.ts:528 |
| Large-fold gate: >10,000 input tokens ⇒ ≥200 output tokens | history-compact-summary-validation.ts:78-83 |
| 7,500-byte tool-result prune page; toolResultPrune.enabled | read-page.ts:25; context-budget-policy.ts:51 |
| maka://runtime/tool-results/<event-id> address | tool-result-archive-resource.ts:192 |
| Codex compactionTrigger: true, openai.compaction custom part | openai-codex-history-compactor.ts:65,327 |
| AiSdkBackend → AiSdkTurn | fixed |

last_verified and the in-body currency date refresh to 2026-10-10 in both language editions.

Verification

  • Every path/symbol in the table resolved on this branch (grep against source, not dist).

  • npm run check:asf-headers: green.

  • Documentation-only change (two class-name corrections, date refreshes); no test suites affected.
  • 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

  • One subsystem only (Context and compaction), per the issue's contributing rules

  • Paired translations move together (translation_status: synced preserved)

  • Refs #3522
  • Diff: 373 lines (+279 / -94) across 4 files Reviewer: ggbdpq Review duration: 3744m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 373 lines diff across 4 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #6052"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.8% (MEDIUM) · Higher = larger blast radius
    47.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.9% · Safe to merge
    18.9%
    Repository