[Bug]: Browser automation steals composer focus across threads #5792
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/desktop
Steps to reproduce#
Same-thread case:
- Open a thread in T3 Code Desktop.
- Open its browser preview.
- While the agent is using the preview, focus the composer and begin typing.
- Have the agent call preview_press, such as pressing Tab.
- Observe the composer focus.
Cross-thread case:
- Let the agent continue browser automation in thread A.
- Switch to thread B.
- Focus thread B’s composer and begin typing.
- When thread A calls preview_press, observe thread B’s composer focus.
Expected behavior#
Browser automation should not interrupt typing in the composer. This should remain true whether the automation belongs to the visible thread or a background thread.
Actual behavior#
When the agent calls preview_press, the composer loses focus and typing stops until it is focused again. Automation from a background thread can steal focus from the composer in the currently visible thread.
The desktop press implementation focuses the preview guest WebContents and later restores the outer renderer, but it does not restore the renderer’s active DOM element. Preview automation is hosted per environment rather than per visible thread, which explains the cross-thread behavior.
Related but not duplicate to #3715: that issue concerns unreliable delivery of agent key presses to the preview. This issue concerns the resulting loss of human composer focus, including across threads.
Impact#
Major degradation or frequent failure
Version or commit#
main @ ba9c9ae81
Environment#
T3 Code Desktop OS: Arch Linux Provider: Codex
Logs or stack traces#
Screenshots, recordings, or supporting files#
No response
Workaround#
Click the composer again after browser automation takes focus. Avoid preview_press while composing when possible.
AksharP5(GitHub profile, opens in a new tab) added labelsbug
AksharP5(GitHub profile, opens in a new tab) added labelsneeds-triage
Confirmed here as well, Arch Linux, happens almost constantly
Fixed by #11354 — background preview keystrokes (including Enter) are kept out of the desktop composer so automation no longer sends unfinished drafts or steals composer typing across threads.
juliusmarminge closed this
This issue is still happening on Microsoft Windows (Latest Nightly as of this writing)
I am also still seeing this issue on a Mac. Golden Gate 27.2. I have agents running browsers doing manual testing and lose text focus repeatedly.
yeah still seeing this on latest nightly, latest macos!
Sign in to join this conversation.
Still hitting this on desktop 0.0.35-nightly.20260826.1193 (Arch Linux, AppImage) while typing in the composer.
Every agent preview interaction (not just
preview_press) steals focus from the composer. Especially painful when writing a follow-up while the agent is clicking through a running browser in the same or another thread.Workaround remains: click the composer again after each automation step.
Related open PRs that look like they try to fix this but are unmerged: #4118, #5874, #5894, #5898.