Skip to content

fix(browser): reduce occlusion scans and preview capture overhead - #3395

Merged
kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:fmy/bugfix
Oct 15, 2026
Merged

kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:fmy/bugfix

Conversation

@kev1n77

@kev1n77 kev1n77 commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Share native WebView occlusion observation across visible browser tabs and ignore unrelated DOM mutations.
  • Pause observation for hidden tabs/documents and check current and previously applied native bounds in one pass.
  • Capture decorative browser previews every 5–30 seconds, skip decoding unchanged frames, and reuse recent frames across popup/tab toggles.
  • Remove persistent stream diagnostic sampling and debug uploads; add regression coverage and update the browser guide.

Type and Areas

Type: Bug fix / performance

Areas: Web UI, desktop embedded browser, docs and tests.

Motivation / Impact

Each cached browser tab previously observed document-wide mutations independently, so unrelated UI animations repeatedly triggered full-page scans and layout reads. Visible browser previews also continuously captured and decoded screenshots even when the page was unchanged.

This reduces unnecessary host-side DOM and image-processing work while preserving popup occlusion, native view restoration, and stale-frame invalidation after navigation or resizing.

Verification

Passed after rebasing: 93 tests across 8 focused test files.

pnpm --dir src/web-ui exec vitest run \
  src/app/scenes/browser/browserPreviewCache.test.ts \
  src/app/scenes/browser/nativeWebviewOcclusionObserver.test.ts \
  src/app/scenes/browser/nativeWebviewVisibility.test.ts \
  src/app/scenes/browser/useEmbeddedBrowserWebview.test.tsx \
  src/app/scenes/browser/browserStreamPerformanceScript.test.ts \
  src/app/scenes/browser/browserPanelVisibilityContract.test.ts \
  src/app/scenes/browser/nativeWebviewOcclusionContract.test.ts \
  src/infrastructure/api/adapters/peer-device-adapter.test.ts

Passed after rebasing:

pnpm --dir src/web-ui exec tsc --noEmit
git diff --check upstream/main...HEAD

pnpm run check:web was run before rebasing and stopped at 25 existing typography violations in untouched design-lab and mobile component files. Subsequent gates did not run. Those files and the typography audit scripts are unchanged by the rebase.

Local Edge comparison with four cached browser tabs and one visible tab:

Measurement Before After
Document scans during 120 unrelated style changes 720 0
Viewport layout reads during those changes 120 0
Preview capture requests during 12 seconds idle 11 2
Repeated image decodes during that idle period 11 0

Popup occlusion and restoration also passed in the harness.

Reviewer Notes

  • Decorative preview frames may lag by up to 30 seconds while unchanged. Live browser rendering and video frame rates are unaffected.
  • Edge measurements used mocked native screenshot APIs; actual WebView CPU, GPU, and memory reductions have not been measured.
  • Peer Device command boundaries are covered with mocks. Live SSH, Peer Device, remote-control, and detached-dispatch integration were not exercised.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@kev1n77
kev1n77 merged commit f6aaefa into GCWing:main Oct 15, 2026
9 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.

1 participant