fix(sessions): recover store from stale temp artifacts safely#79910
fix(sessions): recover store from stale temp artifacts safely#79910wAngByg wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 11:46 PM ET / 03:46 UTC. Summary PR surface: Source +174, Tests +254. Total +428 across 4 files. Reproducibility: yes. from source inspection: current main returns the initialized empty store after a zero-byte or malformed sessions store instead of recovering from sibling temp artifacts. I did not run a local filesystem 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrowed stale-temp recovery after maintainers accept the fallback semantics, coordinate it with stale-temp deletion behavior, and track doctor/rebuild diagnostics separately if still required. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main returns the initialized empty store after a zero-byte or malformed sessions store instead of recovering from sibling temp artifacts. I did not run a local filesystem repro because this review is read-only. Is this the best way to solve the issue? Yes for the narrowed stale-temp failure, with maintainer acceptance required. The PR uses the existing atomic-writer artifact contract and avoids AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +174, Tests +254. Total +428 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
|
337c561 to
52e391d
Compare
390a36b to
4e8f6e1
Compare
|
Re-review would be useful after the latest fixes here. The remaining items from the previous review looked narrow and file-local:
If those are now addressed, this looks like a small, mergeable recovery hardening PR with useful |
4e8f6e1 to
fefaab1
Compare
fefaab1 to
83d2b00
Compare
5503abd to
453daa4
Compare
453daa4 to
b021f4f
Compare
b021f4f to
163fd53
Compare
09e57cb to
c4af5b1
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Heads up: this PR needs to be updated against current |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review P1/P2 findings addressed in
Current-head proof/checks: Real behavior proof is green; focused |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Obsolete: the runtime no longer performs atomic sessions.json writes, so new stale .tmp artifacts cannot accumulate; the legacy sweep that remains (disk-budget artifact cleanup) already reclaims old ones. |
Summary
sessions.jsonzero-byte or malformed while an older writer temp artifact still contains valid session metadata.loadSessionStorecan now recover from stale session-store temp artifacts produced by the real atomic writer (sessions.json.<pid>.<uuid>.tmpand legacysessions.json.<uuid>.tmp).sessions.json.bakand no longer rewrites the primary store from the read path. This avoids inventing a.bakrecovery contract and removes the race where recovery could overwrite a newer primary written concurrently.fstat, so the integrity/staleness checks are bound to the file actually read.Change Type
Scope
Linked Issue/PR
Real behavior proof
.bakas an automatic recovery source.openclaw/openclaw:main, head036916aa5a37fb883bf4a3198ec2ac77f67e3b50.loadSessionStorepath on the PR branch after rebase:.bakas a recovery source. Focused regression coverage also passed:store-load.recovery.test.ts17/17,oxfmt --checkpassed for the changed files, and directoxlinton the changed files exited successfully.Notes for reviewers
This revision intentionally narrows the previous branch:
.bakpromotion because current main does not have a demonstratedsessions.json.bakwriter contract.