Skip to content

fix(core): handle read file failures#33260

Merged
kitlangton merged 4 commits into
devfrom
read-file-errors
Jun 21, 2026
Merged

fix(core): handle read file failures#33260
kitlangton merged 4 commits into
devfrom
read-file-errors

Conversation

@kitlangton

@kitlangton kitlangton commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep filesystem races during read, inspect, and directory listing in the typed error channel
  • model binary, oversized media, malformed UTF-8, wrong path kinds, and invalid offsets with Schema.TaggedErrorClass
  • preserve useful content-error messages while allowing the read tool to settle failures for the model
  • decode paginated files one newline-bounded segment at a time and stop as soon as the requested page is complete
  • keep arbitrary defects and interruption outside the recovery boundary

Closes #33068

Test plan

  • bun run test test/tool-read-filesystem.test.ts test/tool-read.test.ts from packages/core (24 passed)
  • regressions cover malformed UTF-8 in later chunks and ignored malformed/NUL content after a completed page
  • bun typecheck from packages/core
  • pre-push bun turbo typecheck (23 packages passed)
  • Prettier and git diff --check

@kitlangton kitlangton enabled auto-merge (squash) June 21, 2026 19:51
@kitlangton kitlangton merged commit ff837fe into dev Jun 21, 2026
13 of 14 checks passed
@kitlangton kitlangton deleted the read-file-errors branch June 21, 2026 20:12
markjaquith pushed a commit to markjaquith/opencode that referenced this pull request Jun 23, 2026
BenGu3 pushed a commit to BenGu3/opencode that referenced this pull request Jun 27, 2026
josechifflet pushed a commit to josechifflet/opencode that referenced this pull request Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Read and Edit tools handle invalid UTF-8 inconsistently: one crashes, the other silently corrupts

1 participant