You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The direct user shell awaited a durable part update for every decoded output chunk. This coupled pipe consumption to SQLite projection and event broadcast work.
This change consumes output immediately and publishes the latest cumulative running snapshot at most every 100 ms. A version counter keeps output dirty when bytes arrive during an update. The publisher is interrupted before the existing final part update, so completion remains authoritative and no running update can arrive afterward.
How did you verify your code works?
bun test test/session/prompt.test.ts: 59 pass, 1 platform skip
Package typecheck and full commit-hook monorepo typecheck: 30 successful packages
Prettier and git diff --check
20 paced writes: 4 running updates instead of up to 20 (80% fewer)
Durable event payload: 9,156 bytes to 3,128 bytes (65.8% lower)
Why it's related:
This PR also addresses batching of shell output updates, which is very similar in scope to PR #37788 (fix(opencode): batch direct shell output updates). The main difference appears to be that #37788 specifically targets "direct" shell output, while #37653 may have addressed a broader shell output batching issue. You should verify whether these PRs handle different code paths or if one supersedes the other.
This PR changes packages/opencode/src/session/prompt.ts, the user-invoked direct ! shell path.
The paths do not call each other and the PRs have no overlapping files. Merging #37653 does not change the per-chunk sessions.updatePart calls in the direct shell path. The same 100 ms batching policy is intentional so both shell implementations avoid coupling pipe consumption to durable updates. They can be reviewed and merged independently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #37787
Type of change
What does this PR do?
The direct user shell awaited a durable part update for every decoded output chunk. This coupled pipe consumption to SQLite projection and event broadcast work.
This change consumes output immediately and publishes the latest cumulative running snapshot at most every 100 ms. A version counter keeps output dirty when bytes arrive during an update. The publisher is interrupted before the existing final part update, so completion remains authoritative and no running update can arrive afterward.
How did you verify your code works?
Screenshots / recordings
N/A
Checklist