Skip to content

Fix #221: wait for viewport reset layout propagation - #223

Merged
SSFSKIM merged 2 commits into
mainfrom
fix/221-viewport-reset-lag
Oct 26, 2026
Merged

SSFSKIM merged 2 commits into
mainfrom
fix/221-viewport-reset-lag

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #221.

Before clearing an attached tab's viewport override, observe its actual CSS layout with Page.getLayoutMetrics; after the clear, poll every 10 ms until either dimension differs. This avoids guessing how page zoom or scrollbar gutters change the requested override size. The pre-clear observation and post-clear polling share a 1,000 ms budget, including unanswered reads; the clear itself retains its existing await/error semantics.

The host cannot know the natural view bounds. Equal natural/overridden layouts therefore return successfully at the bound, with a diagnostic naming the last observation rather than a false restoration-failed alarm. An unavailable baseline never prevents the clear, unattached tabs do not poll, and debugger loss retains the existing recovery path.

Verification

  • Test-first: six initial regressions failed before implementation; the review correction also reproduced wide-scrollbar and double-gutter early returns before changing the comparison.
  • Focused viewport tests: 22 passed.
  • Complete host and host-run suites on final head: 77 passed.
  • Full suite on final head: env -u CUA_FEEDBACK_DIR npm test — 3,998 passed, 172 skipped, 0 failed (4,170 tests total). Local Node 22 and runtime-only dependencies skip own-REPL/optional-package tests; PR CI runs Node 24 with full dependencies.
  • The first full run had one unrelated failure from inherited feedback instructions in serve-lazy.test.mjs; the affected file passed 29/29 with the opt-in unset. Recorded the condition and workaround in Friction tracker (moved to ~/.claude/friction-tracker/cua/) #177.
  • The author did not run a live browser acceptance probe; regression tests exercise the host's fake extension, including a clear reply before a delayed layout update and a following screenshot request.

Independent review

doperpowers:reviewer-medium found one actionable P2 on the initial range: fixed scrollbar tolerance could misclassify the old layout as restored. A separate fix wave replaced that predicate with the observed pre-clear baseline in afb007d0. Follow-up review verified both original reproductions and returned correct — no material findings. Not merged.

Sminos-Session: cua_repl#1ea561bc (MAWS on macbook)

Poll layout metrics after clearing an attached tab override, with a one-second best-effort bound. Keep equal natural sizes ambiguous rather than reporting a failed reset, and preserve lost-debugger recovery.

Sminos-Session: cua_repl#1ea561bc (MAWS on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T12:06:32.029937Z 575b282 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Replace guessed zoom and scrollbar allowances with an actual CSS layout baseline. Share one bounded observation window across the pre-clear read and post-clear polling, and still clear when the baseline is unavailable or unanswered. Preserve debugger-loss recovery and cover wide scrollbars, two gutters, stalled reads and natural equality.

Sminos-Session: cua_repl#1ea561bc (MAWS on macbook)
@SSFSKIM
SSFSKIM merged commit e1aeda2 into main Oct 26, 2026
4 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.

Host: browser_viewport_reset returns before the page reads its restored size (Chromium 152 lag)

1 participant