Repository navigation
do not focus browser windows - #89
Merged
Merged
Conversation
Chromium activates itself when a page opens a tab or popup, or when a script connected straight to its DevTools port opens a tab in the foreground (the background launch only holds until the human first clicks into the browser). The native helper now guards every visible agent browser: whenever it gets a new page, an activation the human didn't make by clicking one of its windows is handed straight back to the app they were using.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stop agent browsers from taking the focus on macOS
The agent browser no longer jumps in front of whatever you're working in when an agent opens tabs or popups. Agents can keep opening tabs; Chrome just doesn't take the keyboard. In the end-to-end test each attempt was handed back to your app in about 4 ms, and polling every 20 ms never once caught Chrome in front.
What was causing it
target=_blank,window.open), and every time a tab is opened without the background flag.cap.mjs→newPage()) connects straight to Chrome's debugging port. Its new tab appeared at 20:57:36.834, and the agent browser took the focus 8 ms later.window.focus()did not steal focus in my tests.What changed
packages/core/native/macos/GodmodeComputer.swift, newguardFocuscommand; helper version 3). The helper watches which app is active. While an agent browser is armed, it hands any activation of that browser straight back to the app you were using.packages/core/src/browser/focusGuard.ts, started fromensureDefaultProfile):packages/core/test/browser-focus-guard.test.tsruns against a stand-in helper.Checks
origin/main: maintenance "updates wait while agents are working", updates "auto-updater turned off", and two infolders.test.ts.origin/main(merged cleanly); commits are authored by Daniel Ehrhardt only.Limitations
What you need to do
Task #13 · done by Godmode with Godmode Bot