Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
- Related: [Bug]: Repeated request-local compaction summaries dominate long-session latency #1023 concerns repeated request-local summary generation and latency. This report concerns loss of the previous summary from the next summary's input, even when active history is actually rewritten. Fixing reuse alone does not establish summary continuity.
- [Bug]: Completion gate reopens a successful remote upload; compaction loses its receipt #814 describes mechanical compaction removing an upload receipt; it does not describe the summary-to-summary filtering defect below.
Version and environment
- Inspected deployed MOI Astra revision:
e6b468123315ecbed8ab530a30374ccbbde0e2a4. - Rechecked latest
mainon October 16, 2026:155dd4fc227deb90c23d9511984fda1a0fbc273f; the defect remains in the inspected source. - The reproduction is an offline, isolated source-level test using synthetic messages. It does not depend on a particular model or provider.
Actual behavior
A successful pre-turn compaction installs its summary as a system-role message at the beginning of active history. When a later compaction summarizes a prefix containing that message, summary-input preparation filters it out. The next summary model therefore does not receive the earlier summary's facts through this history projection.
If the new summary passes structural validation and reduces estimated tokens, it replaces that prefix, including the old summary. Facts that existed only in the previous summary can disappear from the active model context.
Example:
First compacted active history:
system: S1, containing historical constraint F
recent conversation
Later summary input:
rebuilt stable system prompt
selected conversation rounds (S1 is absent)
compact instruction
After an accepted second compaction:
system: S2, generated without S1
retained recent suffix
This is not merely an LLM choosing to omit a fact: the prior summary is deterministically absent before the summary request is sent. The eventual semantic impact depends on whether those facts are available elsewhere in retained or retrieved context.
Potential user-visible consequences include forgotten constraints or completed work, repeated exploration/actions, and answers drifting from earlier decisions. This report does not claim that every compaction loses facts, that a particular production answer has been proven wrong for this reason, or that the durable audit transcript is deleted.
Expected behavior
When compacting history that already contains an accepted summary, the next summarization must receive that summary's historical task state together with the newly covered messages. Installing the replacement must not discard the only active representation of earlier history before it has been available to the summarizer.
Keep historical summaries distinct from stable system instructions and runtime authority. Do not solve this by blindly forwarding every system message, changing trust boundaries, or reclassifying runtime controls as user intent.
Steps to reproduce
Deterministic input-projection reproduction
Use this synthetic history, representing a prefix selected for a second compaction:
use serde_json::{json, Value};
use astra_turn_core::cloud::{compact_prompt, grouping};
const FACT: &str = "HISTORICAL_CONSTRAINT_SENTINEL_42";
let history = vec![
json!({
"role": "system",
"content": format!(
"[Conversation compacted — 20 messages summarized]\n\n\
### Primary Request\n{FACT}\n\
### Pending Tasks\nFinish\n\
### Current Work\nImplementation\n\
### Current State\nIn progress"
)
}),
json!({"role": "user", "content": "Continue the current task"}),
json!({"role": "assistant", "content": "Working on the next step"}),
];
let (preamble, rounds) = grouping::group_by_api_round(&history);
assert!(serde_json::to_string(&preamble).unwrap().contains(FACT));
let projected: Vec<Value> = rounds.iter()
.flat_map(|round| round.summary_messages().cloned())
.collect();
assert!(!serde_json::to_string(&projected).unwrap().contains(FACT));
// The alternate text-rendering path also discards the old summary.
let rendered = compact_prompt::render_messages_for_summary(&history);
assert!(!rendered.contains(FACT));
assert!(rendered.contains("Continue the current task"));
// Structural validation does not detect the missing historical fact.
let replacement = "### Primary Request\nContinue\n\
### Pending Tasks\nFinish\n\
### Current Work\nNext step\n\
### Current State\nIn progress";
assert!(compact_prompt::validated_structured_summary(replacement).is_some());
assert!(!replacement.contains(FACT));generate_inline_summary uses exactly the rounds-only projection demonstrated above: it takes group_by_api_round(history).1, prepends the separately supplied stable system messages, and appends the summary instruction. The supplied stable prompt is not a carry-forward of the old historical summary.
Executed validation: an isolated Rust harness copied grouping.rs and compact_prompt.rs unchanged from the deployed revision, with inert adapters for unrelated instrumentation/provenance on these plain synthetic messages. cargo run --offline --quiet passed the assertions above. These two source files and the relevant summary.rs are unchanged in the checked latest main. This was not a live full-runtime test or a real-provider semantic-quality experiment.
Runtime regression to add
- Run two successive accepted pre-turn compactions through the normal entrypoint with a recording/mock
SummaryLlmClient. - Make the first summary contain a unique historical fact absent from the recent suffix and stable prompt.
- Append enough synthetic history to trigger a second compaction while retaining a valid tool-pair boundary and latest human turn.
- Inspect the actual second summary request: the historical fact must be present. With the current projection it is absent.
- Have the mock preserve the fact only if it received it. Assert that the installed second summary still carries the fact, the intended recent suffix survives, and estimated token reduction is positive.
This separates deterministic prompt-construction correctness from a live model's willingness to retain particular facts.
Additional information: root cause and source evidence
All links below are pinned to checked latest main 155dd4fc227deb90c23d9511984fda1a0fbc273f.
- Summary producer stores historical state as
role=system.apply_pre_turn_summaryconstructs that message at lines 1219–1222 and installs the candidate at line 1233. - The next summary invocation receives that prefix as history, not as its stable prompt.
maybe_pre_turn_compacttakespipeline.system_messages, then callsgenerate_inline_summary(&system_messages, &state.messages[..spill_count], ...)at lines 22829–22840. - Inline summary generation discards history's system preamble.
generate_inline_summaryuses only tuple element.1.group_by_api_roundplaces leading system messages in the separate preamble; system messages after a round has started are also excluded from rounds. - The text-rendering path has the same incompatible assumption.
render_messages_for_summaryskips all system messages, with the comment that the runtime will reinject them. That assumption is not sufficient for a historical summary about to be replaced. - Replacement removes the previous representation.
prepare_prefix_summaryconstructs[new_summary] + messages[spill_count..]; the old prefix does not survive. Token-reduction checks do not establish semantic continuity.validated_structured_summarychecks nonempty content and required section headings, not preservation of prior facts; this is not a proposal to add arbitrary semantic string matching to production validation.
The root contract mismatch is between historical summary production and summary-input projection: the producer writes a system-role history summary, while consumers treat system-role history as reinjectable instructions and omit it. Please fix this in the canonical compaction owner rather than adding caller-specific copies of summary carry-forward logic.
Suggested additional coverage: three or more compaction generations; inline and rendered summary paths; resume with an existing summary; semantic and append-only projections; preservation of tool-call/result pairing and runtime-authority boundaries. Normal stable system instructions must not be duplicated into historical summaries as a side effect.
Related: #1023. Repeated summarization can expose this defect more often, but the latency/reuse issue and prior-summary continuity require separate regression assertions.
No credentials, customer prompts, private endpoints, or production identifiers are included in the reproduction.
Activity
fix(compaction): keep repeated summary requests user-first
fix(runtime): preserve summary continuity and correlate MCP settlement (
XuPeng-SH commentedon Oct 17, 2026
Fixed on main by #1031 (merge
9760aeaf89a2dcc936b246e99ded30345a960ac4). Recognized prior summaries reach subsequent inline/rendered summary requests as historical evidence, including retries, canonical resume and artifact spills; stable instructions and runtime authority remain separate.Regressions cover three accepted generations, both legacy resume envelopes, retained tool-pair/suffix boundaries and the actual provider request builder, including Bedrock/Nova user-first ordering. Exact-head independent review: #1031 (review) (
1edeec65287bec34ad3f304a82c23750f7552975), with 71 focused tests and 50 summary-to-Bedrock projections.Closing the deterministic summary-input continuity defect as completed. This does not assert a live model's semantic fidelity, deployment/release acceptance, or resolution of #1023's separate repeated-summary latency issue.
perf(compaction): reuse accepted request summaries (#1033)