feat(tui): add message_limit config and fix export truncation#15006
Closed
n24q02m wants to merge 2 commits into
Closed
feat(tui): add message_limit config and fix export truncation#15006n24q02m wants to merge 2 commits into
n24q02m wants to merge 2 commits into
Conversation
9baae17 to
72710b1
Compare
Author
|
Rebased onto latest dev to resolve conflicts. Also removed the stale |
Author
|
Closing — I'm no longer actively using OpenCode. Feel free to cherry-pick any changes if useful. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #9930
Closes #14948
Type of change
What does this PR do?
tui.message_limitconfig option. By setting this to an integer (e.g.50), OpenTUI will only render the last N messages of a session. This completely avoids the O(n) layout calculation loops that previously crashed the app when scrolling long histories. The default remains"none"to preserve backwards compatibility.opencode exportvia piped stdout ([BUG] opencode export outputs truncated JSON when piped #14948, Bug: Intermittent truncated stdout when piping opencode export #2803): When users piped the output ofopencode exportto tools likejq, the main process often exited viaprocess.exit()before NodeJS could fully flush the asynchronousstdoutstream. This PR fixes it by properly awaiting a zero-length write callback in theexporthandler and introducing asetImmediate()microtask loop before the final app teardown.How did you verify your code works?
Built and compiled locally.
opencode export <session> | jq .-> It successfully parsed the full 15MB file without premature truncation errors.tui: {message_limit: 5}inopencode.json, opened a long session and observed that only the last 5 messages were rendered, with CPU usage dropping to near 0%.Screenshots / recordings
N/A
Checklist