Repository navigation
feat(ui): sync gateway browser viewport to the dock panel size - #123104
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 13, 2026, 6:16 AM ET / 10:16 UTC. ClawSweeper reviewWhat this changesThis PR makes the Control UI resize the Gateway-controlled browser viewport to match its dock panel. Merge readinessKeep open: the feature is still absent from current main, but two P2 lifecycle bugs can either resize a hidden remote browser or skip a needed re-sync after returning to a tab. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI browser dock displays screenshots from a browser hosted by the Gateway. Dock dimensions travel through the Gateway browser action route to resize the remote page, then a fresh screenshot returns to the panel. flowchart LR
A[Browser dock] --> B[Panel size observer]
B --> C[Viewport sync controller]
C --> D[Gateway browser request]
D --> E[Browser action validation]
E --> F[Remote page viewport]
F --> G[Screenshot capture]
G --> A
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +237, Tests +182, Docs 0. Total +419 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Fence delayed resize work by panel liveness and reset the request guard at tab or document transitions, with focused regressions for both sequences. Do we have a high-confidence way to reproduce the issue? Yes, from source: close the dock after a resize callback schedules but before its 300 ms delay, or return to a previously requested tab after its remote viewport changes. Is this the best way to solve the issue? No: observing the panel is the right owner boundary, but the delayed action lacks a liveness fence and its guard survives the transitions it must re-evaluate. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2278ca6952ea. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
ClawSweeper review findings: a debounced resize could fire after the dock closed (silently resizing the agent-controlled browser), and the per-target resize guard survived tab/document changes, suppressing a needed re-sync when revisiting a tab an agent had resized. Gate syncViewport on the panel being open and clear the guard in invalidateViewOperations; both paths now have regression tests that fail pre-fix.
|
Both ClawSweeper P2 findings are fixed at head
Both tests fail on the pre-fix code (2 failed → now 6/6 passing). Full browser-panel suite: 82/82. Exact-head CI is green and a fresh Codex autoreview of the branch reports no actionable findings. |
|
Merged via squash.
|
…law#123104) * feat(ui): sync browser viewport to panel * docs(web): note browser panel follows dock size * refactor(ui): split browser panel input handling out of the controller * refactor(ui): keep browser panel input host interface module-local * fix(ui): fence browser viewport sync on dock close and document change ClawSweeper review findings: a debounced resize could fire after the dock closed (silently resizing the agent-controlled browser), and the per-target resize guard survived tab/document changes, suppressing a needed re-sync when revisiting a tab an agent had resized. Gate syncViewport on the panel being open and clear the guard in invalidateViewOperations; both paths now have regression tests that fail pre-fix.
What Problem This Solves
The Control UI's dockable browser panel renders the gateway browser as screenshots taken at whatever viewport the agent last used. The panel never told the remote browser how big the dock actually is, so the snapshot rendered at a mismatched size — scaled-down desktop pages in a narrow right dock, dead space, or overflow scrolling — and resizing the dock only rescaled the stale image.
Why This Change Was Made
The gateway browser plugin already supports viewport resizing end-to-end (
POST /act{kind:"resize"}→ PlaywrightsetViewportSize, capped at 8192px); the Control UI just never called it. This change closes that gap at the panel boundary:browser-client.tsgains a thinresizeBrowserViewportwrapper over the existing/actresize route.BrowserPanelControllersyncs the remote viewport to the panel's observed content box: debounced ~300 ms behind aResizeObserveron.bp-viewport, clamped to [100, 8192], skipped when metrics already match within 1px, with a per-target last-requested guard so a page that cannot honor an exact size is never re-asked until the panel size or tab changes (no request loops).browser-panel.tsowns the transient observer lifecycle (the.bp-viewportelement only exists while the dock is open/available).User Impact
The remote page now follows the dock: opening the panel, dragging the resizer, or switching tabs resizes the remote browser viewport to the panel's available space, so the snapshot fills the dock edge-to-edge at 1:1 CSS scale instead of rendering at an arbitrary stale size. Docs updated (
docs/web/control-ui.md).Evidence
node scripts/run-vitest.mjs ui/src/components/browser→ 9 files, 80 tests passed (4 new viewport-sync scenarios: debounce+clamp+refresh, loop guard/no-op on match, mismatched-metrics sync without looping on an inexact remote, tab-switch sync).gpt-5.6-sol, high): clean, no accepted/actionable findings.--allow-unconfigured, ownOPENCLAW_STATE_DIR, port 19231, real managed Chrome) driven by Playwright against the builtdist/control-ui:After, initial open at 560×822 (page reflowed to the dock's width):
Resize demo video (open panel → navigate → drag dock wider → remote viewport re-syncs and recaptures):
after-resize-demo.mp4
Production LOC: +110 (new capability at the panel boundary: client wrapper 16, controller sync 58, pending-input timer 15, observer lifecycle 21); tests +194.