Skip to content

feat(chrome): image budget controls for screenshot quality + per-turn capture (#311)#349

Open
Ayush7614 wants to merge 8 commits into
webbrain-one:mainfrom
Ayush7614:feat/image-budget-311
Open

feat(chrome): image budget controls for screenshot quality + per-turn capture (#311)#349
Ayush7614 wants to merge 8 commits into
webbrain-one:mainfrom
Ayush7614:feat/image-budget-311

Conversation

@Ayush7614

@Ayush7614 Ayush7614 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements issue #311 — "Image budget" controls for screenshot quality and capture budget.

Adds a new Image budget section under Settings → Multimodal with three persisted controls, applied to both screenshot capture and vision request formatting (Chrome + Firefox):

  • Image detail (high / low / auto): sent as the OpenAI-style image_url.detail field. auto (default) is a no-op so providers keep their own default.
  • Max screenshots per turn (05, 0 = unlimited): caps auto-screenshots per turn via a per-turn counter that resets at the start of each turn/run.
  • Max image dimension (5122048px): caps the largest side of every vision image and the derived token budget.

Acceptance criteria

  • Persisted & applied — settings stored in chrome.storage.local / browser.storage.local, hydrated in background.js, and applied in agent.js across all vision capture paths (auto-screenshot, /screenshot, full_page_screenshot, verify_form, crop/localization, user attachments).
  • Defaults preserve existing behaviorauto detail, unlimited screenshots, 1568px cap. The default cap maps to the legacy IMAGE_BUDGET byte-for-byte, so near-square viewports still downscale to ~1109px exactly as before.
  • UI explanation — the card includes a cost/latency note (provider-dependent detail, caps shrink images before sending, manually saved full-resolution images are unaffected).

Verification

  • node --check on edited JS files: pass.
  • npm test (node test/run.js): 789 passed, 0 failed.

Notes / scope

  • Chrome and Firefox (agent helpers, settings UI, storage hydration, locales).
  • Copilot review items and follow-up findings addressed in subsequent commits on this branch (counter semantics, coord-aligned side-only budget, skip signals, storage validation, full-res save, unit tests, i18n).

… capture (issue webbrain-one#311)

Add an 'Image budget' section under Settings → Multimodal with three persisted
controls applied to screenshot capture and vision request formatting:

- imageDetail (high/low/auto): sent as the OpenAI-style image_url 'detail'
  field; 'auto' (default) is a no-op so providers keep their default.
- maxScreenshotsPerTurn (0-5, 0=unlimited): caps auto-screenshots per turn
  via a per-turn counter reset at the start of each turn.
- maxImageDimension (512-2048px): caps every vision image's largest side and
  the token budget derived from it.

Defaults preserve pre-webbrain-one#311 behavior: auto detail, unlimited screenshots, and a
1568px cap that maps to the legacy IMAGE_BUDGET byte-for-byte (near-square
viewports still downscale to ~1109px). Budget is applied to all vision capture
paths (auto-screenshot, /screenshot, full_page_screenshot, verify_form, crop,
user attachments). UI shows a cost/latency explanation.
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

@Ayush7614 is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Ayush7614

Copy link
Copy Markdown
Contributor Author

cc: @esokullu

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Chrome image-budget controls for vision captures and requests.

Changes:

  • Adds persisted image detail, screenshot-count, and dimension controls.
  • Applies image detail and resizing across several vision paths.
  • Adds settings UI and locale fallbacks.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/chrome/src/agent/agent.js Implements image budgets and capture limits.
src/chrome/src/background.js Hydrates persisted budget settings.
src/chrome/src/ui/settings.js Loads and saves the controls.
src/chrome/src/ui/settings.html Adds the Image budget settings card.
src/chrome/src/ui/locales/en.js Adds English labels and guidance.
src/chrome/src/ui/locales/ar.js Adds Arabic-locale fallbacks.
src/chrome/src/ui/locales/es.js Adds Spanish-locale fallbacks.
src/chrome/src/ui/locales/fr.js Adds French-locale fallbacks.
src/chrome/src/ui/locales/he.js Adds Hebrew-locale fallbacks.
src/chrome/src/ui/locales/id.js Adds Indonesian-locale fallbacks.
src/chrome/src/ui/locales/ja.js Adds Japanese-locale fallbacks.
src/chrome/src/ui/locales/ko.js Adds Korean-locale fallbacks.
src/chrome/src/ui/locales/ms.js Adds Malay-locale fallbacks.
src/chrome/src/ui/locales/pl.js Adds Polish-locale fallbacks.
src/chrome/src/ui/locales/ru.js Adds Russian-locale fallbacks.
src/chrome/src/ui/locales/th.js Adds Thai-locale fallbacks.
src/chrome/src/ui/locales/tl.js Adds Tagalog-locale fallbacks.
src/chrome/src/ui/locales/tr.js Adds Turkish-locale fallbacks.
src/chrome/src/ui/locales/uk.js Adds Ukrainian-locale fallbacks.
src/chrome/src/ui/locales/zh.js Adds Chinese-locale fallbacks.
Files not reviewed (1)
  • src/chrome/src/ui/locales/th.js: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/chrome/src/agent/agent.js Outdated
Comment on lines +2608 to +2613
const _screenshotCap = Number(this.maxScreenshotsPerTurn) || 0;
const _overBudget = _screenshotCap > 0 && (this.autoScreenshotCount.get(tabId) || 0) >= _screenshotCap;
await new Promise(r => setTimeout(r, 250));
const shot = await this._captureAutoScreenshot(tabId);
const shot = _overBudget ? null : await this._captureAutoScreenshot(tabId);
if (shot) {
if (_screenshotCap > 0) this.autoScreenshotCount.set(tabId, (this.autoScreenshotCount.get(tabId) || 0) + 1);
Comment thread src/chrome/src/agent/agent.js Outdated
content: [
{ type: 'text', text: prompt },
{ type: 'image_url', image_url: { url: screenshot.dataUrl } },
{ type: 'image_url', image_url: this._withImageDetail({ url: screenshot.dataUrl }) },
Comment thread src/chrome/src/agent/agent.js Outdated
const rawUrl = `data:image/png;base64,${screenshot.data}`;
return {
dataUrl: await this._compressJpegToByteCeiling(rawUrl),
dataUrl: await this._compressJpegToByteCeiling(rawUrl, this._budgetForCapture()),
Comment thread src/chrome/src/agent/agent.js Outdated
};
}
blocks.push({ type: 'image_url', image_url: { url: att.dataUrl } });
blocks.push({ type: 'image_url', image_url: this._withImageDetail({ url: att.dataUrl }) });
Comment thread src/chrome/src/background.js Outdated
if (stored.maxScreenshotsPerTurn != null) agent.maxScreenshotsPerTurn = stored.maxScreenshotsPerTurn;
if (stored.maxImageDimension != null) agent.maxImageDimension = stored.maxImageDimension;
}
loadImageBudget();
@esokullu

Copy link
Copy Markdown
Collaborator

@Ayush7614 thank you. Pls confirm these are all addressed

Resolve the settings.js conflict with main, then close the Copilot review
items on webbrain-one#349:

- Count initial viewport auto-screenshots toward maxScreenshotsPerTurn via
  a shared check/capture/increment helper
- Apply maxImageDimension to localization, coord-aligned captures (with
  CSS scale transforms), and user image attachments
- Await imageBudgetReady in handleMessage so cold SW starts hydrate budget
  settings before the first turn

Tests: 759 passed.
@esokullu

Copy link
Copy Markdown
Collaborator

Progress update — review + conflicts addressed

Pushed 8c829834 onto this branch (rebased/merged onto current main + review fixes).

Merge conflicts

  • Resolved the sole conflict in src/chrome/src/ui/settings.js (kept both selectionShortcutEnabled from main and the image-budget keys from this PR).
  • Branch is now based on latest main and should be mergeable.

Copilot review items

# Issue Fix
1 Initial viewport capture ignored maxScreenshotsPerTurn Shared _captureBudgetedAutoScreenshot() helper used for both initial viewport and post-action auto-screenshots
2 Localization vision image ignored maxImageDimension _locateVisibleMediaWithVision budget-shrinks before the vision call and maps the box back to original cropDataUrl coords
3 coord_aligned captures only quality-compressed When viewport exceeds the cap, resize with _shrinkImageForBudget and report the CSS scale transform in the tool description
4 User attachments bypassed dimension cap _applyAttachments is async and budget-resizes a model-facing copy (original attachment left intact)
5 loadImageBudget() not awaited on cold SW start imageBudgetReady promise retained and awaited in handleMessage (alongside screenshotRedactionReady)

Verification

  • node --check on edited JS files: pass
  • npm test: 759 passed, 0 failed

@Ayush7614 / @esokullu — ready for re-review / merge.

@esokullu

Copy link
Copy Markdown
Collaborator

Code review: feat/image-budget-311

Automated branch review vs origin/main (merge-base 4152fe5d).

Issue counts: 2 bugs, 5 suggestions, 4 nits


Summary

This branch adds user-facing image-budget controls (vision detail, max auto-screenshots per turn, max image dimension) for Chrome: agent capture/attachment paths honor the budget, settings UI + storage hydration wire it through, and attachment tests are updated for async _applyAttachments. The core plumbing (_budgetForCapture, _captureBudgetedAutoScreenshot, _withImageDetail) is coherent and defaults mostly match pre-#311 non-coord capture. Dominant risks: no Firefox mirror despite project parity rules; coord_aligned capture is no longer 1:1 at default settings on common viewports (token budget forces resize), which regresses pixel-click fidelity; and budget exhaustion / attachment shrink lack tests and user-visible feedback.

Issues

Issue 1 -- Severity: bug

  • File: src/chrome/src/agent/agent.js:129 (feature overall; Firefox counterparts absent)
  • Description: Image-budget agent logic, settings UI, locales, and background.js hydration exist only under src/chrome/. src/firefox/ has no imageDetail / maxScreenshotsPerTurn / maxImageDimension, no _captureBudgetedAutoScreenshot / _budgetForCapture / _withImageDetail, and Firefox _applyAttachments remains sync and does not budget-resize images. Project rules require mirroring agent/UI changes across Chrome and Firefox unless the platform makes it impossible; screenshot budgeting is not Chrome-specific.
  • Suggestion: Port the agent helpers, settings card + locale keys, and background storage load/onChanged wiring to Firefox (adjusting only for real API differences). Keep _applyAttachments async-or-sync consistent so shared tests exercise the same behavior.
  • Status: open

Issue 2 -- Severity: bug

  • File: src/chrome/src/agent/agent.js:3211
  • Description: coordAligned captures previously skipped token/dimension resize and only ran _compressJpegToByteCeiling, keeping image pixels == CSS pixels for click({x,y}). At the claimed default budget (maxTargetPx/maxTargetTokens = 1568), a normal 1920×1080 viewport now hits needsResize because estimated tokens (~2645) exceed 1568, so the path downscales and returns coordAligned: false. Constructor comments say defaults preserve prior behavior; for coord-aligned this is a silent regression on large/common viewports without the user changing any setting. The same logic is duplicated on the screenshot tool path (agent.js:8499) and tabs-API fallback (agent.js:8566).
  • Suggestion: Either (a) apply only the per-side maxImageDimension cap to coord-aligned mode and leave the token budget for non-coord captures (preserving 1:1 whenever both sides ≤ cap), or (b) document the regression and raise the default token allowance for coord-aligned so 1080p stays 1:1 unless the user lowers the dimension. Ensure any forced downscale always surfaces scale factors in the model-facing description (tool path does; auto-capture object fields alone do not).
  • Status: open

Issue 3 -- Severity: suggestion

  • File: src/chrome/src/agent/agent.js:3175
  • Description: When maxScreenshotsPerTurn is exhausted, _captureBudgetedAutoScreenshot returns null with no trace note, tool_result, or user/message hint. Call sites (initial viewport agent.js:1783, post-action agent.js:2615) simply omit the image. The agent can go “blind” mid-turn with no signal that the limit, not a capture failure, caused the omission. Locale copy also claims “the agent still captures at least when state changes,” which is false once the budget is spent (e.g. limit 1 used by the initial shot).
  • Suggestion: When the budget blocks a capture, inject a short trusted note (and/or onUpdate warning / trace note) such as “auto-screenshot skipped: maxScreenshotsPerTurn reached.” Fix st.imageBudget.maxPerTurn.desc so it does not promise a state-change capture after the budget is used.
  • Status: open

Issue 4 -- Severity: suggestion

  • File: test/run.js:2486
  • Description: Existing “image budget” tests only cover static _fitImageDimensions / token estimates. There are no tests for _budgetForCapture (default vs lower/higher caps), _canTakeAutoScreenshot / _recordAutoScreenshot / _captureBudgetedAutoScreenshot (failed capture must not burn a slot; limit 1 shared by initial + post-action), _withImageDetail (auto omits field; high/low set detail), or async attachment resizing. Regressions in the new counter and budget mapping are easy to miss.
  • Suggestion: Add unit tests on AgentCh (and AgentFx once ported) that stub _captureAutoScreenshot / _shrinkImageForBudget and assert counter semantics, default budget equality to IMAGE_BUDGET, and detail attachment shape.
  • Status: open

Issue 5 -- Severity: suggestion

  • File: src/chrome/src/agent/agent.js:3563
  • Description: _locateVisibleMediaWithVision always re-runs _shrinkImageForBudget with screenshot.width/height (CSS space from the primary capture path) even when dataUrl was already budget-resized and visionWidth/visionHeight were already set on the capture result (agent.js:3531). That double-encodes JPEG (quality loss + extra SW work). The new visionWidth/visionHeight fields are never read.
  • Suggestion: If visionWidth/visionHeight are present and match the model-facing image, skip re-shrink and use those dims for the prompt + inverse scale. Otherwise shrink once and prefer actual bitmap dimensions over caller-supplied CSS dims when they disagree.
  • Status: open

Issue 6 -- Severity: suggestion

  • File: src/chrome/src/background.js:197
  • Description: loadImageBudget / onChanged assign storage values with no allowlist or numeric coercion. A corrupted imageDetail (anything other than high|low|auto) is forwarded via _withImageDetail into OpenAI-style payloads and may cause provider 4xx. Non-numeric maxImageDimension / maxScreenshotsPerTurn rely on later Number(...) || default in some paths but raw assignment can leave surprising agent state until the next capture helper runs.
  • Suggestion: Validate on load and on change: imageDetail ∈ {high,low,auto}, clamp maxScreenshotsPerTurn to the UI set (0–5), clamp maxImageDimension to the same range as _budgetForCapture (1–2048) and the select options.
  • Status: open

Issue 7 -- Severity: suggestion

  • File: src/chrome/src/agent/agent.js:8609
  • Description: When screenshot is called with save: true, the download uses the same dataUrl that was budget-resized for the model. After the new coord-aligned resize path, a user who expected a full-CSS “save this screenshot” can get a downscaled JPEG when the viewport exceeds the budget, despite the settings warning’s implication that saved full-resolution images are unaffected (that warning mainly covers user attachments, but is easy to misread).
  • Suggestion: Keep a pre-budget (or pre-model) data URL for the download path, and only send the budgeted copy via _attachImage / vision describe. Align the warning copy with actual save behavior.
  • Status: open

Issue 8 -- Severity: nit

  • File: src/chrome/src/ui/settings.js:49
  • Description: Accidental extra indentation on autoScreenshotSelect / image-budget select consts (and only those) makes the top-level binding block inconsistent and looks like a partial edit artifact.
  • Suggestion: Align indentation with the surrounding const declarations.
  • Status: open

Issue 9 -- Severity: nit

  • File: src/chrome/src/ui/settings.html:1078
  • Description: select-max-image-dimension has no selected on the 1568 default option (first option is 512). JS sets 1568 on init, but before/without init the control shows 512, unlike imageDetail which correctly marks auto selected.
  • Suggestion: Add selected to the 1568px option (and optionally to unlimited for max screenshots for consistency, though 0 is already first).
  • Status: open

Issue 10 -- Severity: nit

  • File: src/chrome/src/ui/locales/es.js:613 (and other non-en locale files)
  • Description: New st.imageBudget.* strings were pasted in English into every non-English locale file. Docs allow English fallback, so this is safe, but it bloats locale files with duplicate English and skips real localization.
  • Suggestion: Either omit keys from non-en files (rely on en.js fallback) or add real translations in a follow-up.
  • Status: open

Issue 11 -- Severity: nit

  • File: src/chrome/src/agent/agent.js:3257
  • Description: Non-coord _captureAutoScreenshot path builds budget for CDP quality/_fitImageDimensions but still calls _compressJpegToByteCeiling(rawDataUrl) without passing budget. Harmless today because only maxTargetPx/maxTargetTokens differ from the static defaults (byte ceiling is shared), but inconsistent with every other updated call site and fragile if maxBase64Chars ever becomes user-tunable.
  • Suggestion: Pass budget for consistency: _compressJpegToByteCeiling(rawDataUrl, budget).
  • Status: open

Mirror Chrome image-budget (webbrain-one#311) to Firefox (agent helpers, settings,
storage hydration, locales), skip re-shrink when vision dims are already
set, and add unit tests for budget mapping, detail, and per-turn counters.
@esokullu

Copy link
Copy Markdown
Collaborator

Follow-up: review items (1), (4), (5)

Addressed on commit bf0d0cfe (bf0d0cfe4fb3a023c458db392be3c226f8db23b7).

Done

# Item Status
1 Firefox parity for image budget Fixed — agent helpers (_budgetForCapture, _captureBudgetedAutoScreenshot, _withImageDetail, counters), settings card + storage hydration, locales, background load/onChanged
4 Unit tests for budget helpers Fixed — default budget == IMAGE_BUDGET; lower/higher maxImageDimension remaps tokens; _withImageDetail only when non-auto; counter + failed capture does not burn a slot (Chrome + Firefox)
5 Double-shrink / unused visionWidth/visionHeight Fixed — locate prefers capture vision dims and skips re-shrink; maps boxes back to crop CSS space (Chrome + Firefox)

npm test: 763 passed, 0 failed.

Still open from the original review

  • (2) coord_aligned default budget can downscale common 1080p viewports (1:1 pixel-click regression on Chrome)
  • (3) silent maxScreenshotsPerTurn exhaustion (no user/trace signal)
  • Other suggestions/nits (storage validation, save-path full-res, etc.)

Note on PR head

This PR’s head is on fork Ayush7614:feat/image-budget-311. The follow-up commit was pushed to webbrain-one/webbrain@feat/image-budget-311 (bf0d0cfe) because write access to the fork is not available from this environment. To land it on this PR, either:

  1. Cherry-pick / merge bf0d0cfe into the fork branch, or
  2. Retarget / open a PR from webbrain-one:feat/image-budget-311.

…ip signal

Coord-aligned captures honor maxImageDimension per side without the vision
token budget so common viewports stay 1:1 when under the cap. Exhausted
per-turn auto-screenshot limits emit a warning, trusted note, and trace;
settings copy no longer promises state-change captures after the budget.
…ss budget)

Align settings const indentation, mark 1568px as the selected default, and
pass the active capture budget into non-coord JPEG byte-ceiling compress.
Normalize imageDetail / maxScreenshotsPerTurn / maxImageDimension on load
and settings change so corrupt storage cannot reach providers. Viewport
screenshot save:true keeps a pre-budget CSS-resolution data URL for
Downloads (matching full_page_screenshot) while the model still gets the
budgeted, optionally redacted copy.
Replace English stubs for st.imageBudget.* with real translations in
Chrome and Firefox locale files (review nit webbrain-one#10).
@esokullu

Copy link
Copy Markdown
Collaborator

Image budget review — status of all findings

Follow-up commits through a1300677 on feat/image-budget-311.

Bugs

# Finding Status
1 Firefox parity missing Done — agent helpers, settings UI, storage hydration, locales
2 coord_aligned default token budget downscaled 1080p / broke 1:1 Done_budgetForCoordAlignedCapture(): side cap only (maxImageDimension), not vision token budget. Common viewports under the side cap stay 1:1; e.g. 1440×900 no longer shrinks on tokens alone

Suggestions

# Finding Status
3 Silent maxScreenshotsPerTurn exhaustion DoneonUpdate warning, trusted conversation note, trace.recordNote(…, auto_screenshot_budget_skipped); settings copy no longer promises state-change captures after the budget
4 Missing unit tests for new helpers Done — default budget, remapped caps, detail, counter / failed-capture slot, coord budget, skip notify, storage normalize, save:true structural test
5 Double-shrink / unused visionWidth/visionHeight Done — locate prefers capture vision dims; skip re-shrink; map boxes back to crop CSS space (Chrome + Firefox)
6 Unvalidated storage values DonenormalizeImageDetail / normalizeMaxScreenshotsPerTurn / normalizeMaxImageDimension + applyImageBudgetFromStorage on load/onChanged; settings UI clamps on save
7 save:true used budgeted image for Downloads Done — viewport screenshot keeps saveDataUrl (full CSS); Downloads use that; model still gets budgeted/redacted copy (same idea as full_page_screenshot)

Nits

# Finding Status
8 Settings const indentation Done
9 1568px option missing selected Done (Chrome; Firefox already had it)
10 English pasted into non-en locales Done — real translations for st.imageBudget.* in all non-en locales (Chrome + Firefox)
11 Non-coord compress without budget Done

Tests

npm test: 767 passed, 0 failed.

Notable commits (this review follow-up)

  • Firefox port + issue 5 + tests
  • Issue 2 (coord side-only) + issue 3 (skip signal)
  • Nits 8/9/11
  • Issues 6/7 (storage validation + full-res save)
  • Issue 10 (real i18n for image budget)

Manual smoke ideas

  1. Chrome + Firefox: Settings → Image budget defaults load and persist after reload
  2. Set max screenshots = 1 → confirm second auto-shot warns and adds the trusted note
  3. Coord-aligned / CSS-pixel path at 1440×900 → stays 1:1 at default 1568 cap
  4. /screenshot with save:true on a large viewport → Downloads file is full CSS; model gets budgeted size
  5. Corrupt storage keys (optional) → agent falls back to safe values

@esokullu

Copy link
Copy Markdown
Collaborator

Pre-merge notes: vision risk / defaults vs main

Reference notes before deciding to merge. Defaults were designed to stay close to pre-#311 behavior; residual risks are narrower than “vision is off,” but worth knowing.

What was already true on main (before this PR)

Path Behavior on main
Normal auto / non-coord capture Already fit to static IMAGE_BUDGET (~1568px side + ~1568 vision tokens + JPEG byte ceiling)
Coord-aligned capture Full CSS size — byte-ceiling compress only, no dimension/token resize
User image attachments Sent as-is (no budget shrink)
Auto-shots per turn Unlimited
OpenAI-style detail Not sent

Everyday vision was already “budget so providers don’t choke,” not “always native resolution.”

Defaults on this PR

  • Image detail = auto → still no detail field (same as main)
  • Max screenshots per turn = unlimited (0) → same as main
  • Max image dimension = 1568 → same numeric side cap as old IMAGE_BUDGET.maxTargetPx

At default, _budgetForCapture() returns the legacy budget byte-for-byte when the cap is 1568.

Low risk at defaults (most agent vision)

  • Normal auto-screenshots / non-coord /screenshot: same budget math as main at 1568.
  • Unlimited auto shots: agent will not go blind from a counter.
  • detail: auto: no change to provider payloads for detail.

Residual default risks (honest)

  1. Coord-aligned / 1:1 pixel-click path

    • Main: never resized for dimension.
    • This PR: resizes only if a side exceeds maxImageDimension (1568). Token budget does not force shrink (review issue 2 fix).
    • 1440×900, 1366×768, etc.: stay 1:1.
    • 1920×1080 and wider: can still downscale (1920 > 1568) → possible coord click misses on large monitors even at defaults.
    • Mitigations: raise max dimension to 1920/2048, or prefer selectors / AX over pure image-pixel clicks.
  2. User-attached images
    Now resized for the model under the budget; original kept for UI/history. Slight detail loss possible on huge attachments; unlikely to break operation.

  3. Visible-media localization
    Model-facing crop is budgeted; raw crop for local download stays full. Double-shrink removed (quality improvement vs early PR).

  4. Firefox auto path
    Side-only budget on CSS scale:1 path — mid-size viewports may keep more pixels than a full token-budget shrink (usually better for vision).

When settings are changed (by design)

Change Effect Risk
Max screenshots = 1–5 Stops auto-shots after N; warning + trusted note + trace Real semi-blind mid-turn after limit
Max dimension → 512/768 Much smaller vision images Quality risk on dense UI / small text
Max dimension → 2048 Bigger images More fidelity + cost; possible provider size/latency pressure
Detail = high / low OpenAI-style endpoints may honor; others ignore Cost/quality tradeoff where supported

Verdict

Scenario Assessment
Ship with defaults, normal Act/Ask + auto-screenshots Unlikely to break core vision loop vs main’s existing budget
Users set low max shots / low dimension Can degrade vision usefulness — intentional tradeoff
Heavy coord-aligned pixel clicks at 1080p+ Possible regression vs main at default 1568 side cap

Bottom line: defaults ≈ previous sensible budgeting for the common path. Main surprise surface is coord-aligned full-CSS on wide screens, not “vision turned off.” Sharp settings (max shots, low dimension) can hurt vision deliberately.

Suggested manual smoke before merge

  1. Dense UI page at defaults — model still “sees” labels after auto-shot.
  2. 1920×1080 window — if using coord clicks from screenshots, check landing accuracy.
  3. Attach a large PNG once — model still uses it.
  4. Max shots = 1, multi-step act — skip warning + trusted note appear; agent doesn’t thrash silently.

Related review follow-ups (already landed on this branch)

Issues 1–11 from the earlier review were addressed in subsequent commits (Firefox parity, coord side-only budget, skip signals, tests, storage validation, full-res save, i18n, nits). See earlier review comments on this PR for the checklist.

@Ayush7614

Ayush7614 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@esokullu Confirmed — all Copilot review items are addressed in the follow-up commits (shared auto-screenshot counter, localization/coord-aligned/attachment budget paths, cold-start hydration, Firefox parity, tests, storage validation, and related fixes). Thanks for the thorough review and follow-up work.

@esokullu

Copy link
Copy Markdown
Collaborator

thanks @Ayush7614 -- this is a super sensitive part of the code, it's the eyes of the agent. that's why i'm taking time to fully understand it and making sure it won't break things before deciding on a merger or modifications.

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.

3 participants