-
Notifications
You must be signed in to change notification settings - Fork 7.9k
feat(core): Only summarize long tool output for shell command #8039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+25
−3
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
Size Change: +708 B (+0.01%) Total Size: 13.2 MB ℹ️ View Unchanged
|
Code Coverage Summary
CLI Package - Full Text Report
Core Package - Full Text Report
For detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
anj-s
approved these changes
Sep 9, 2025
lifefloating
pushed a commit
to lifefloating/gemini-cli
that referenced
this pull request
Sep 10, 2025
SandyTao520
added a commit
that referenced
this pull request
Sep 10, 2025
SandyTao520
added a commit
that referenced
this pull request
Sep 10, 2025
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.
TLDR
This change refines the tool output truncation logic to apply only to the
ShellTool
. Previously, any tool returning a string could have its output truncated, which was not the intended behavior. This ensures that only shell command output is truncated when it exceeds the configured threshold.Dive Deeper
The
CoreToolScheduler
previously had a generic mechanism to truncate tool output if the content was a string and a truncation threshold was set. This logic was too broad and could inadvertently affect tools that return legitimate, long strings that shouldn't be truncated.This PR introduces a simple check (
toolName === ShellTool.Name
) to ensure that this truncation and "save to file" behavior is scoped exclusively to the output of shell commands. This makes the behavior more predictable and prevents unintended side effects on other tools.Reviewer Test Plan
To validate this change, you can test the following scenarios:
Verify Shell Truncation: Run a shell command that produces a large amount of output.
run the command ls -lR /
... (full output saved to /tmp/gemini-cli-output-....txt)
).Verify Other Tools are Unaffected: If another tool returns a long string, it should not be truncated by this mechanism. (While no current tool is directly affected, this change future-proofs the system). You can confirm that the
ShellTool
is the only one with this specific truncation logic applied incoreToolScheduler.ts
.Testing Matrix