Repository navigation
fix(sessions): rotate reset transcripts and clear compaction state - #80251
fredrikmacmini wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 11:48 PM ET / 03:48 UTC. Summary PR surface: Source +83, Tests +197. Total +280 across 4 files. Reproducibility: yes. at source level: seed a session entry with compactionCount and compactionCheckpoints, call sessions.reset, and current main copies both fields into the new entry. I did not run a local repro because this review is read-only. Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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: Refresh onto current main, drop the duplicate rotation helper, keep the compaction reset cleanup and focused regression coverage, then supply redacted branch-live gateway/session-store proof. Do we have a high-confidence way to reproduce the issue? Yes at source level: seed a session entry with compactionCount and compactionCheckpoints, call sessions.reset, and current main copies both fields into the new entry. I did not run a local repro because this review is read-only. Is this the best way to solve the issue? No for the submitted branch; clearing reset compaction state is the right narrow behavior, but the branch should reuse current main's reset transcript rotation helper instead of adding a second grammar. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +83, Tests +197. Total +280 across 4 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
|
|
Adding live behavior evidence for the remaining compaction-state half of this PR. This is not a live install of this PR branch. It is evidence from an installed OpenClaw gateway showing that the bug this PR fixes is real in a channel runtime, and that clearing reset compaction state is the right mitigation shape. Environment:
Observed sequence:
Sanitized state shape before the local mitigation: {
"status": "failed",
"hasActiveRun": false,
"compactionCheckpointCount": 18,
"latestCompactionCheckpoint": {
"reason": "overflow-retry"
}
}The important point is that this was a post-reset/fresh channel row still inheriting old overflow-retry checkpoint lineage. That makes reset less clean than users expect and can keep the next turn under stale compaction pressure. Local installed-dist mitigation applied: compactionCount: 0,
compactionCheckpoints: []After applying that mitigation, restarting the gateway, and resetting the affected Slack channel again, the new session state came up clean: {
"systemSent": false,
"inputTokens": 0,
"outputTokens": 0,
"totalTokens": 0,
"compactionCheckpointCount": 0,
"hasActiveRun": false
}Post-mitigation validation:
Interpretation: |
|
@fredrikmacmini thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
Thank you for tracking down both reset failure modes and providing focused regression cases. I checked this against current |
Summary
Fix
sessions.resetso a reset creates a fresh generated transcript path for the new session id and clears stale compaction state.This source patch makes permanent the behavior we previously had to protect with a local installed-dist hotfix: reset should not keep pointing at an old heavy transcript/checkpoint lineage after generating a new
sessionId.Problem
Before this change,
sessions.resetgenerated a newsessionIdbut could preserve the oldsessionFile,compactionCount, andcompactionCheckpoints. In practice that can make a reset session continue to inherit old heavy transcript/checkpoint state, defeating the reset and risking immediate context/compaction failures on the next turn.Changes
resolveRotatedGeneratedSessionFilePath(...)for safe generated transcript rotation.<oldSessionId>.jsonlto<newSessionId>.jsonl.<oldSessionId>-topic-ops.jsonl→<newSessionId>-topic-ops.jsonl.resolveSessionFilePath(...)path.compactionCount: 0andcompactionCheckpointsleft undefined (omitted when serialized).Real behavior proof
sessions.resetshould not keep a reset session attached to an old heavy transcript file or stale compaction checkpoint lineage after generating a newsessionId.goran/session-reset-sourcefix-20260510.Tests
corepack pnpm exec oxfmt --check --threads=1 src/config/sessions/paths.ts src/config/sessions/sessions.test.ts src/gateway/session-reset-service.ts src/gateway/server.sessions.reset-models.test.tscorepack pnpm exec oxlint src/config/sessions/paths.ts src/config/sessions/sessions.test.ts src/gateway/session-reset-service.ts src/gateway/server.sessions.reset-models.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.runtime-config.config.ts src/config/sessions/sessions.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/server.sessions.reset-models.test.ts src/gateway/server.sessions.reset-hooks.test.ts src/gateway/server.sessions.compaction.test.ts src/gateway/session-utils.fs.test.tsReview evidence
A local Claude Opus/Max read-only review first returned
APPROVE_WITH_CHANGESbecause helper/topic/custom-path test coverage was incomplete. After adding those tests, the final Claude review returnedAPPROVEwith no remaining blocker.Notes