Fix char-boundary panic in WorkflowDataSource preview truncation (APP-5287) - #14933
Merged
vorporeal merged 3 commits intoAug 12, 2026
Merged
Conversation
WorkflowDataSource::run_query truncated the workflow description preview with a hard-coded byte slice (&content_preview[..197]), which panics when a multi-byte UTF-8 character straddles byte 197 (e.g. workflow content containing emoji, CJK, or accented Latin text over 200 bytes). Replace the raw slice with the existing safe_truncate helper (also used by the sibling code/notebooks/rules/workflows search_item.rs renderers), and add a regression test with content matching the Sentry-reported failure mode. Fixes APP-5287. Co-Authored-By: Warp Agent <agent@warp.dev>
Assert accessibility_label() text to confirm the truncation floors to the char boundary and appends exactly one ellipsis, rather than only checking that a result was returned. Co-Authored-By: Warp Agent <agent@warp.dev>
vorporeal
marked this pull request as ready for review
August 11, 2026 13:55
vorporeal
reviewed
Aug 11, 2026
Contributor
Author
|
Heads up: this PR and #14935 are two independent fixes for the same panic (APP-5287), produced by two parallel agent runs. Both replace the raw Differences worth weighing:
|
4 tasks
Contributor
|
hey @warp-agent can you address my comment, and close the other PR? |
|
Your GitHub account is not connected to Warp. Connect it here. |
|
Oz couldn't complete this task because required inputs, permissions, or resources were invalid or unavailable. Error Details: |
Contributor
|
hey @warp-agent can you address my review comment, and close the other PR? |
|
Your GitHub account is not connected to Warp. Connect it here. |
David is confident this fixes the issue and doesn't expect a future regression, so drop the unit test and keep the PR to the one-line safe_truncate swap. Co-Authored-By: Warp Agent <agent@warp.dev>
vorporeal
approved these changes
Aug 12, 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 a panic in the AI
@context-menu Workflow data source:WorkflowDataSource::run_querybuilt a hover-preview description for each workflow by slicing its content at a hard-coded byte offset (&content_preview[..197]) whenever the preview exceeded 200 bytes. If a multi-byte UTF-8 character (emoji, CJK, accented Latin, etc.) straddled byte 197, this slice panicked withbyte index 197 is not a char boundary.run_queryreads workflows fromCloudModel(Warp Drive), not from local workflow YAML, so the panic is triggered by workflow content synced from Warp Drive, not by the user's typed query. It fires when the Workflows category is opened in the@context menu (i.e.AIContextMenuAction::CategorySelected { category: Workflows }) or when a query runs against it — not on the bare@zero state before a category is selected.Note: the initial report speculated this was a
ByteOffset/CharOffset(crates/string-offset) misuse, but that crate is not on this code path — the actual bug is the raw byte slice shown above.Linked Issue
Fixes APP-5287
Changes
app/src/search/ai_context_menu/workflows/data_source.rs: replace the raw&content_preview[..197]slice with the existingsafe_truncatehelper (app/src/search/ai_context_menu/mod.rs), which floors to the nearest valid UTF-8 char boundary. This is the same helper already used by the siblingcode/notebooks/rules/workflowssearch_item.rsrenderers, so allai_context_menutruncation now goes through one path.I audited the other
ai_context_menudata sources (blocks,rules,skills,conversations,notebooks) for the same raw-byte-slice pattern; none of them have it —notebooks/data_source.rsalready used achar_indices-based safe truncation, and thesearch_item.rsrenderers already usedsafe_truncate. Onlyworkflows/data_source.rshad the bug, so the fix is scoped to that one line.Testing
This is a one-line logic fix with no unit test attached; coverage instead comes from the GUI verification below, run on an equivalent fix branch:
cargo nextest run -p warp -E 'test(search::ai_context_menu)'— passing, no regressions.cargo clippy -p warp --all-targets --tests -- -D warnings— clean../script/format— clean (no changes needed beyond the edit).Screenshots / Videos
Captured on an equivalent fix branch (same repro workflow, same machine):
@→ Workflows → the repro workflow renders with a truncated preview, filtering works, and the app survives: https://oz.staging.warp.dev/artifacts/019ff146-9d8f-72ee-b741-b9b6f911078fmaster(cd49bd7), same machine and workflow: the window vanishes on opening Workflows (the panic): https://oz.staging.warp.dev/artifacts/019ff14c-2725-7821-91a7-b1973b08c5c0AIContextMenuAction::CategorySelected { category: Workflows }.Agent Mode
CHANGELOG-BUG-FIX: Fixed a crash in the AI
@context menu when a workflow's content included multi-byte characters (emoji, CJK, accented Latin) near the preview truncation boundary.Conversation: https://staging.warp.dev/conversation/b38216ff-032f-47cf-96bf-c7b058b89806
Run: https://oz.staging.warp.dev/runs/019ff0fd-e7e7-73c8-a339-b9ef2471b442
This PR was generated with Oz.