fix(anthropic): complete transcript reverse-scan windows across short reads#109431
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 9:09 AM ET / 13:09 UTC. Summary PR surface: Source +10, Tests +128. Total +138 across 2 files. Reproducibility: yes. The exported production reader was run against the same real on-disk transcript before and after the patch with FileHandle reads capped to 4 KiB; baseline fails immediately and the branch matches the uncapped two-page result while preserving the EOF control. 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. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the plugin-local fill loop and both positive-short-read and premature-EOF regressions, then merge the rebased exact head once required checks are green or their failures are conclusively unrelated. Do we have a high-confidence way to reproduce the issue? Yes. The exported production reader was run against the same real on-disk transcript before and after the patch with FileHandle reads capped to 4 KiB; baseline fails immediately and the branch matches the uncapped two-page result while preserving the EOF control. Is this the best way to solve the issue? Yes. Completing the already-bounded window in the owning Anthropic plugin mirrors the existing forward scan and merged sibling patterns without changing APIs, limits, configuration, or ownership boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8020dd3e0830. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +10, Tests +128. Total +138 across 2 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)
|
3695111 to
223e79b
Compare
|
@clawsweeper re-review Added standalone real-behavior proof using the exported production reader with a real on-disk transcript and capped real FileHandle.read calls. Before the fix, the first positive short read throws; after the fix, pagination is identical across 82 real short reads, while the zero-byte premature-EOF control still throws. The PR remains a focused 2-file diff and has been rebased onto e0478e2. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
… reads readLocalClaudeTranscriptPage filled each reverse-scan window with a single positional read and threw "Claude transcript changed while it was being read" whenever bytesRead !== size. A positional read may return fewer bytes than requested inside an unchanged file, so a benign short read failed the transcript page load with a message implying the file changed. The forward metadata scan in the same file already loops short reads; the reverse scan did not. Fill each window across short reads, advancing both the buffer offset and the file position. A zero-byte read before the window is filled is premature EOF and still throws the same error. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
223e79b to
3899599
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(anthropic): complete transcript reverse-scan windows across short reads This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Merged via squash.
|
… reads (openclaw#109431) * fix(anthropic): complete transcript reverse-scan windows across short reads readLocalClaudeTranscriptPage filled each reverse-scan window with a single positional read and threw "Claude transcript changed while it was being read" whenever bytesRead !== size. A positional read may return fewer bytes than requested inside an unchanged file, so a benign short read failed the transcript page load with a message implying the file changed. The forward metadata scan in the same file already loops short reads; the reverse scan did not. Fill each window across short reads, advancing both the buffer offset and the file position. A zero-byte read before the window is filled is premature EOF and still throws the same error. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * test(anthropic): tighten transcript short-read coverage --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* origin/main: (24 commits) fix(agents): keep compaction on live session model (#95713) fix(plugin-sdk): guard provider catalog live URL parsing against malformed responses (#109986) chore(cli): drop dead classifiers and single-use wrappers left by fallback removal (#112191) feat(ui): expand the lobster pet's random universe (#112073) chore(ci): audit dependency fingerprint exports (#112190) fix(ui): preserve graphemes in provider icons (#109509) fix(ui): align settings search with navigation rows (#112172) fix(agents): allow configless gateway rebind to activate standalone owner (#111841) fix(secrets): register secret targets for installed-origin plugins (#104347) improve(ui): show real machine identity in the place picker (#112162) fix: webChat scrollback history is too limited — older assistant replies and tool outputs disappear when scrolling… (#104250) test(ui): run DOM-free suites in Node (#112031) feat(nodes): make computer.act eligibility capability-based for desktop nodes (#112107) fix(apps): harden mobile gateway and watch state fix(ci): restore Z.AI API Platform validation (#112171) fix(ui): prevent Logs controls from overlapping (#112170) fix #95291: message tool fails to deliver files/images on Feishu (400 volc-dcdn / write ECONNRESET) while same Lark SDK upload succeeds standalone (#95514) refactor(cli)!: remove automatic gateway→embedded fallback from openclaw agent (#112074) refactor: move provider transports into packages/ai behind a typed host port (#111669) fix(anthropic): complete transcript reverse-scan windows across short reads (#109431) ...
What Problem This Solves
Opening a Claude session transcript could fail with
Claude transcript changed while it was being readeven when the file was unchanged. The reverse pager required one positional read to fill an entire 128 KiB window, but Node permits a successful read to return fewer positive bytes than requested.Why This Change Was Made
The Anthropic plugin now completes each already-bounded reverse window across positive short reads, advancing both the buffer and file offsets. A zero-byte read before the stat-sized window is full remains a premature-EOF error, so concurrent truncation still fails closed.
The implementation stays plugin-local because bundled plugins may not import core
src/infrahelpers across the Plugin SDK boundary. It mirrors the established bounded-read loop used by core readers without adding API, config, dependency, or storage surface.User Impact
Claude transcript pagination no longer fails spuriously on filesystems that return positive short positional reads. Real truncation during a page read still reports the existing error.
Evidence
node scripts/run-vitest.mjs extensions/anthropic/session-catalog.test.ts— 37 passed.node scripts/check-changed.mjs -- extensions/anthropic/session-catalog.ts extensions/anthropic/session-catalog.test.ts— passed on Blacksmith Testboxtbx_01ky1m69ad5sftt2jpfnpybfgw, run 29805682398.git diff --check— passed.Contributor credit is preserved in Masato Hoshino's original commit.