Repository navigation
Description
Existing issue check
- Searched existing issues for compaction/summary reports; no matching issue found in the initial search.
Version and environment
Astra 0.2.11, Server + CLI Edge on Linux x86_64. The deployment was built from 2873a950f2c9fea00343757933e96070d1631596. Code references below are pinned to that deployed revision and have been checked against its Git blobs.
The affected long-running session used Kimi-K3 through an OpenAI-compatible provider, with a configured context window of 262,144 tokens and maximum completion of 65,536 tokens. The smaller context limit was required by an observed upstream context-window rejection, despite the provider catalog advertising a larger window.
Actual behavior
Once the long session enters a high-pressure compaction tier, successive tool/model rounds repeatedly invoke required_compaction using the same Kimi-K3 model. Summary generation dominates task latency.
Durable inference records for one run on 2026-10-16, during approximately 13:00–13:57 UTC+8:
| Purpose | Successful calls | Total duration | Mean duration |
|---|---|---|---|
required_compaction |
29 | 2,496.8 seconds | 86.1 seconds |
primary_agent |
28 | 547.8 seconds | 19.6 seconds |
Thus approximately 82% of the successful inference duration in this sample was spent generating compaction summaries. There was also a separate compaction invocation with delivery_unknown after 201 seconds, excluded from the successful-call totals.
Example sequence, UTC+8:
- 13:47:19–13:50:43: required compaction, approximately 203 seconds.
- 13:50:43–13:51:01: primary model call, approximately 18 seconds.
- 13:51:07–13:53:12: required compaction again, approximately 125 seconds.
This is a repeated-summary/latency problem. It is not a claim that every compaction produces zero token savings or that Astra never rewrites active history.
Expected behavior
After successful compaction, subsequent rounds should reuse the compacted representation and its covered-history boundary. Newly appended messages should not cause a fresh summary of substantially the same history on every provider request.
Keep the complete transcript available for audit/history, while calculating compaction pressure against the effective context that subsequent requests actually reuse. A no-op compaction should not incur another expensive summary call without a clear need.
Steps to reproduce
- Use Server + CLI Edge with a model having an effective context window around 262k tokens.
- Continue a long coding session until it enters
CompactHistoryor a higher compaction tier. - Execute several successive tool/model rounds that append relatively small amounts of new content.
- Inspect durable inference invocations grouped by session, run, purpose, and creation time.
- Observe repeated
required_compactioncalls alternating with primary model calls, often taking substantially longer than the primary calls.
This was observed in a live session; a minimal deterministic reproduction is still needed.
Code evidence and suspected mechanism
The following are directly visible in the inspected code:
compact_with_memoriacallsgenerate_compact_summary(messages, ...)whenever a summary client exists andcfg.should_summarize(params.tier)holds. The condition does not requireresult.boundaryto exist or check whether an existing summary already covers the input. The summary is returned throughresult.runtime_contexts.- Server wire preparation uses
compact_result.messagesfor the current provider request and adds its summary as runtime context withCurrentUserTurnlifetime. This path does not install that compacted message list asstate.messages. - Astra also has a distinct
apply_pre_turn_summarypath that really rewritesstate.messages. Therefore the failure should be investigated as coordination/reuse between compaction paths, rather than absence of history compaction everywhere. record_context_compactionsadvancesstate.compact_tier_applied; the pre-turn compaction guard skips the history-rewriting path once this reachesCompactHistory. Whether that interaction contributes to this particular live sequence needs a targeted reproduction.
The suspected mechanism is that request-local summary generation repeatedly runs against a history projection whose high pressure persists, without a reusable compaction checkpoint in this path. This explains the observed alternation, but exact trigger/state transitions should be covered by a regression test.
Reference implementation and suggested validation
For comparison, Codex main 6ae8b8aa7c installs compaction results through Session::replace_compacted_history and recomputes token usage. The original audit transcript can remain separate from the active model context. This is a useful lifecycle reference, not a requirement to copy Codex's provider-specific format.
Suggested regression coverage:
- Multiple small tool rounds after a successful compaction reuse its result instead of repeatedly summarizing the same prefix.
- Effective context pressure decreases after adopting a compaction result.
- New user messages, tool-call/result pairs, and required runtime authority survive compaction and resume.
- Wire-compaction observations do not accidentally prevent a necessary active-history rewrite.
- No-op compaction, summary failure, and cancellation have bounded retries and do not create repeated-summary loops.
No credentials, private endpoints, raw prompts, or proprietary task contents are included here.
Activity
fix(compaction): require valid authority before adopting summaries
perf(compaction): reuse accepted request summaries (#1033)
XuPeng-SH commentedon Oct 20, 2026
Cleanup: merged PR #1033 installs accepted summaries into canonical working history so later rounds reuse them instead of repeatedly summarizing the same history. Its #1031 continuity dependency is also merged. Closing this issue as implemented.