Repository navigation
Description
Summary
Plugin-contributed CLI commands crash with an unhandled EPIPE when a downstream command such as head closes stdout before the plugin's full output is written. A normal Unix pipeline should terminate quietly when its consumer has enough output.
Versions and environment
- bb 0.40.0, desktop app
- Reproduced against
mainatfa97c86a17d10b6e60d07bd6d1f524fe3cb6d929 - macOS 26.5.1 (25F80)
- Node.js 22.23.2
Steps to reproduce
- Find an existing Workflows run whose bounded history output exceeds the OS pipe buffer. For the verified run,
bb workflows history <run-id> --limit 100 | wc -creported 238,786 bytes across 46 JSONL records. - Enable pipeline failure propagation with
set -o pipefail. - Run
bb workflows history <run-id> --limit 100 | head -n 1 >/dev/null. - The explicit proxy form,
bb plugin run workflows history <run-id> --limit 100 | head -n 1 >/dev/null, reproduces identically.
Workflows is the enabled builtin:workflows plugin; no third-party plugin is required.
The accompanying pull request also includes a self-contained process-level reproduction: it starts a fixture HTTP server for the contribution and plugin CLI routes, launches the real CLI entry, returns output larger than the pipe buffer, and pipes it through head -n 1 under pipefail.
Expected vs actual
Expected:
No stderr; pipeline exits 0.
Actual:
node:events:497
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:87:19)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Pipeline exits 1.
Evidence
The plugin proxy writes the returned string and rejects its callback error, but does not observe the stream's paired error event or classify EPIPE as normal early termination: writePluginCliOutput.
What you ruled out
- The plugin handler does not write to process stdout; it returns a
stdoutstring to bb. - The explicit
bb plugin run …path fails identically, isolating the shared plugin-command proxy. - The failure reproduces with the built-in Workflows plugin, so it does not depend on a third-party plugin implementation.
bb thread list --json | head -n 1exits cleanly in the same shell.- The bug remains on current
mainatfa97c86a17d10b6e60d07bd6d1f524fe3cb6d929and reproduces in a self-contained CLI process test. - No matching open or closed issue was found for
EPIPE plugin CLI.
Suggested priority and effort
Medium — affects plugin commands with sufficiently large output; retrying without an early-closing consumer is a workaround. Estimated effort is low.
- I reproduced this on the latest release and on
main. - I searched open and closed issues for the same problem.
- This agent-written report ends with the required provenance.
AGENT GENERATED: by GPT-5 Codex
Activity
bb-slop-cop commentedon Sep 1, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotBug·Highpriority ·Loweffort.plugins,cli,confirmed-repro.REPRODUCED· Confidence:high.EPIPEevent.confirmed-repro.The open pull request already links to this issue, so I did not open a duplicate pull request.
Handle broken pipes from plugin CLI output (#2784)