Skip to content

Name the failing segment in extra-segment load errors - #568

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-6960-reactor-extra-segment-load-errors-do-not-name-the-failing
Aug 23, 2026
Merged

Name the failing segment in extra-segment load errors#568
TheGreatAxios merged 1 commit into
mainfrom
cl-6960-reactor-extra-segment-load-errors-do-not-name-the-failing

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Closes CL-6960.

parseSegmentTurns takes an optional fileName used to name the file in error messages. The reactor's load() passed it for the base segment, but the extra-segment path (loadTurnsWithoutMalformedToolSequence -> parseSegmentTurns, and readAt) omitted it, so corruption in turns-0001.jsonl and later segments fell back to the generic "turns segment has malformed JSON at line N" label instead of naming the file.

Threaded the segment name through both call sites that were missing it. Added a test that reproduces malformed content in turns-0001.jsonl and asserts store.load() rejects with a message containing that segment's filename, and stays strict (does not skip/soften the error).

Test plan

  • bunx tsc --noEmit
  • bun test src/session/optimized-context-store.test.ts (20 pass)

parseSegmentTurns omitted fileName at the extra-segment call sites
(loadTurnsWithoutMalformedToolSequence and readAt), so corruption in
turns-0001.jsonl and later segments fell back to the generic "turns
segment" label. Thread the segment name through both call sites.
@linear-code

linear-code Bot commented Aug 23, 2026

Copy link
Copy Markdown

CL-6960

@TheGreatAxios
TheGreatAxios merged commit c80fbe5 into main Aug 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant