Uh oh!
There was an error while loading. Please reload this page.
fix(opencode): make mini resize replay opt-in - #37973
Conversation
Terminal resize in --mini wiped the screen and saved scrollback (ESC[2J+ESC[3J), refetched the session, and reprinted every message on every SIGWINCH. Resize replay only benefits terminals that do not reflow scrollback, so it is now opt-in via --resize-replay (default off); resume replay is unchanged. With the replay off, a widening resize during streaming skipped content: text and code entries commit by layout row, and the committed-row offset is invalid at the new width. The active entry now restarts in a fresh surface on widen; narrowing re-emits only the wrap seam. Markdown commits by block index and is unaffected. Documents --mini, --no-replay, and --resize-replay in the CLI docs.
The following comment was made by an LLM, it may be inaccurate: The search found PR #37974, which is not a duplicate — it's the companion PR for the v2 branch that you mentioned in your description ("Unchanged. ... #37974 ports the same change to the v2 branch."). PR #37973 is the current PR, so it correctly appears in results but should not be flagged as a duplicate of itself. No other duplicate or related PRs found related to resize replay, mini mode improvements, or the |
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes#37971
Type of change
What does this PR do?
Problem. Every terminal resize in
--mini(tmux split, window drag, any SIGWINCH) wiped the screen and saved scrollback (ESC[2J+ESC[3J), refetched the entire session, and reprinted it from the beginning. That re-scrolled the whole session and destroyed scroll position and prior terminal scrollback. Hidden under it: a widening resize during streaming silently dropped output.Fix. Resize replay is now opt-in via
--resize-replay(the only new flag), default off. By default resize touches nothing; the terminal re-wraps committed scrollback. Mid-stream resizes are handled in the scrollback surface: narrowing re-emits only the wrap seam; widening restarts the active entry so no output is lost.Why gate it instead of deleting it. Replay-on-resize was built deliberately (#26880 → #30239 → #30465) and has one legitimate use: terminals that do not reflow scrollback keep cleanly wrapped history only if the app reprints it. That's a short list today: essentially plain xterm (measured) and partially GNU screen. Modern terminals including Windows 10+ consoles all reflow (measurements in #37971). On by default it meant everyone paid the wipe-and-reprint to cover terminals they weren't using; off by default, the cost lands only where it buys something. A possible follow-up is auto-enabling it from an in-band terminal identification query (XTVERSION), with the flag as override; kept out of this PR to stay small.
Unchanged. Resume replay (
--continue/--session) and the existing--no-replay/--replay-limitflags. Documented--resize-replayin the CLI docs. #37974 ports the same change to the v2 branch.How did you verify your code works?
bun test test/cli/runfrompackages/opencode: 198 pass, 0 fail. New tests: resize triggers no replay by default and does with the flag; mid-stream narrow/widen (the widen test fails on dev with dropped output, and passes here).bun typecheckclean, help snapshots updated.pipe-pane: dev emitsESC[2J+ESC[3Jper resize; this branch emits neither by default, and pane history changes only by tmux's own reflow.Screenshots / recordings
Same real 137-message session, same choreography (settle → narrow → widen).
Before, each resize wipes and re-scrolls the session:
After (default), resizes are non-events:
Checklist