Repository navigation
fix(agents): read oversized single-line files without exec - #126587
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 20, 2026 07:43
Contributor
Author
|
Land-ready proof for exact head
Codex dependency contract was inspected directly: app-server The latest ClawSweeper comment is still the in-progress placeholder and contains no findings or |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 21, 2026
This was referenced Oct 28, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What Problem This Solves
Fixes an issue where users reading minified JSON, generated data, or other files containing a single line larger than 50 KiB received none of that line. The read result instead recommended a Bash pipeline, which dead-ended agents whose tool surface intentionally omitted exec/process.
Why This Change Was Made
The canonical read owner now returns a bounded UTF-8/UTF-16-safe slice plus a flat intra-line
cursor, while existingoffset/limitline paging remains unchanged. OpenClaw's adaptive wrapper chooses the context-derived byte budget and aggregates canonical pages without exceeding the complete model-visible cap, including continuation guidance.Known skill instruction paths remain whole-document-only: window parameters are rejected, fitting instructions are delivered in full, and oversized instructions return a bounded refusal without leaking a misleading partial document. The Codex app-server filesystem contract was inspected directly and remains path-only/full-byte; model-visible slicing stays owned by OpenClaw.
Production growth is +408/-133 (net +275). The remaining growth is the explicit cursor contract, bounded-page owner, adaptive continuation metadata, and whole-instruction policy; the obsolete shell fallback was removed. Tests are +315/-44 (net +271).
User Impact
Agents can now inspect large single-line files through
readalone, including on exec-disabled surfaces. Repeated cursor reads reconstruct the original content exactly without splitting multibyte UTF-8 characters or UTF-16 surrogate pairs, and every result remains within its hard context budget.Skill and playbook-style instruction documents are never presented as a partial first window that could be mistaken for the complete guidance.
Evidence
Before the fix, a 51,470-byte one-line JSON file returned only:
with zero output lines and no usable read continuation.
After the fix:
node scripts/run-vitest.mjs src/agents/sessions/tools/read.test.ts src/agents/agent-tools.create-openclaw-coding-tools.test.ts src/agents/filesystem-tools-output-contract.test.ts— 169 tests passed.node scripts/check-changed.mjs -- <8 changed files>— formatting, core/test types, lint, dead exports, import cycles, database/storage, plugin-boundary, and repository guards passed.pnpm build— full build passed; no ineffective dynamic import warning.execandprocessabsent reconstructed an 81,936-byte minified JSON file in 3 bounded reads and a 98,316-byte emoji line in 4 bounded reads. Each result was at most 32 KiB and contained no Bash/sed/head guidance.AI-assisted: yes. I reviewed the implementation, ownership boundary, tests, dependency contract, and proof results.