# \[Bug\]: Agent and browser panel show two different browser pages for the same browser tab · Issue \#16901 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/issues/16901)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: backlog

Priority: 0

## Description

[Discussion and activity](https://git.cafe/pingdotgg/t3code/issues/16901)

---

### Before submitting

- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.

### Area

apps/server

### Steps to reproduce

1. In the desktop app, start a Claude Code thread (A) on any local project.
2. Ask the agent: "Run `sleep 45`, then call `preview_open` with `{"url": "https://example.com", "open": false, "reuseExistingTab": false}`, tell me the tabId, and stop."
3. While it sleeps, switch to another thread (B) and stay there for about a minute.
4. Go back to thread A. Ask the agent to call `preview_open` with that `tabId` and `"open": true`, so the browser tab shows in the browser panel.
5. Ask the agent to make the browser page red with `preview_evaluate` (`document.body.style.background = "red"`), then read the value back.

### Expected behavior

The agent and I use the same browser page. When the agent makes it red, the browser page in my panel turns red. When I type or sign in on the browser page in my panel, the agent sees it.

### Actual behavior

The agent's browser page is red (it reads back `rgb(255, 0, 0)` and its screenshot is red), but the browser page in my panel stays white. One browser tab, two different browser pages.

The agent can't tell this happened. `preview_open` returned `visible: false` both when it broke and when it worked. The only difference was that a `viewport` of 1280×800 came back when it broke. The desktop trace shows the browser page in my panel being created about 40 seconds after the agent opened the browser tab, when I came back to thread A.

If I stay on thread A while the agent opens the browser tab (same steps, no `sleep`, no switching), it works, and we share one browser page. The browser page in my panel turns red, and text I typed into a box on that browser page was read back by the agent.

I first ran into this when an agent needed me to sign in to a website. I signed in on the browser page in my panel, but the agent's browser page stayed on the login form. Opening a new browser tab didn't help.

Likely cause: when the agent opens a browser tab, `ServerBrowser.ts` waits up to 10 seconds (`DESKTOP_ATTACH_TIMEOUT`) for the desktop app to provide the browser page (a webview). If none arrives, the server makes its own hidden, headless browser page with fresh storage, because the tab has an `automationOwner`. The desktop only loads browser tabs for the selected thread, so its browser page can arrive later than that. When it does, nothing swaps the browser pages or tells the client. My panel shows the desktop's browser page while the agent keeps using the hidden one. Showing the hidden browser page in the panel as a stream, which the server already supports, would avoid the split. So would telling the client which browser page the agent is using.

Related: #16701 covers the default browser profile and handing your own browser tabs to an agent. This one is about one browser tab ending up with two browser pages.

### Impact

Major degradation or frequent failure

### Version or commit

0.0.46-nightly.20261007.2774

### Environment

macOS 15 (arm64), T3 Code Nightly desktop app, local environment, Claude Code (Full access)

### Logs or stack traces

```shell
# Split run (UTC)
17:39:08  agent opens the browser tab (preview_open, open:false) while I'm on thread B
          -> viewport 1280x800, visible:false
17:40:02  desktop trace: the browser page in my panel is created
          (PreviewManager.createTab + registerWebview) as I return to thread A
17:41:19  agent makes its browser page red, reads back rgb(255, 0, 0);
          the browser page in my panel stays white
# Control run (I stay on thread A)
17:43     agent opens a new browser tab -> no viewport field, visible:false
17:43:49  agent makes the browser page red -> the browser page in my panel turns red
17:46:12  agent reads back "asdasd", which I typed on the browser page in my panel
```

### Screenshots, recordings, or supporting files

[1-split-run-two-pages.png](https://github.com/user-attachments/assets/442998a1-9f4a-474f-8ed2-973d0eff83f1)
[2-control-run-shared-page.png](https://github.com/user-attachments/assets/c2ac32a7-d07c-4a35-9011-c4e128cb790f)

### Workaround

Stay on the thread while the agent opens a new browser tab. A browser tab that has already split stays split. Have the agent open a new browser tab while you're on the thread.
