Skip to content

perf(terminal): use RestoreBlocks stage in insert_restored_block#13112

Open
acarl005 wants to merge 1 commit into
andy/long-convo-latency-exchange-lookupfrom
long-convo-latency-restore-blocks-stage
Open

perf(terminal): use RestoreBlocks stage in insert_restored_block#13112
acarl005 wants to merge 1 commit into
andy/long-convo-latency-exchange-lookupfrom
long-convo-latency-restore-blocks-stage

Conversation

@acarl005

@acarl005 acarl005 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Part of a stack of performance fixes for #9799.

This PR: insert_restored_block was calling restore_block with BootstrapStage::PostBootstrapPrecmd, which causes Block::new to set PerformResetGridChecks::Yes (the Windows ConPTY path). This meant a redundant disable_reset_grid_checks() call was needed afterward before parsing the serialized command/output bytes.

Passing BootstrapStage::RestoreBlocks instead is semantically correct (these blocks are being restored, not coming in post-bootstrap), and since RestoreBlocks.is_done() == false, Block::new sets PerformResetGridChecks::No automatically. The now-redundant disable_reset_grid_checks() call inside restore_block is removed.

Linked Issue

Fixes #9799

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

Manually loaded a conversation with 3014 AI exchanges and verified correct rendering of restored blocks.

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot cla-bot Bot added the cla-signed label Jun 26, 2026

acarl005 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@oz-for-oss

This comment was marked as resolved.

oz-for-oss[bot]

This comment was marked as resolved.

@acarl005 acarl005 force-pushed the long-convo-latency-restore-blocks-stage branch 2 times, most recently from 3fd5226 to 07b7b3b Compare June 27, 2026 00:15
@acarl005

Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss

oz-for-oss Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

@acarl005

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR changes restored block insertion to use BootstrapStage::RestoreBlocks and removes the unconditional reset-grid-check disable from restore_block.

Concerns

  • Removing disable_reset_grid_checks() inside restore_block affects existing shared-session scrollback callers that still restore blocks with BootstrapStage::PostBootstrapPrecmd, leaving Windows reset-grid assertions enabled while replaying serialized bytes.
  • This is user-facing terminal restoration behavior, but the PR description only includes textual manual testing. For this user-facing change, please include screenshots or a short recording demonstrating restored blocks rendering correctly end to end.
  • No approved spec context was provided, and the supplemental security pass found no additional security issues.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

self.active_block_mut().start_background(None);
} else {
self.active_block_mut().start();
self.active_block_mut().disable_reset_grid_checks();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] This removal applies to all restore_block callers, but shared-session scrollback still passes BootstrapStage::PostBootstrapPrecmd; on Windows that keeps reset-grid checks enabled while replaying serialized command/output bytes that do not necessarily include a reset-grid OSC. Keep this disable for the PostBootstrapPrecmd restore paths, or otherwise limit the optimization to RestoreBlocks callers.

@acarl005 acarl005 force-pushed the long-convo-latency-restore-blocks-stage branch from 07b7b3b to cc6d905 Compare June 27, 2026 01:21
@acarl005 acarl005 force-pushed the andy/long-convo-latency-exchange-lookup branch from 90448a3 to 75061d8 Compare June 27, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant