Skip to content

feat(execd): support line-based file reading with offset + limit#1030

Open
Pangjiping wants to merge 6 commits into
mainfrom
feat/execd-line-based-file-reading
Open

feat(execd): support line-based file reading with offset + limit#1030
Pangjiping wants to merge 6 commits into
mainfrom
feat/execd-line-based-file-reading

Conversation

@Pangjiping

Copy link
Copy Markdown
Collaborator

Summary

  • Add offset (1-based line number) and limit (line count) query parameters to GET /files/download for line-based reading, mutually exclusive with the existing Range header
  • Uses bufio.Scanner for streaming line reads without buffering the entire file
  • Updates across all layers: execd handler, OpenAPI spec, and all five SDKs (Python async/sync, JavaScript, Kotlin, C#, Go)

Closes #1003

Test plan

  • Unit tests for offset+limit, offset-only, limit-only, offset beyond EOF, limit beyond remaining, Range conflict, invalid offset, invalid limit
  • Full execd test suite passes (go test ./...)
  • Go SDK compiles and existing download tests pass
  • E2e test with live sandbox (requires sandbox environment)

🤖 Generated with Claude Code

Add offset (1-based line number) and limit (line count) query parameters
to GET /files/download for line-based reading, mutually exclusive with
the existing Range header. Uses bufio.Scanner for streaming line reads
without buffering the entire file.

Updates across all layers: execd handler, OpenAPI spec, and all five
SDKs (Python async/sync, JavaScript, Kotlin, C#, Go).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Pangjiping Pangjiping added bug Something isn't working documentation Improvements or additions to documentation component/execd feature New feature or request sdks and removed bug Something isn't working labels Jun 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fee7b3b463

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread components/execd/pkg/web/controller/filesystem_download.go
Comment thread specs/execd-api.yaml
Comment thread specs/execd-api.yaml
- Increase bufio.Scanner buffer to 1 MiB and check scanner.Err() to
  handle long lines gracefully instead of silently truncating
- Add text/plain response documentation to OpenAPI spec for line-based
  read mode
- Regenerate Python and JavaScript SDK clients from updated spec

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5b48e7b2c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread components/execd/pkg/web/controller/filesystem_download.go Outdated
Comment thread sdks/sandbox/python/src/opensandbox/adapters/filesystem_adapter.py Outdated
Comment thread components/execd/pkg/web/controller/filesystem_download.go Outdated
Pangjiping and others added 3 commits June 12, 2026 16:07
Handle errcheck lint for scanner error Write call. Add backward-compatible
Kotlin interface overloads so Java callers can still use the original
positional arg signatures (3-arg readFile, 2-arg readByteArray/readStream).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move limit check after write in scan loop to avoid scanning one extra
  line past the requested range
- Fix Python async/sync adapters: put path in params dict instead of URL
  query string so httpx doesn't drop it when offset/limit params are added
- Simplify _DownloadRequest type (params always present)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused `quote` import from Python async/sync adapters (ruff F401)
- Apply spotless formatting to Kotlin overload methods

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10eb87bb3d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Add line-based reading (offset/limit) e2e tests for Go, Python (async +
sync), JavaScript, Java, and C#. Each test writes a 5-line file and
verifies offset+limit, offset-only, and limit-only reads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/execd documentation Improvements or additions to documentation feature New feature or request sdks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(execd): support line-based file reading with offset + limit

2 participants