From de9031da22bef3ac74155e616a8afbb16e5d3914 Mon Sep 17 00:00:00 2001 From: JT <56984887+joetomasone@users.noreply.github.com> Date: Tue, 3 Mar 2026 01:36:19 -0500 Subject: [PATCH] fix: improve compaction summary instructions to preserve active work (#8903) fix: improve compaction summary instructions to preserve active work Expand staged-summary merge instructions to preserve active task status, batch progress, latest user request, and follow-up commitments so compaction handoffs retain in-flight work context. Co-authored-by: joetomasone <56984887+joetomasone@users.noreply.github.com> Co-authored-by: Josh Lehman --- CHANGELOG.md | 1 + src/agents/compaction.ts | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19ed1e341..9fb1382e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Agents/Compaction continuity: expand staged-summary merge instructions to preserve active task status, batch progress, latest user request, and follow-up commitments so compaction handoffs retain in-flight work context. (#8903) thanks @joetomasone. - LINE/auth boundary hardening synthesis: enforce strict LINE webhook authn/z boundary semantics across pairing-store account scoping, DM/group allowlist separation, fail-closed webhook auth/runtime behavior, and replay/duplication controls (including in-flight replay reservation and post-success dedupe marking). (from #26701, #26683, #25978, #17593, #16619, #31990, #26047, #30584, #18777) Thanks @bmendonca3, @davidahmann, @harshang03, @haosenwang1018, @liuxiaopai-ai, @coygeek, and @Takhoffman. - LINE/media download synthesis: fix file-media download handling and M4A audio classification across overlapping LINE regressions. (from #26386, #27761, #27787, #29509, #29755, #29776, #29785, #32240) Thanks @kevinWangSheng, @loiie45e, @carrotRakko, @Sid-Qin, @codeafridi, and @bmendonca3. - LINE/context and routing synthesis: fix group/room peer routing and command-authorization context propagation, and keep processing later events in mixed-success webhook batches. (from #21955, #24475, #27035, #28286) Thanks @lailoo, @mcaxtr, @jervyclaw, @Glucksberg, and @Takhoffman. diff --git a/src/agents/compaction.ts b/src/agents/compaction.ts index 45f32cccd..8cc5b4f82 100644 --- a/src/agents/compaction.ts +++ b/src/agents/compaction.ts @@ -14,9 +14,20 @@ export const MIN_CHUNK_RATIO = 0.15; export const SAFETY_MARGIN = 1.2; // 20% buffer for estimateTokens() inaccuracy const DEFAULT_SUMMARY_FALLBACK = "No prior history."; const DEFAULT_PARTS = 2; -const MERGE_SUMMARIES_INSTRUCTIONS = - "Merge these partial summaries into a single cohesive summary. Preserve decisions," + - " TODOs, open questions, and any constraints."; +const MERGE_SUMMARIES_INSTRUCTIONS = [ + "Merge these partial summaries into a single cohesive summary.", + "", + "MUST PRESERVE:", + "- Active tasks and their current status (in-progress, blocked, pending)", + "- Batch operation progress (e.g., '5/17 items completed')", + "- The last thing the user requested and what was being done about it", + "- Decisions made and their rationale", + "- TODOs, open questions, and constraints", + "- Any commitments or follow-ups promised", + "", + "PRIORITIZE recent context over older history. The agent needs to know", + "what it was doing, not just what was discussed.", +].join("\n"); const IDENTIFIER_PRESERVATION_INSTRUCTIONS = "Preserve all opaque identifiers exactly as written (no shortening or reconstruction), " + "including UUIDs, hashes, IDs, tokens, API keys, hostnames, IPs, ports, URLs, and file names.";