Repository navigation
fix(sessions): propagate compaction transcript read errors - #125741
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 4:53 AM ET / 08:53 UTC. ClawSweeper reviewWhat this changesThis PR makes session compaction surface SQLite transcript-read errors through Gateway instead of treating them as empty transcripts, with focused regressions. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: current main still converts three transcript-read failures into successful “no transcript” results; this PR removes those conversions and covers the Gateway-visible error outcome. No correctness finding was identified, but exact-head CI is not yet green. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherSession compaction reads persisted SQLite transcript events before either trimming them or asking an embedded runtime to compact them. Gateway and the CLI then return a no-op for a successful empty read or an actionable error for a storage failure. flowchart LR
A[CLI or Gateway request] --> B[Session compaction]
B --> C[SQLite transcript read]
C --> D{Read succeeds?}
D -->|empty| E[Successful no-op]
D -->|events| F[Trim or model compaction]
D -->|error| G[Gateway unavailable error]
E --> H[Caller result]
F --> H
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +179. Total +179 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the direct error propagation and Gateway boundary regressions, then land once the exact PR head has a satisfactory CI result. Do we have a high-confidence way to reproduce the issue? Yes in source: rejecting any of the three current-main transcript reads enters a catch-to-empty path and returns the ordinary no-transcript outcome; the PR’s Gateway harness targets those paths. Is this the best way to solve the issue? Yes: removing the failure-erasing conversions lets the existing Gateway UNAVAILABLE translation handle storage errors while successful empty reads remain no-ops. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f99a0c638ac5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Session compaction had three
.catch(() => [])paths around authoritative transcript SQLite reads: the initial compaction read, the model-compaction re-read, and the--max-linespreflight. Storage open/read/decode failures therefore became successful{compacted:false, reason:"no transcript"}outcomes. Operators and automation were told nothing was wrong while the transcript store was unavailable or corrupt.Why This Change Was Made
Remove the failure-erasing catches at the storage boundary. Existing Gateway error translation now returns
UNAVAILABLEwith the actionable storage error. A successful read containing zero rows remains the only source of the ordinaryno transcriptno-op. No protocol, schema, persistence format, or threshold changes.User Impact
openclaw sessions compactand Gateway callers now fail visibly on transcript storage errors instead of reporting success. Truly empty sessions behave exactly as before.Evidence
ok:true; 2 genuine-empty cases passed.