fix(chat): clear accumulated shell output on re-run of !commands#4020
Closed
CnsMaple wants to merge 1 commit into
Closed
fix(chat): clear accumulated shell output on re-run of !commands#4020CnsMaple wants to merge 1 commit into
CnsMaple wants to merge 1 commit into
Conversation
When a !command (e.g. !pwd) is run multiple times, the tool ID is
fixed (e.g. "shell-pwd") so streamToolOutput appends each run's
output to the same shellOutputs key. Without clearing, collapseShellSlot
renders all accumulated lines from every run.
Fix by deleting shellOutputs[id] in beginToolRunning, so each run
starts with a clean slate.
Before (3x !pwd):
⎿ /d/about_fish/ProgramProtable/DeepSeek-Reasonix
/d/about_fish/ProgramProtable/DeepSeek-Reasonix
/d/about_fish/ProgramProtable/DeepSeek-Reasonix
After (3x !pwd):
⎿ /d/about_fish/ProgramProtable/DeepSeek-Reasonix
⎿ /d/about_fish/ProgramProtable/DeepSeek-Reasonix
⎿ /d/about_fish/ProgramProtable/DeepSeek-Reasonix
Owner
|
Thanks @CnsMaple — clean catch and the fix is correct. I traced the chain: I've re-landed your commit on top of the latest |
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.
Problem
Repeated
!pwd(or any!shell command) accumulates output lines across runs instead of showing only the current run's output.Before (3×
!pwd):Root Cause
controller.RunShellgenerates a fixed tool ID for each!command (e.g."shell-pwd").streamToolOutputappends output withm.shellOutputs[id] += chunk, butbeginToolRunningnever cleared the map entry, so every subsequent run added to the previous output.collapseShellSlotthen rendered all accumulated lines.Fix
Clear
m.shellOutputs[id]inbeginToolRunningso each re-run of the same tool ID starts with a clean slate. This is a one-linedeletewith a comment.After (3×
!pwd):