fix(infra): swallow mid-stream read errors in session-cost readJsonlRecords - #101062
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
dc1de00 to
79b03b5
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 9:42 PM ET / 01:42 UTC. Summary PR surface: Source +11, Tests +99, Other +47. Total +157 across 3 files. Reproducibility: yes. at source level: current main has Review metrics: none identified. Stored data model 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 diagnostic-only best-effort reader after exact-head merge validation, keeping durable cache scans strict on stream read failures. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main has Is this the best way to solve the issue? Yes: catching only at AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 253b784468c6. Label changesLabel justifications:
Evidence reviewedPR surface: Source +11, Tests +99, Other +47. Total +157 across 3 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
Review history (5 earlier review cycles)
|
79b03b5 to
aa89aa6
Compare
|
Maintainer repair pushed at The shared JSONL reader is strict again, so a failed durable-cache scan cannot stamp partial usage as fresh. Validation:
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
No description provided. |
95dcf76 to
f4df886
Compare
|
Description has been filled in. The PR body now includes the problem, rationale, user impact, and evidence sections. Please let me know if anything else is needed. |
|
No description provided. |
|
No description provided. |
…ecords (openclaw#101062) * fix(infra): swallow mid-stream read errors in session-cost readJsonlRecords * fix(infra): keep usage cache strict on read errors --------- Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…ecords (openclaw#101062) * fix(infra): swallow mid-stream read errors in session-cost readJsonlRecords * fix(infra): keep usage cache strict on read errors --------- Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…ecords (openclaw#101062) * fix(infra): swallow mid-stream read errors in session-cost readJsonlRecords * fix(infra): keep usage cache strict on read errors --------- Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
What Problem This Solves
readJsonlRecordsreads session transcript JSONL through areadlineinterface backed byfs.createReadStream. A mid-stream read failure can reject diagnostic session-log reads. Swallowing that failure in the shared reader is unsafe, though, because the same reader feeds the durable usage cache and could persist a partial scan as a fresh complete entry.Why This Change Was Made
Keep the shared JSONL reader strict so cache scans fail before replacing the durable entry. Add a best-effort wrapper only for
loadSessionLogs, where returning the records read before a stream failure is appropriate diagnostic behavior.The regression coverage also verifies that a failed append-only cache refresh rejects, leaves the previous cache bytes unchanged, and reports the changed transcript as pending instead of fresh.
User Impact
Session-log diagnostics no longer surface raw mid-stream read errors, while incomplete usage scans cannot silently poison the durable usage cache.
Evidence
OPENCLAW_LOCAL_CHECK_MODE=throttled node scripts/run-vitest.mjs src/infra/session-cost-usage.stream-errors.test.ts src/infra/session-cost-usage.test.ts— 67 tests passed.OPENCLAW_LOCAL_CHECK_MODE=throttled node_modules/.bin/tsx scripts/proof/session-cost-usage-readline-errors.mts— EISDIR proof passed.OPENCLAW_LOCAL_CHECK_MODE=throttled OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm check:changed— passed locally; no Testbox/Blacksmith used.codex review --base origin/main— no actionable findings.