Skip to content

Commit e70433a

Browse files
committed
fix(sessions): drop dead-end orphan entries when compaction retry forks parentId chain
Compaction retry can write a duplicate compaction event under the same parentId. One side becomes a dead-end with no descendants while the other carries the rest of the chain, so any downstream consumer that reconstructs causal order by walking parentId breaks at the fork. Extend repairSessionFileIfNeeded to detect this on load: when there are two or more compaction siblings sharing one parentId AND exactly one of those compaction siblings has a non-empty subtree, drop the dead-end compaction loser(s). Generic non-compaction entries are NEVER dropped: a session JSONL is a tree, so a legitimate side branch can naturally be a leaf next to a continued sibling, and only the compaction-retry path is known to produce the duplicate-sibling-with-shared-parentId shape this repair targets. Two-branch transcripts where multiple compaction siblings carry real subtrees are also left alone, and so are compaction-sibling groups where no candidate has won yet. Adds 9 regression tests including the canonical compaction-retry pattern, the #79635 [P2] regression that pins the generic-leaf carve-out, a mixed-sibling case (one compaction loser dropped while a non-compaction sibling under the same parent is preserved), nested compaction forks, deliberate two-branch transcripts, no-winner compaction candidate groups, linear transcripts, and legacy entries without parentId. Fixes #48810
1 parent 0e1ea08 commit e70433a

3 files changed

Lines changed: 661 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Docs: https://docs.openclaw.ai
206206
### Fixes
207207

208208
- Gateway/agent: pass the session-key agent id into inline image attachment validation so the first image in a fresh per-agent session uses the agent's vision-capable model override instead of the text-only system default. Fixes #79407. Thanks @pandadev66.
209+
- Sessions/repair: drop dead-end orphan entries that the compaction retry path leaves under a shared parentId, so downstream chain walkers no longer break at the fork. The on-load repair only removes a `type: "compaction"` sibling when it has zero descendants and another `type: "compaction"` sibling under the same parentId already carries the continuation; generic non-compaction leaves and deliberate two-branch transcripts are left alone. Fixes #48810.
209210
- Gateway/maintenance: prune dedupe overflow against a stable excess count and keep active agent retries from starting duplicate runs after cache eviction. (#73841) Thanks @thesomewhatyou.
210211
- Control UI/subagents: suppress internal `subagent_announce` handoff prompts from requester transcripts and hide legacy inter-session wrapper rows so completed subagent results no longer surface runtime context in WebChat history. (#79618) Thanks @joshavant.
211212
- Discord: preserve username target resolution for Discord outbound sends. (#79076) Thanks @vincentkoc.

0 commit comments

Comments
 (0)