fix(deepagents): stop double line numbers in read_file for sandbox backends#439
Open
Alexei Vedernikov (alvedder) wants to merge 1 commit into
Open
Conversation
|
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.
Sandbox
read()usedawkto emit cat-n–styleNR+ tab + line, and theread_filetool then ranformatContentWithLineNumbersagain. Text reads showed two numeric columns e.g.This aligns sandbox text
read()withFilesystemBackend: raw sliced lines from the backend; one numbering pass in the tool.Changes
buildReadCommand(libs/deepagents/src/backends/sandbox.ts): keep the same existence / empty-file checks andNRrange (1-based inclusive slice from 0-basedoffset/limit); replace numberedprintfwith{ print }so stdout is unnumbered lines only.BaseSandbox.read,FilesystemBackend.read,CompositeBackend.read, andbuildReadCommandthat textread()returns a raw line slice; cat-n formatting is applied inread_file.libs/deepagents/src/backends/sandbox.test.ts):read_fileoutput has exactly one tab-separated “line number + body” segment per line (no extra leading number column) when usingMockSandbox+createFilesystemMiddleware.MockSandbox: simulate the realawkslice (NR >= start && NR <= end) and return raw joined lines (no prefixes).awkwith{ print }.@langchain/sandbox-standard-tests: rename the misleadingread()case from “with line numbers” to reflect raw backend output.Testing
pnpm exec vitest run src/backends/sandbox.test.ts --typecheck(and relatedfsunit tests as appropriate).Notes
downloadFiles).backend.read()on sandboxes should switch expectations to raw lines (same as filesystem/state backends); numbering belongs to tool/UI layers that callformatContentWithLineNumbers.