feat: stream Bash progress and guard message actions during replies#2879
Conversation
|
Thanks for the contribution! The feature direction is great — live Bash output is a real UX improvement. However, a few issues need to be addressed before this can be merged: 1. Tool card expand/collapse behavior (UX)
2. Process tree is not killed on Windows (functional defect) In if self._IS_WIN:
subprocess.run(["taskkill", "/F", "/T", "/PID", str(process.pid)], capture_output=True)3. If the command spawns a background process (e.g. 4. Frontend memory / replay buffer growth (performance) Each progress event can carry up to 32KB, emitted every 0.5s, and every event is appended to the 5. i18n inconsistency (minor) The disabled-state tooltips are hardcoded English strings ("Reply is being generated; editing is temporarily unavailable."). Please route them through the existing 6. Empty output still renders the "Output" label (minor) On 7. Tests (recommend) This PR rewrites the core execution path of the Bash tool but ships no automated tests. Please add unit tests covering: fast commands, timeout kill, commands spawning background processes, and output without trailing newlines. Also, the test checklist in the PR description doesn't mention Windows — please verify timeout and long-running command scenarios on a real Windows environment. |
Thanks for the detailed review. I’ve addressed all requested changes:
I also added a |
|
thanks for the quick turnaround! Verified all the fixes locally, the bounded reader.join(), taskkill /T process-tree termination, 4KB snapshots, replay buffer dedup, i18n, and the collapse behavior all look good, and the test suite passes on macOS. Nice work on the Windows tests as well merged. Thanks again for the contribution! 🎉 |
What does this PR do?
This PR adds bounded streaming progress for long-running Bash tool executions
in the web console and prevents message edit/delete operations while the
current session is generating a reply.
Key improvements:
tool card
progress events
duplicate output
a reply
Changes
🖥️ Web Console
Streaming Tool Output
tool_call_idvaluestextContentfor streamed output to prevent HTML injectionMessage Action Guards
sessions when another session runs in the background
🛠️ Tool Execution
BaseTooltool_execution_progressevents fromAgentStreamExecutorcross-request event leaks
💻 Bash Tool
subprocess.Popencharacters
progress
behavior
🐛 Bug Fixes
output
Files Changed
agent/tools/base_tool.pyagent/protocol/agent_stream.pyagent/tools/bash/bash.pychannel/web/web_channel.pytool_call_idthrough SSEchannel/web/static/js/console.jschannel/web/static/css/console.cssBackward Compatibility
✅ Tools that do not report progress continue to work unchanged
✅ Fast Bash commands continue to use the existing start/end behavior
✅ Existing Bash final result, timeout, exit-code, and truncation behavior is preserved
✅ Message action restrictions only apply while the current session has an active reply
✅ Existing sessions and persisted messages remain compatible
Testing
node --checkgit diff --checkType of change