mirror of
https://github.com/ultraworkers/claw-code.git
synced 2026-05-30 20:04:17 +08:00
fix: flatten prior compaction highlights to prevent nesting compounding
Instead of re-nesting prior highlights under '- Previously compacted context:', flatten them directly into the top-level list with '- ' prefix. This prevents each compaction cycle from adding a nesting layer, which inflated the summary by ~depth * overhead per turn.
This commit is contained in:
parent
b071fac2cf
commit
5a9550d388
@ -291,13 +291,11 @@ fn merge_compact_summaries(existing_summary: Option<&str>, new_summary: &str) ->
|
|||||||
|
|
||||||
let mut lines = vec!["<summary>".to_string(), "Conversation summary:".to_string()];
|
let mut lines = vec!["<summary>".to_string(), "Conversation summary:".to_string()];
|
||||||
|
|
||||||
|
// Flatten prior highlights directly — do NOT re-nest them under
|
||||||
|
// "- Previously compacted context:" or the nesting compounds with each
|
||||||
|
// compaction cycle, inflating the summary by ~depth * overhead per turn.
|
||||||
if !previous_highlights.is_empty() {
|
if !previous_highlights.is_empty() {
|
||||||
lines.push("- Previously compacted context:".to_string());
|
lines.extend(previous_highlights.into_iter().map(|line| format!("- {line}")));
|
||||||
lines.extend(
|
|
||||||
previous_highlights
|
|
||||||
.into_iter()
|
|
||||||
.map(|line| format!(" {line}")),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !new_highlights.is_empty() {
|
if !new_highlights.is_empty() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user