mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-11 12:18:59 +00:00
FinalizeStage forwards state.Prune.MidLoopCompacted into MaybeSummarize so a mid-loop compaction gets persisted (TruncateHistory + IncrementCompaction) instead of being thrown away and redone next turn. Nothing asserted the flag value: TestFinalizeStage_MaybeSummarize_Called binds it as `_ bool`, so hardcoding `false` at the call site keeps the whole suite green while silently restoring the per-turn re-compaction loop and stalling the cumulative compaction count episodic depends on. Adds two cases driving the real NewDefaultPipeline().Run(): - a history large enough to force prune-stage compaction must reach MaybeSummarize with midLoopCompacted=true - a small history must compact nothing and report false, so the flag cannot simply be pinned true Mutation-verified: with the finalize call site hardcoded to false the new test fails while the pre-existing pipeline and agent suites still pass. Test-only change. Co-authored-by: nguyenha935 <nguyenha935@users.noreply.github.com>