fix(adk): avoid reduction/filesystem read_file loops on large tool results - #1093
Open
014-code wants to merge 2 commits into
Open
fix(adk): avoid reduction/filesystem read_file loops on large tool results#1093014-code wants to merge 2 commits into
014-code wants to merge 2 commits into
Conversation
Exclude read_file results from default truncation and clearing so offloaded content can be read back without being re-offloaded or cleared again. Add column-based pagination to the filesystem read_file tool to make very long single-line files readable in chunks, and update the tool prompts to document column_offset and column_limit. Also normalize in-memory backend and default reduction offload paths to use slash-based virtual filesystem paths consistently across platforms.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1093 +/- ##
==========================================
+ Coverage 83.11% 83.23% +0.12%
==========================================
Files 162 162
Lines 23134 23191 +57
==========================================
+ Hits 19228 19304 +76
+ Misses 2640 2618 -22
- Partials 1266 1269 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… cases Rename the sliced read_file line variable to avoid shadowing in formatLineNumbers. Add coverage for column pagination edge cases, including disabled column limits, out-of-range offsets, empty lines, and windows-style path normalization in the in-memory backend.
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.
Summary
This fixes the conflict between reduction and filesystem middleware described in #860.
When a large tool result is truncated or offloaded and the agent uses
read_fileto fetch it back, the returned content should not be truncated, cleared, or offloaded again by default. This change also adds column-based pagination toread_fileso very long single-line content can be read incrementally.What changed
read_filefrom default reduction truncation and clearingread_filefrom legacy large tool result offloading pathscolumn_offsetandcolumn_limittoread_fileTests
New coverage added:
TestReadFileTool_LongSingleLineColumnPaginationTestToolResultOffloading_ExcludeToolsTestNewToolResultMiddleware_ExcludesReadFileFromClearTestToolResultOffloading_SkipReadFileToolTestReductionMiddlewareTrunc/read_file tool is not truncated by defaultTestReductionMiddlewareClear/read_file tool is not cleared by defaultPassed:
go test ./adk/middlewares/filesystem ./adk/middlewares/reductionAlso checked:
gofmton modified filesgit diff --checkNotes
A full
go test ./...run still reports unrelated failures in other packages on this Windows environment, including:adk/middlewares/agentsmdadk/middlewares/plantaskadk/middlewares/skillcomponents/document/parserThose failures are not introduced by this change and are outside the scope of #860.