Skip to content

fix(core): fail directory listing on out-of-range offset - #46159

Open
ukarpenkov wants to merge 1 commit into
anomalyco:devfrom
ukarpenkov:directory-offset-range
Open

fix(core): fail directory listing on out-of-range offset#46159
ukarpenkov wants to merge 1 commit into
anomalyco:devfrom
ukarpenkov:directory-offset-range

Conversation

@ukarpenkov

@ukarpenkov ukarpenkov commented Aug 29, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #45928

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Directory read with an offset past the last entry returned { entries: [], truncated: false }. That looks like a short/empty listing, so the model cannot tell the offset was wrong.

list() now fails with OffsetOutOfRangeError when the page is empty and offset is not 1, same as text-file pagination. Empty directories at offset 1 still succeed. The tool also forwards that error message to the model instead of a generic "Unable to read".

How did you verify your code works?

Ran in packages/core:

  • bun test test/tool-read-filesystem.test.ts test/tool-read.test.ts
  • bun typecheck

Also covered: offset 100 on a small directory fails; offset 1 on an empty directory still returns an empty page.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Directory read pagination returned an empty success page when offset
passed the last entry, so the model could not tell a short listing from
a bad offset. Fail with OffsetOutOfRangeError like text reads already do.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one related PR that may be worth reviewing alongside the current PR:

Related PR:

The current PR (#46159) is the only one directly addressing the out-of-range offset error for directory listings, but PR #45195 is related work in the same area that should be cross-checked for consistency.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

read: directory listing returns an empty page for out-of-range offset instead of erroring

1 participant