Cap in-band generator command output size (APP-4792)#13131
Draft
warp-dev-github-integration[bot] wants to merge 1 commit into
Draft
Cap in-band generator command output size (APP-4792)#13131warp-dev-github-integration[bot] wants to merge 1 commit into
warp-dev-github-integration[bot] wants to merge 1 commit into
Conversation
In-band generator commands (completions, syntax highlighting, prompt context chips) capture their entire stdout/stderr into a CommandOutput with no size limit. A misbehaving or very chatty generator can therefore buffer gigabytes that stay alive on the generator's pending future. Heap profiles from "Excessive memory usage detected" (Sentry 7259255054) show ~7.4 GB retained on the CurrentPrompt context-chip fetch path through the async_channel<CommandOutput> queue. Cap retained in-band generator output at 1 MiB in handle_executed_command_event, truncating and shrinking beyond the limit. Generator results are short, so the cap is safe while preventing the pathological multi-GB case. 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.
Description
In-band generator commands (completions, syntax highlighting, prompt context chips) capture their entire stdout/stderr into a
CommandOutputwith no size cap. A misbehaving or very chatty generator therefore buffers its full output into aVec<u8>that stays alive on the generator's pending future.Heap profiles from the recurring "Excessive memory usage detected" alert (Sentry
7259255054) show ~8.8 GB live heap, with ~7.4 GB (78.6%) retained on theCurrentPromptcontext-chip fetch path:ModelContext<CurrentPrompt>::spawn_abortable::<...fetch_chip_value_once...>— 7.39 GB (78.6%)CurrentPrompt::execute_session_command_with_timeout::{closure}— 5.79 GB (61.6%)async_channel::Receiver<CommandOutput>drop — 1.60 GB (17.1%)This PR caps retained in-band generator output at 1 MiB in
InBandCommandExecutor::handle_executed_command_event, truncating and shrinking beyond the limit. Generator results are short strings (the prompt chip ultimately callsCommandOutput::to_string()), so the cap is safe while preventing the pathological multi-GB case.This is a distinct facet from #13028 (which stops retaining hidden in-band command blocks); that PR explicitly notes the generator's output is captured separately from the block. This PR bounds that separately-captured output.
Linked Issue
APP-4792 — https://linear.app/warpdotdev/issue/APP-4792
ready-to-specorready-to-implement.Testing
Added unit tests for the cap helper (
test_cap_in_band_output_leaves_small_output_untouched,test_cap_in_band_output_truncates_oversized_output,test_cap_in_band_output_keeps_output_at_exact_limit).cargo check -p warp --lib— passescargo clippy -p warp --lib --tests -- -D warnings— clean (compiles the new test code)cargo nextest/./script/presubmit— building thewarptest binary OOMs (SIGKILL) in this runner above a single build job, same limitation called out in Stop retaining hidden in-band generator command blocks (#12694) #13028. Worth a full CI pass before merge../script/runAgent Mode
Conversation: https://staging.warp.dev/conversation/57c39a0f-32e7-478d-b352-08c3f801e0ed
Run: https://oz.staging.warp.dev/runs/019f0afd-6103-7c58-addd-00c058ed2f5b
This PR was generated with Oz.