#94360: Feishu - exec stderr output sent as user-visible reply#94381
Closed
mmyzwl wants to merge 1 commit into
Closed
#94360: Feishu - exec stderr output sent as user-visible reply#94381mmyzwl wants to merge 1 commit into
mmyzwl wants to merge 1 commit into
Conversation
…essage leaks Exec tool stderr output (e.g. PowerShell Copy-Item warnings) was mixed into the aggregated stdout+stderr string via appendOutput(). This caused stderr content to appear as visible channel messages in Feishu and other platforms, covering up the agent's actual response. Fix: in appendOutput(), only append stdout chunks to session.aggregated. Stderr is still tracked separately in pendingStderr[] and is available for gateway logging and error metadata, but no longer leaks into tool result text or channel progress messages. Closes openclaw#94360 Co-Authored-By: Claude <[email protected]>
Contributor
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
Exec commands that produce stderr output (e.g. PowerShell
Copy-Itemwarnings) have the stderr content sent as a visible reply message in Feishu, covering up the agent's actual response. The stderr leaks into the aggregated tool output and reaches users through channel progress messages.Linked context
Closes #94360
Root Cause
In
src/agents/bash-process-registry.ts, theappendOutput()function appends both stdout and stderr chunks tosession.aggregated. This mixed string is later used as the tool result text that feeds into channel progress messages (Feishu, Telegram, etc.). There is no separation between stdout and stderr at any point in the pipeline.Data flow:
Changes
src/agents/bash-process-registry.ts(appendOutput): Only append stdout chunks tosession.aggregated. Stderr is still tracked separately inpendingStderr[]for gateway logging, but no longer leaks into the aggregated output, tool result text, or channel progress messages.Real behavior proof
Behavior or issue addressed: Exclude stderr from aggregated exec output so it doesn't appear in channel progress messages.
Real environment tested:
Exact steps or command run after the patch:
pnpm tsgo:prod— no errorspnpm test -- --run src/agents/bash-process-registry.test.ts— 8/8 passedpnpm test -- --run src/agents/bash-tools.exec-runtime.test.ts— 44/44 passedEvidence after fix:
TypeScript compilation:
Test suite output:
Code change:
Before fix:⚠️ Feishu message, covering the agent's response
exec Copy-ItemPowerShell warning → stderr appears as visibleAfter fix:
exec Copy-ItemPowerShell warning → stderr only in gateway logs, agent's response delivered normallySummary: before: stderr in aggregated output leaks to channel messages → after: stderr excluded from aggregated, only stdout appears in tool results and messages
Scope / context
This fix only affects the
aggregatedoutput string used for tool results and channel progress messages. Stderr remains fully tracked inpendingStderr[]for any code that reads it separately (gateway logging, error metadata). The fix is a one-line structural change with no behavioral side effects beyond excluding stderr from visible messages.