fix(agents): update session store with rotated session id after post-compaction transcript rotation#88055
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 29, 2026, 4:04 PM ET / 20:04 UTC. Summary PR surface: Source +23, Tests +422. Total +445 across 5 files. Reproducibility: yes. from source inspection: current main's embedded runner reports rotated sessionId/sessionFile after transcript rotation, while the post-run caller still uses the original session id for store/transcript/compaction/delivery paths. I did not run a live compaction scenario. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land one canonical session-store fix that adopts embedded rotated id/file for all post-run persistence, including preserved-state/heartbeat metadata patches, keeps CLI backend IDs as CLI bindings, and includes real after-fix proof. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection: current main's embedded runner reports rotated sessionId/sessionFile after transcript rotation, while the post-run caller still uses the original session id for store/transcript/compaction/delivery paths. I did not run a live compaction scenario. Is this the best way to solve the issue? No, not as written. Carrying an effective rotated id through agent-command is the right direction, but the session-store write must also persist rotated id/file through preserved-state metadata patches so heartbeat or preserved user-facing runs do not retain stale transcript pointers. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against f10bad944ffc. Label changesLabel justifications:
Evidence reviewedPR surface: Source +23, Tests +422. Total +445 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
04f95be to
2874138
Compare
…ction When truncateAfterCompaction rotates the transcript to a new session file, rotateTranscriptAfterCompaction creates a new session ID. The run records this correctly in result.meta.agentMeta.sessionId, but updateSessionStoreAfterAgentRun was called with the original (pre-rotation) sessionId, leaving sessions.json pointing at the old file. Use result.meta.agentMeta.sessionId when available so the session store reflects the rotated file path. Closes openclaw#88040
2874138 to
c3d3c77
Compare
|
Landing proof for Behavior addressed: Exact steps or command run after this patch:
Evidence after fix:
Known proof gap:
Thanks @1052326311. |
Summary
When
truncateAfterCompaction: truerotates an OpenClaw transcript during an agent run, the embedded runner reports the new OpenClaw session ID and transcript file inresult.meta.agentMeta.sessionId/sessionFile. The previous patch updated only the first session-store write, leaving later transcript persistence, CLI compaction lifecycle, and delivery freshness checks on the old pre-rotation session ID.This change carries one effective rotated OpenClaw session identity through the full post-run path, persists the rotated transcript file/family metadata, and keeps backend CLI session IDs in their existing CLI binding fields instead of treating them as OpenClaw session IDs.
Closes #88040
Change Type
Scope
Real behavior proof
Behavior addressed: automatic compaction transcript rotation no longer leaves post-run session persistence on the stale pre-rotation OpenClaw session ID.
Real environment tested: local OpenClaw checkout on macOS; branch rebased onto
origin/mainat07870dff45.Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/agent-command.compaction-rotation.test.ts src/agents/agent-command.live-model-switch.test.ts src/agents/command/session-store.test.tsEvidence after fix: 6 Vitest project-files passed, 128 tests passed. The new regression runs two
agentCommandturns through real session resolution,sessions.json, and transcript persistence: the first turn simulates automatic rotation to a successor transcript, then the second turn resumes by the rotated session ID and verifies it uses the rotated transcript file.Observed result after fix: post-run store update, transcript persistence, CLI compaction lifecycle, and delivery freshness all receive the rotated OpenClaw session ID only when a rotated
sessionFileis reported; backend CLI session IDs remain CLI bindings.What was not tested: no live model/provider compaction run.
pnpm check:changedwas attempted through Blacksmith Testboxtbx_01kstjya6zkexr2xqpv0mfth91, but currentorigin/mainfailed core-test typecheck in unrelatedsrc/config/sessions.cache.test.tslines 743, 772, 791, and 796.Autoreview:
/Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode localon the added regression reported no accepted/actionable findings. Earlier branch review of the implementation also reported no accepted/actionable findings.