Commit 12e7f91
fix(compaction): previous summary is duplicated when a later split degrades (#109828)
* fix(compaction): stop duplicating the previous summary when a later split degrades
summarizeInStages stamped a merged result as generic-fallback whenever ANY
split degraded. compaction-safeguard reads that kind to decide whether to
restore the previous summary, on the documented assumption that "a generic
fallback means redistillation never happened".
That assumption only holds for chunk 0. summarizeViaLLM prepends the previous
summary as the first message, so it always lands in the oldest chunk. When
that chunk summarizes fine but a later one degrades, the merge already carries
the redistilled summary — and the safeguard prepends it a second time. Every
subsequent compaction that has any degraded split re-adds it again, so a PR
that exists to stop token burn compounds it instead.
The kind now reports whether the oldest split degraded, which is exactly the
question the only consumer asks. The coarse "any chunk" flag is gone rather
than kept alongside the precise one, so there is a single source of truth.
Behavior for a degraded oldest split is unchanged: the previous summary is
genuinely lost there and restoring it is still correct.
* test(compaction): pin previous-summary restoration boundary
---------
Co-authored-by: Peter Steinberger <[email protected]>1 parent 2e64628 commit 12e7f91
3 files changed
Lines changed: 30 additions & 4 deletions
File tree
- src/agents
- agent-hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2021 | 2021 | | |
2022 | 2022 | | |
2023 | 2023 | | |
| 2024 | + | |
2024 | 2025 | | |
2025 | 2026 | | |
2026 | 2027 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
82 | 103 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
417 | 419 | | |
418 | 420 | | |
419 | 421 | | |
| |||
422 | 424 | | |
423 | 425 | | |
424 | 426 | | |
425 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
426 | 430 | | |
427 | 431 | | |
428 | 432 | | |
| |||
445 | 449 | | |
446 | 450 | | |
447 | 451 | | |
448 | | - | |
| 452 | + | |
449 | 453 | | |
450 | 454 | | |
451 | 455 | | |
| |||
486 | 490 | | |
487 | 491 | | |
488 | 492 | | |
489 | | - | |
| 493 | + | |
490 | 494 | | |
491 | 495 | | |
492 | 496 | | |
| |||
0 commit comments