fix: fall back to canonical session transcripts during cleanup#69954
fix: fall back to canonical session transcripts during cleanup#69954Blahdude wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes
Confidence Score: 5/5Safe to merge; the bug fix is correct and tests cover both dry-run and apply paths. All remaining findings are P2. The core fallback logic and in-place repair are correct, the guard conditions are sound, and the test mocking strategy is appropriate. The only gap is a minor output inaccuracy in wouldMutate that does not affect actual cleanup behavior. No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 881bd5fbc1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| entry.sessionFile = fallbackTranscriptPath; | ||
| continue; |
There was a problem hiding this comment.
Report repaired transcript paths as cleanup mutations
When this branch repairs entry.sessionFile, the function still returns only a prune count (removed), so downstream summary fields derived from that count can report no mutation even though the store is rewritten. In practice, sessions cleanup --fix-missing --dry-run --json can show missing: 0 / wouldMutate: false for stale-path repair cases, which makes dry-run output inaccurate for operators or automation that rely on it.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Latest ClawSweeper review: 2026-05-20 09:46 UTC / May 20, 2026, 5:46 AM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. at source level. A store entry with a valid PR rating Rank-up moves:
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Port the fallback-and-repair behavior into Do we have a high-confidence way to reproduce the issue? Yes, at source level. A store entry with a valid Is this the best way to solve the issue? No, not as submitted. The fallback-and-repair direction is the right narrow fix, but it needs to be ported to the cleanup service, count repair mutations, and include real behavior proof. Label justifications:
Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 110042d840bb. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
Summary
sessions cleanup --fix-missingcan prune a live session when the persistedsessionFilepath is stale even though the canonical<sessionId>.jsonltranscript still exists.sessionFilemetadata when that canonical transcript exists.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
sessionFileas authoritative and never checked whether the canonical transcript path for the samesessionIdstill existed.sessionFilemetadata with a live canonical transcript.Regression Test Plan (if applicable)
src/commands/sessions-cleanup.test.tsentry.sessionFilepoints to a missing file but the canonical<sessionId>.jsonlexists,--fix-missingshould keep the session and repair the stored path instead of pruning it.User-visible / Behavior Changes
sessions cleanup --fix-missingno longer prunes sessions solely because a stale stored transcript path is missing when the canonical transcript still exists.sessionFilemetadata to the canonical transcript path.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
Steps
sessionId=<id>and a stale but structurally validsessionFile.sessionFiletarget is missing but the canonical<sessionId>.jsonltranscript exists.sessions cleanup --fix-missing.Expected
sessionFileis repaired to the canonical transcript path.Actual
Evidence
Attach at least one:
Human Verification (required)
sessionFileinstead of pruning.Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
sessionIdexists; otherwise cleanup behavior is unchanged.