Fix underflow in flat storage RowIterator after a clear.#12085
Merged
Conversation
Contributor
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
Contributor
There was a problem hiding this comment.
Overview
This PR updates flat storage index rebuilding to preserve the absolute content offset when resizing an empty index after scrollback truncation and clear, and adds a focused regression test for the crash path.
Concerns
- No blocking correctness, security, or spec-alignment concerns found in the reviewed diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
alokedesai
approved these changes
Jun 3, 2026
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.

Description
Fixes the crash reported in Sentry issue WARP-CLIENT-BETA-STABLE-7TK6.
When flat storage had discarded prior scrollback, clearing all rows and then resizing rebuilt an empty row index with a zero content offset while the underlying content buffer retained its absolute offset. Materializing the next row could then underflow while indexing content and panic in
RowIterator::next.This preserves the existing absolute content offset when rebuilding an empty index and adds a regression test covering truncate-front, clear, resize, push, and row materialization.
Linked Issue
Testing
range start index ... out of range for slice of length 1024panic.cargo nextest run --manifest-path /Users/david/src/warp-2/Cargo.toml -p warp_terminal -E 'test(test_clear_after_truncate_front_then_resize_and_push_does_not_panic)'cargo nextest run --release --manifest-path /Users/david/src/warp-2/Cargo.toml -p warp_terminal -E 'test(test_clear_after_truncate_front_then_resize_and_push_does_not_panic)'cargo fmt --manifest-path /Users/david/src/warp-2/Cargo.toml -p warp_terminal -- --checkManual validation and screenshots are not included because this fixes an internal flat-storage invariant that is directly reproduced by the unit regression test.
Agent Mode
Changelog Entries for Stable
CHANGELOG-BUG-FIX: Fixed a crash that could occur after clearing and resizing a terminal with scrollback.
Co-Authored-By: Oz oz-agent@warp.dev