fix(opencode): batch shell output updates#37653
Conversation
|
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. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that touch on shell output handling: Potentially Related PRs:
The most closely related is #35543, which also handles the edge case of output loss at process exit. Your PR extends this solution with batching and timing controls to prevent output loss in high-volume scenarios. No exact duplicates found, but #35543 may need consideration for interaction with your changes. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #30001
Related to #35543. This PR also coalesces metadata updates and uses a bounded trailing-output drain.
Type of change
What does this PR do?
The shell tool currently awaits ctx.metadata for every decoded output chunk. For chatty commands, pipe chunking therefore controls durable update frequency, and process exit can win before trailing pipe output is consumed.
This change consumes output immediately, publishes the newest cumulative preview at most every 100 ms, then allows 100 ms for trailing output and performs a final flush before returning. The cumulative metadata.output contract is unchanged.
How did you verify your code works?
Screenshots / recordings
N/A
Checklist