You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
files read --offset 0 failed with offset starts at line 1. Callers used to zero-based paging (agents in particular) send 0 for the first window, and this was the most common argument error the Chat agent hit with sim_cli, at about 30 a day.
offset now accepts 0 and reads it as the first line. The response's lineRange.offset still reports 1, so the caller learns the 1-based convention from the result. A negative offset is still rejected.
This applies to both contracts that take a file line window: v2 GET /files/{id}/text (and files versions read, which shares the schema), and the File block's content operation that Agent-block LLMs call.
sliceFileTextLines already clamped a start below line 1, so no reader changes were needed. A new test pins that clamp, since the relaxed contract now relies on it.
Regenerated the OpenAPI document, the sim CLI API, and the CLI docs: minimum goes from 1 to 0, and the description says 0 starts at the first line.
Type of Change
Bug fix
Testing
Red-first, so each new case fails on the pre-fix code:
route.test.ts (v2 text): offset=0 returns 200.
operations.test.ts: the File block's content op with offset: 0 returns the first line and reports lineRange.offset: 1.
text-lines.test.ts: removing the clamp turns the offset-0 case red.
file-read.test.ts: the engine's reject list now uses -1 instead of 0.
bun run lint, bun run type-check (apps/sim), check:api-validation:strict, check:audits, docs-manifest:check, block-registry check, and root bun run test all passed.
Checklist
Code follows project style guidelines
Self-reviewed my changes
Tests added/updated and passing (new tests pass the test-audit authoring gate)
The PR accepts offset 0 as the first line in file-read contracts, updates generated API descriptions and CLI documentation, and adds regression coverage.
The newly added CLI test violates the repository’s explicit testing rule against mock-call assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
files read --offset 0failed withoffset starts at line 1. Callers used to zero-based paging (agents in particular) send0for the first window, and this was the most common argument error the Chat agent hit withsim_cli, at about 30 a day.offsetnow accepts 0 and reads it as the first line. The response'slineRange.offsetstill reports 1, so the caller learns the 1-based convention from the result. A negative offset is still rejected.GET /files/{id}/text(andfiles versions read, which shares the schema), and the File block'scontentoperation that Agent-block LLMs call.sliceFileTextLinesalready clamped a start below line 1, so no reader changes were needed. A new test pins that clamp, since the relaxed contract now relies on it.simCLI API, and the CLI docs:minimumgoes from 1 to 0, and the description says 0 starts at the first line.Type of Change
Testing
route.test.ts(v2 text):offset=0returns 200.operations.test.ts: the File block'scontentop withoffset: 0returns the first line and reportslineRange.offset: 1.text-lines.test.ts: removing the clamp turns the offset-0 case red.file-read.test.ts: the engine's reject list now uses-1instead of0.bun run lint,bun run type-check(apps/sim),check:api-validation:strict,check:audits,docs-manifest:check, block-registry check, and rootbun run testall passed.Checklist
test-auditauthoring gate)