GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(browser): wait for the menu to return focus before submitting the page note by Hona · Pull Request #65333 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Nov 21, 2026

Copy link
Copy Markdown
Member

The flake

  • browser-pane.spec.ts, "keeps a page note editable beside a tiny viewport and attaches it to the session", fails at the last assertion: the note is not attached.
  • The next test, "adds the whole page to the session and keeps the draft when the button is pressed again", has the same steps and fails the same way.
  • It started with feat(desktop): signed-in browser pane with extensions, previews, prompts and agent safeguards #63002 (cd0d037d68), which moved "Add page to session" into the Browser options menu.

Cause

  • A menu returns focus to its button one task after it closes (Kobalte's setTimeout(0) in its focus scope, then DropdownMenuContent.onCloseAutoFocus).
  • The tests pick "Add page to session" a second time and then call editor.press("Enter"), which focuses the editor first. When that focus lands in the one task between the menu's removal and its focus restore, the button takes focus back and Enter opens the menu again.

Focus and key events from an instrumented run (ms since page load):

Failing run Passing run
menu item pressed 927 6083
menu removed 941 6096
focus 942 editor, then 942 Browser options 6098 Browser options, then 6100 editor
Enter 944 on Browser options, menu opens 6101 on the editor, note attached
  • This is a test race, not a product bug. A person cannot focus the editor inside that task.
  • The first "Add page to session" is not affected: in 120 of 120 instrumented runs (60 of them with 4× CPU throttling) the editor took focus before the menu was removed, and kept it.

Fix

await addPage(page, root)
await expect(root.getByRole("button", { name: "Browser options", exact: true })).toBeFocused()
await expect(editor).toHaveValue("Check the header layout")
await editor.press("Enter")
  • Both tests wait for the menu's button to have focus, which is the app's own signal that the menu finished closing.
  • No timeout, retry or product change.

Counts (Windows, 2 workers, retries off)

Run dev With the fix
"keeps a page note editable…" alone 9 of 60 failed 0 of 120
"adds the whole page…" alone 8 of 60 failed 0 of 120
Both, whole file 0 of 10 each 0 of 20 each
  • The whole-file runs on dev did not reproduce the failure in 10 runs, so the before and after evidence is the runs of each test alone.
  • browser-pane* and plugin-host specs, cold story server: 148 passed, no dependency re-optimization.

Not in this change

  • The whole-file runs showed another flaky test in the same file, with and without this change: "restores the full pane when the toolbar closes and keeps the selected device on reopen" failed 2 of 10 on dev and 3 of 20 with the fix, at await expect(moreDevices).toBeFocused() after End. It is not investigated here.

Feature flag: none needed. Test only.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Hona added 2 commits November 21, 2026 13:37
@Hona
test(browser): wait for the menu to return focus before submitting th…
bc8b7c7
…e page note
@Hona
Merge remote-tracking branch 'origin/dev' into note-editable-flake
b438ab4
opencodejr[bot]
opencodejr Bot reviewed Nov 21, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I reproduced the flake on the base and it's gone with this change. On Linux headless Chromium with retries off, the two tests failed 5 of 80 runs on dev, at the final "note attached" assertion. With this change they passed 160 of 160 runs.

Waiting for focus to return to "Browser options" is the right signal that the menu has finished closing. The change adds no sleeps, retries or product code.

The public API is unchanged, since only a test file changes. I have no concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Hona
Hona merged commit 68c0215 into dev Nov 21, 2026
26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Hona
Hona deleted the note-editable-flake branch November 21, 2026 04:13
@kobzevvv kobzevvv mentioned this pull request Nov 24, 2026
chore(upstream): порт v2.4.1 — 67 в порт, 38 на решение gpt-mem/opencode-mem#223
Open
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Hona
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.