Skip to content

Fix/screenshots size cap - #488

Merged
gaurav-singh-9227 merged 3 commits into
browserstack:mainfrom
SavioBS629:fix/screenshots-size-cap
Oct 16, 2026
Merged

gaurav-singh-9227 merged 3 commits into
browserstack:mainfrom
SavioBS629:fix/screenshots-size-cap

Conversation

@SavioBS629

Copy link
Copy Markdown
Collaborator

No description provided.

SavioBS629 and others added 2 commits October 15, 2026 15:09
fetchAutomationScreenshots had no size limit on any of its allocations,
so one call could grow a hosted pod by hundreds of MB (the sharp/libvips
pixel buffers traced in ai-common-infra-ops#125).

- Cap the /sessions/{id}/logs download at MAX_LOG_BYTES (5 MB on remote),
  matching getFailureLogs on the same endpoint.
- Cap each screenshot download at 10 MB on remote; skip oversized ones and
  return the rest, or explain if all are too large.
- In maybeCompressBase64, reject images over 25M px before decoding and
  downscale to at most 1920 px on the long side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Local stdio runs keep full-resolution screenshots and sharp's default
pixel limit, matching the REMOTE_MCP gating of the download caps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: beed8081-49d7-4887-9482-b3eed91fe93f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

PR browserstack#481 and this branch both rewrote fetchAndCompress, so they could not be
merged independently. This brings browserstack#481's changes onto the size-cap work:

- parse DEBUG visual-log screenshots alongside test-initiated ones, anchored
  on the timestamped log prefix so a REQUEST cannot borrow a later RESPONSE
- restrict screenshot URLs to https on BrowserStack, S3 and B2 hosts
- detect the image mime type from the bytes, after compression: sharp
  re-encodes anything over 1 MB to PNG, so reading the original bytes would
  label a large JPEG wrongly
- report the empty result as a debug-mode hint rather than an unexpected error

Screenshot keeps both shapes: it carries mimeType and fetchAndCompress still
returns null for an oversized download so the remaining screenshots load.

The size-cap tests now use timestamped log lines and allowlisted https URLs,
routed to the local server by the apiClient spy; the previous fixtures were
written against the older permissive parser and would otherwise parse to no
URLs at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gaurav-singh-9227
gaurav-singh-9227 merged commit 983b326 into browserstack:main Oct 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants