GeezerVison is showing github.com — fix(gui-extensions): wait for painted frame before screenshot capture by thevladimirzh · Pull Request #52704 · anomalyco/opencode
Conversation
Issue for this PR
Fixes #52407
Type of change
What does this PR do?
case "screenshot" calls Page.getLayoutMetrics and immediately follows it with Page.captureScreenshot. After a client-side navigation the layout is already updated, but the compositor can still hold the previous frame, so the capture returns a stale image.
createBrowserPage already has a painted() helper (double requestAnimationFrame raced against a 150 ms timeout) at the bottom of this file — it is only used by the element-comment highlight path. This PR calls it before sizing the clip, so the capture waits for the next painted frame. Typical cost is one to two frames; the existing race caps the worst case at 150 ms, and this runs only after the visible-tab check above.
Honest caveat: I could not reproduce a stale frame in this environment across ~63 scenarios (isolated Electron harness, the shipped v2.0.20 app, and this branch). So this is defensive hardening that closes a timing window, not a fix for a demonstrated failure. The original report's symptom was in part page-side — see the triage comment in #52407 for details.
How did you verify your code works?
bun run typecheck in packages/gui-extensions — clean.
bun test in packages/gui-extensions — 94 pass, 1 skip, 0 fail.
- The desktop app builds and launches from this branch.
- No test coverage exists for the screenshot path today, so there was nothing to extend; happy to add one if there is a preferred harness.
Screenshots / recordings
Not a UI change: the captured image and the tool interface are unchanged, only when the capture starts.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ture
Page.getLayoutMetrics reports the updated layout immediately after a
client-side navigation, but Page.captureScreenshot can still read the
previous compositor frame. The file already has painted() (double rAF
raced against 150 ms) used by the element-comment highlight path;
calling it before sizing the clip makes the capture deterministic.
|
Hey! Your PR title gui-extensions(browser): wait for painted frame before screenshot capture doesn't follow conventional commit format.
Please update it to start with one of:
feat: or feat(scope): new feature
fix: or fix(scope): bug fix
docs: or docs(scope): documentation changes
chore: or chore(scope): maintenance tasks
refactor: or refactor(scope): code refactoring
test: or test(scope): adding or updating tests
Where scope is the package name (e.g., app, desktop, opencode).
See CONTRIBUTING.md for details.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate:
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
thevladimirzh
changed the title
gui-extensions(browser): wait for painted frame before screenshot capture
fix(gui-extensions): wait for painted frame before screenshot capture
Oct 2, 2026
|
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number> or Closes #<number> to this PR description
See CONTRIBUTING.md for details.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Automated PR Cleanup
Thank you for contributing to opencode.
Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.
This PR was closed because it matched the following cleanup criteria:
- The PR was created more than 1 month ago
- The PR had fewer than 2 positive reactions
- Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR
PRs created within the last month are not affected by this cleanup.
If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.
Thanks again for taking the time to contribute.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|