fix(perf): bound sharp screenshot memory in hosted mode to prevent pod OOM - #454
Merged
gaurav-singh-9227 merged 2 commits intoSep 30, 2026
Merged
Conversation
… OOM fetchAutomationScreenshots compressed up to 5 screenshots concurrently (Promise.all) through sharp, with sharp's default libvips cache and a thread pool sized to CPU cores and no cap on peak buffers. On memory- constrained pods that is an OOM risk (several tens-of-MB pixel buffers decoded at once). - Configure sharp once: cache(false) + concurrency(1) — no libvips cache, single worker thread. - Process screenshots sequentially so peak memory is a single image rather than all of them at once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…d OOM fetchAutomationScreenshots compressed up to 5 screenshots concurrently (Promise.all) through sharp, with sharp's default libvips cache and a CPU-core-sized thread pool. On memory-constrained hosted pods that peak (several tens-of-MB pixel buffers decoded at once) is an OOM risk. Scoped to hosted (REMOTE_MCP) mode only — local runs are unchanged: - sharp cache(false) + concurrency(1) when REMOTE_MCP. - Screenshots processed sequentially when REMOTE_MCP (peak = one image); local keeps the concurrent path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited) Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ruturaj-browserstack
approved these changes
Sep 29, 2026
gaurav-singh-9227
approved these changes
Sep 30, 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.
What & why
fetchAutomationScreenshotsdecodes/compresses up to 5 session screenshotsconcurrently (
Promise.all) throughsharp, andsharpwas neverconfigured — so it ran with its default libvips cache and a thread pool
sized to CPU cores. Several tens-of-MB pixel buffers decoded at once, with
no cap on peak memory, is a real OOM risk on memory-constrained hosted pods
(a few concurrent calls can exceed the pod's headroom).
Change (scoped to hosted
REMOTE_MCPmode; local unchanged)sharp.cache(false)+sharp.concurrency(1)— no libvips cache, singleworker thread — when running hosted.
image rather than all of them at once.
npx) behaviour is unchanged — still the concurrent path withsharp defaults (local machines aren't memory-constrained).
Test
tsc, eslint: cleantests/setup.tssharp mock extended withcache/concurrencyno-ops🤖 Generated with Claude Code