Uh oh!
There was an error while loading. Please reload this page.
fix(cli): flip the expansion default and explain when Ctrl+O/Ctrl+T finds no block in view - #1140
Merged
Merged
Conversation
…inds no block in view A block expanded past the terminal pushes its own head into scrollback, which the #1097 contract forbids rewriting, so the second Ctrl+O/Ctrl+T found no target, returned false, and silently left both the block and the expansion default stuck. The toggles now always flip the default when any candidate entry exists and positions are known; when every candidate sits above the viewport they append an info notice saying the content stays readable in scrollback and which state new output starts in. Toggles stay fully inert while entry positions are unknown after a wholesale replacement, and entries above the viewport stay byte-identical as before. Closes#1134
Uh oh!
There was an error while loading. Please reload this page.
me2seeks added a commit
to me2seeks/maka-agent
that referenced
this pull request
Aug 28, 2026
…primitives (apache#4011) A Ctrl+O/Ctrl+T collapse can strand expanded blocks above the live viewport: their heads sit in terminal scrollback, which the apache#1097 contract forbids rewriting, so they stay expanded with no way back (apache#1134). apache#1140 made the all-stranded case explained but left the far more common partial case silent — some cards collapse, some stay stuck, and the keypress reads as broken. The toggle now appends a notice whenever a collapse strands blocks, naming the count and offering the escape hatch: a second press within EXPANSION_COLLAPSE_CONFIRM_WINDOW_MS collapses them too via one knowingly-accepted, scrollback-clearing full redraw (apache#1134 option 2, deferred by apache#1140 as an orthogonal follow-up). The confirm offer exists for collapses only — collapsed blocks above the viewport are compact and harmless, and arming on expand would make a quick expand-then- collapse pair read the second press as "expand everything". New exports for the runner wiring: hasExpandedEntriesAboveViewport (arming predicate) and applyExpansionDefaultToAll (applies the current default to every entry including above-viewport ones, without flipping the default the way a plain toggle would). The window constant lives beside the notice copy so the offer text and the runner's confirm window share one authority. Generated-by: OpenCode
likun666661 pushed a commit
that referenced
this pull request
Aug 28, 2026
…bove the viewport (#4011) (#4025) * feat(cli): name stranded expansion blocks and add confirmed-collapse primitives (#4011) A Ctrl+O/Ctrl+T collapse can strand expanded blocks above the live viewport: their heads sit in terminal scrollback, which the #1097 contract forbids rewriting, so they stay expanded with no way back (#1134). #1140 made the all-stranded case explained but left the far more common partial case silent — some cards collapse, some stay stuck, and the keypress reads as broken. The toggle now appends a notice whenever a collapse strands blocks, naming the count and offering the escape hatch: a second press within EXPANSION_COLLAPSE_CONFIRM_WINDOW_MS collapses them too via one knowingly-accepted, scrollback-clearing full redraw (#1134 option 2, deferred by #1140 as an orthogonal follow-up). The confirm offer exists for collapses only — collapsed blocks above the viewport are compact and harmless, and arming on expand would make a quick expand-then- collapse pair read the second press as "expand everything". New exports for the runner wiring: hasExpandedEntriesAboveViewport (arming predicate) and applyExpansionDefaultToAll (applies the current default to every entry including above-viewport ones, without flipping the default the way a plain toggle would). The window constant lives beside the notice copy so the offer text and the runner's confirm window share one authority. Generated-by: OpenCode * feat(cli): second Ctrl+O/Ctrl+T press pays one full redraw to collapse stranded blocks (#4011) Wire the confirm gesture into the key handler: a collapse toggle that leaves expanded blocks above the viewport arms a 2s window; pressing the same key again inside it applies the collapsed default to every entry and forces one scrollback-clearing full redraw through pi-tui's existing public requestRender(true), which re-anchors the viewport at the tail. Transcript content is fully re-rendered into fresh scrollback, so nothing from the session is lost; only pre-session shell scrollback is cleared, and only after the explicit second press the notice announced. The integration test drives the real renderer on a 24-row terminal: an 80-line thinking block is expanded past the viewport, the first collapse press renders the offer with no ESC[3J in the stream, and the confirmed second press emits exactly the deliberate clear while collapsing the block back to its compact row. Generated-by: OpenCode * fix(cli): re-offer expired expansion confirmation
saltand pushed a commit
to saltand/maka-agent
that referenced
this pull request
Aug 31, 2026
…bove the viewport (apache#4011) (apache#4025) * feat(cli): name stranded expansion blocks and add confirmed-collapse primitives (apache#4011) A Ctrl+O/Ctrl+T collapse can strand expanded blocks above the live viewport: their heads sit in terminal scrollback, which the apache#1097 contract forbids rewriting, so they stay expanded with no way back (apache#1134). apache#1140 made the all-stranded case explained but left the far more common partial case silent — some cards collapse, some stay stuck, and the keypress reads as broken. The toggle now appends a notice whenever a collapse strands blocks, naming the count and offering the escape hatch: a second press within EXPANSION_COLLAPSE_CONFIRM_WINDOW_MS collapses them too via one knowingly-accepted, scrollback-clearing full redraw (apache#1134 option 2, deferred by apache#1140 as an orthogonal follow-up). The confirm offer exists for collapses only — collapsed blocks above the viewport are compact and harmless, and arming on expand would make a quick expand-then- collapse pair read the second press as "expand everything". New exports for the runner wiring: hasExpandedEntriesAboveViewport (arming predicate) and applyExpansionDefaultToAll (applies the current default to every entry including above-viewport ones, without flipping the default the way a plain toggle would). The window constant lives beside the notice copy so the offer text and the runner's confirm window share one authority. Generated-by: OpenCode * feat(cli): second Ctrl+O/Ctrl+T press pays one full redraw to collapse stranded blocks (apache#4011) Wire the confirm gesture into the key handler: a collapse toggle that leaves expanded blocks above the viewport arms a 2s window; pressing the same key again inside it applies the collapsed default to every entry and forces one scrollback-clearing full redraw through pi-tui's existing public requestRender(true), which re-anchors the viewport at the tail. Transcript content is fully re-rendered into fresh scrollback, so nothing from the session is lost; only pre-session shell scrollback is cleared, and only after the explicit second press the notice announced. The integration test drives the real renderer on a 24-row terminal: an 80-line thinking block is expanded past the viewport, the first collapse press renders the offer with no ESC[3J in the stream, and the confirmed second press emits exactly the deliberate clear while collapsing the block back to its compact row. Generated-by: OpenCode * fix(cli): re-offer expired expansion confirmation
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 freeto 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.
Summary
Closes#1134. Follow-up to #1097 / #1130.
Expanding a block taller than the terminal pushes the block's own head above the live viewport into terminal scrollback. Scrollback is append-only, so collapsing that block in place is physically impossible without the scrollback-clearing full redraw the #1097 contract forbids — the second Ctrl+O/Ctrl+T found no in-viewport target, returned false, and silently left both the block and the expansion default stuck.
Per the decision on #1134, this accepts the physical limitation instead of "fixing" it (option 3), and removes the two real defects around it:
toggleAllToolExpansion/toggleAllThinkingExpansionnow always flip the expansion default when any candidate entry exists and entry positions are known, so a stuck default no longer leaks into future entries.Not done, deliberately: clamping expanded rendering (regresses full-content-into-scrollback), letting toggles touch head-scrolled blocks (reintroduces the #1097 wipe), or an explicit scrollback-clearing redraw command (possible orthogonal follow-up).
Verification
packages/cli:npm test465/465 (3 new/updated unit tests, 1 new integration test), rootnpm run lintclean.runMakaPiTuiwith a 24-row terminal: an 80-line thinking block is expanded past the viewport, the second Ctrl+T renders the notice, and the whole output stream contains noESC[3J.