Skip to content

bun-compiled CLI exits before flushing large stdout writes to a pipe — adk evals --format json reports truncated mid-JSON at ~64 KB #38

Description

@johnf

Environment: adk CLI 2.0.1 (linux-x64 release binary — bun-compiled single-file executable; stack traces show /$bunfs/root/adk-linux-x64); @botpress/evals 2.0.2; Ubuntu.

When the JSON report from adk evals --format json is large (judge-heavy suites: each llm_judge assertion embeds its full rubric; one of our group reports is ~144 KB), piping stdout truncates it mid-JSON at ~64–73 KB. Redirecting to a file is always complete.

  • adk evals --format json > report.json → complete, valid JSON, every time.
  • adk evals --format json | anything (e.g. | jq ., | tee, or a pipe into a gate script) → truncated at ~64–73 KB, unparseable.
  • Small reports (a few KB) pipe fine — the size threshold is what you'd expect if the process exits before pending async pipe writes are flushed (pipes block at the kernel buffer boundary; regular-file writes are synchronous). This looks like the known bun footgun of process.exit() racing pending stdout writes.

Expected: stdout is fully flushed before exit regardless of what stdout is attached to. --format json exists to be consumed programmatically, and the natural consumer shape is a pipe.

Repro:

  1. Any eval suite whose JSON report exceeds ~100 KB (many llm_judge assertions is the easy way).
  2. adk evals --format json > a.json vs adk evals --format json | cat > b.json.
  3. a.json is complete; b.json is cut mid-JSON at ~64–73 KB (jq . b.json fails).

Observed 2026-07-10, reconfirmed since on adk 2.0.1.

Workaround: always redirect to a file and read the file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions