Skip to content

fix: guard passive suggestions against oversized task payloads (APP-4650)#12867

Draft
warp-dev-github-integration[bot] wants to merge 1 commit into
masterfrom
oz-agent/fix-passive-suggestions-memory-APP-4650
Draft

fix: guard passive suggestions against oversized task payloads (APP-4650)#12867
warp-dev-github-integration[bot] wants to merge 1 commit into
masterfrom
oz-agent/fix-passive-suggestions-memory-APP-4650

Conversation

@warp-dev-github-integration

Copy link
Copy Markdown
Contributor

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_params calls conversation.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:

PassiveSuggestionTrigger::AgentResponseCompleted
  → build_passive_suggestions_request_params
  → conversation.compute_active_tasks()   ← returns all task + FileContext data
  → api::ConversationData { tasks }       ← serialized into the proto request

Fix

Added a MAX_PASSIVE_SUGGESTION_TASK_BYTES (64 MB) guard in build_passive_suggestions_request_params. After calling compute_active_tasks(), we compute prost::Message::encoded_len on 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 warp passes (pre-existing unrelated error in warpui_core)
  • rustfmt applied on changed file

Fixes: 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.

)

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>
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