fix: guard passive suggestions against oversized task payloads (APP-4650)#12867
Draft
warp-dev-github-integration[bot] wants to merge 1 commit into
Draft
fix: guard passive suggestions against oversized task payloads (APP-4650)#12867warp-dev-github-integration[bot] wants to merge 1 commit into
warp-dev-github-integration[bot] wants to merge 1 commit into
Conversation
) Add a 64 MB size guard in `build_passive_suggestions_request_params` to prevent serializing GBs of multi-agent FileContext data into passive suggestion protobuf requests. The trigger path is: PassiveSuggestionTrigger::AgentResponseCompleted → build_passive_suggestions_request_params → conversation.compute_active_tasks() ← returns all task + FileContext data → api::ConversationData { tasks } ← stuffed into the proto request When a user has run several Agent Mode sessions (especially concurrent orchestration runs with large tool-result/FileContext payloads), the accumulated task data can reach many GBs. Encoding that into a protobuf request spikes resident memory. Fix: compute prost::Message::encoded_len on the active tasks before building the ConversationData. If the total exceeds MAX_PASSIVE_SUGGESTION_TASK_BYTES (64 MB), return an error early and skip the passive suggestion request rather than serializing the payload. Sentry issue: https://warpdotdev.sentry.io/issues/7259255054/ Linear: APP-4650 Co-Authored-By: Oz <oz-agent@warp.dev>
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.
Summary
Guards the passive suggestions request builder against serializing oversized multi-agent FileContext payloads into the protobuf request, preventing the memory spike reported in Sentry issue 7259255054.
Root Cause
When a user runs multiple Agent Mode sessions with large tool-result/FileContext payloads (e.g. concurrent orchestration runs),
build_passive_suggestions_request_paramscallsconversation.compute_active_tasks()which returns all accumulated task data. This data is then encoded into a protobuf request (api::ConversationData { tasks }), causing resident memory to spike by many GBs.The trigger path:
Fix
Added a
MAX_PASSIVE_SUGGESTION_TASK_BYTES(64 MB) guard inbuild_passive_suggestions_request_params. After callingcompute_active_tasks(), we computeprost::Message::encoded_lenon all tasks. If the total exceeds the limit, we return an error early and skip the passive suggestion request rather than materializing and serializing the giant payload.Validation
cargo check -p warppasses (pre-existing unrelated error inwarpui_core)rustfmtapplied on changed fileFixes: APP-4650
Sentry: https://warpdotdev.sentry.io/issues/7259255054/
CHANGELOG-BUG-FIX: Fixed memory spike when passive suggestions were triggered after multi-agent sessions with large FileContext payloads
Conversation: https://staging.warp.dev/conversation/248d3dc3-24cd-4129-90b6-9acfe8fb16b5
Run: https://oz.staging.warp.dev/runs/019ee564-cabb-7872-bd6b-23bd39c3aca4
This PR was generated with Oz.