Skip to content

[FEATURE]: expose stderr separately in bash tool output for plugin consumption #20907

@YumaKakuya

Description

@YumaKakuya

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The bash tool's run() function captures output using handle.all (line 345 in src/tool/bash.ts), which merges stdout and stderr into a single string. The return value (lines 400-408) only has an output field containing this combined text.

This means plugins using tool.execute.after receive the merged output but have no way to extract just stderr. If a command prints normal output to stdout and an error to stderr, a plugin cannot tell which part is which.

This matters for plugins that want to react to command failures — things like translating compiler errors, flagging specific error patterns, or logging failure details. The exit code tells you something went wrong, but the actual error message is mixed in with stdout and not separable.

Example:

A plugin hooks tool.execute.after and wants to check if a build command produced a specific warning on stderr. Today it would have to parse the combined output string and guess which lines came from stderr, which is unreliable.

Proposed change:

Capture stderr separately in run() alongside the existing combined stream, and include it in the return value. The combined output field stays unchanged so nothing breaks for existing consumers — this is purely additive.

Note: #13575 is related (it covers UI rendering of mutated tool.execute.after output). The two could be addressed together but are independent.

I'd like to submit a fix for this if the approach sounds reasonable.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions