Skip to content

Fix AI block crash rendering grouped images#11766

Merged
vkodithala merged 2 commits into
masterfrom
varoon/crash-blocklist-render
May 27, 2026
Merged

Fix AI block crash rendering grouped images#11766
vkodithala merged 2 commits into
masterfrom
varoon/crash-blocklist-render

Conversation

@vkodithala
Copy link
Copy Markdown
Contributor

@vkodithala vkodithala commented May 27, 2026

Description

Fixes a slice bounds panic in AI block rendering when collapsible reasoning or summarization text includes multiple renderable markdown image groups but has no preallocated persistent tooltip handles.

The grouped image path now treats tooltip handles as best-effort: it selects only the available handle suffix for a group and degrades to no persistent handles when exhausted, preserving image rendering while avoiding out-of-bounds slicing.

Agent Mode conversation: https://staging.warp.dev/conversation/fedec4e9-7678-47da-98b7-6b3547e06320

From Varoon: Some context here, but I'm fairly certain this is related to code changes introduced in ZL's PR here. My hunch is that the user's session included some collapsible block (reasoning/summarization) with Markdown images. Since these changes were merged within the user's noted "regression boundary", seem like a good candidate.

Linked Issue

Fixes #11679

  • 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

  • cargo fmt --check
  • cargo clippy --workspace --all-targets --all-features --tests -- -D warnings
  • cargo nextest run -p warp -E 'test(image_tooltip_handles_for_group_uses_available_handles_only)'
  • 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

CHANGELOG-BUG-FIX: Fixed a crash when rendering AI reasoning or summaries that contain multiple markdown images.

Co-Authored-By: Oz oz-agent@warp.dev

@cla-bot cla-bot Bot added the cla-signed label May 27, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 27, 2026

@vkodithala

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Overview

This PR replaces the grouped-image tooltip-handle slicing with a helper that safely uses only the available handle suffix, preventing the out-of-bounds panic when grouped markdown images render without enough preallocated handles. The added unit test covers exhausted and partially available handle slices.

Concerns

  • For this user-facing change, please include screenshots or a screen recording demonstrating grouped AI block images rendering without crashing end to end.

Verdict

Found: 0 critical, 1 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

Copy link
Copy Markdown
Contributor

@lucieleblanc lucieleblanc left a comment

Choose a reason for hiding this comment

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

Safety first 🚧 ⚠️ thanks for the fix.

Small non-blocking comment on the overall tooltip organization that's out of scope for this cherry-pick PR.

Comment on lines +1153 to +1157
let handles_for_group = image_tooltip_handles_for_group(
props.image_section_tooltip_handles,
*props.starting_image_section_index,
image_group.images.len(),
);
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.

Very code-first follow-up: I don't love that we use a contiguous array of handles for these grouped image tooltips. It feels like a C/C++ pattern and I'm pretty sure we could have a more idiomatic Rust construct for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, agreed that it's a little weird. Didn't dig too deeply into why we do this (didn't want to blow up the scope of this PR), but aligned that we should probably fix. ZL's the owner here lol and not sure how high-prio since this isn't a functional issue.

@vkodithala vkodithala merged commit 64862fe into master May 27, 2026
53 checks passed
@vkodithala vkodithala deleted the varoon/crash-blocklist-render branch May 27, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants