Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
|
The closure was correct: I missed the required PR template and closing issue link. I also later found #37653, which already implements the same targeted shell batching fix and was closed only by automated age/reaction cleanup. I will not resubmit this duplicate; I added the new measurements and a reopen request to #37653. |
Summary
Why
Each metadata callback persists and broadcasts another complete
message.part.updated.1snapshot. Fast or chatty commands can therefore generate many full-preview updates without improving the UI at chunk-level cadence.A synthetic burst wrote 30 numbered chunks 10 ms apart, then kept the process alive until metadata exposed the final line. Across 10 fresh test processes per implementation:
That is an 86.7% median callback-count reduction in this workload. It does not claim an RSS reduction or equivalent production database-byte savings.
The implementation does not group the output stream: pipe draining, output capture, truncation, abort, and timeout behavior still process every chunk. The periodic publisher is scope-bound, deduplicates unchanged previews, and the final forced update prevents a burst ending between intervals from becoming stale.
Related: #33356
Validation
bun test ./test/tool/shell.test.ts: 25 pass, 0 fail on clean rerunbun test ./test/session/prompt.test.ts -t 'cancel finalizes interrupted bash tool output through normal truncation': 1 pass, 0 failbun typecheck: passoxlinton both changed files: 0 errorsThe package-wide run reached 3,394 pass, 22 skip, 1 todo, with 2 unrelated PTY/session-route failures; both passed immediate targeted reruns.