[BUG] Browser pane destroys unrelated external tabs when the preview session resets
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The Browser pane hosts tabs for arbitrary external origins, not just the dev server — the tool description explicitly endorses using it for "external sites, staging, docs". But tab lifetime is coupled to the local dev server's session. When that session resets, every tab is destroyed, including tabs on origins that have nothing to do with the dev server.
In my session this silently closed a Resend dashboard mid domain-verification flow and a Hostinger DNS panel — two third-party accounts unrelated to the local server — because the local Next.js dev server went down. No warning, no recovery.
The behaviour is also inconsistent, which is what makes it hard to trust. From the same nominal state (no server running), I observed both outcomes:
Case A — server stopped, tabs survived:
preview_stop("d74d0f4d-15c5-4cd2-8ade-6104f4509232") → "stopped"
preview_list() → [] (no servers)
tabs_context() → tab-1 hpanel.hostinger.com
tab-2 resend.com
Case B — later, same nominal state, everything gone:
preview_list() → [] Session preview: { tabs: [] }
tabs_context() → ERROR "No preview is open."
Nothing in the tool surface distinguishes A from B. I had used case A as evidence to tell the user their tabs were safe; then case B happened.
What Should Happen?
Any one of these would fix it:
Decouple tab lifetime from server lifetime — tabs on origins other than the dev server's should survive a server restart or crash unconditionally.
Warn before destroying them — if a reset will close tabs on external origins, say which.
At minimum, be deterministic — case A and case B should not both be reachable from the same state.
Error Messages/Logs
=== CASE A — server stopped, external tabs SURVIVED ===
preview_stop("d74d0f4d-15c5-4cd2-8ade-6104f4509232")
→ "Server d74d0f4d-15c5-4cd2-8ade-6104f4509232 stopped"
preview_list()
→ []
Session preview: {
"previewId": "preview-local_119d07a2-9a06-43fa-9a80-716c2d88e1c2",
"tabs": [
{ "tabId": "tab-1", "origin": "https://hpanel.hostinger.com", "isActive": false },
{ "tabId": "tab-2", "origin": "https://resend.com", "isActive": true }
]
}
tabs_context()
→ { "tabs": [ tab-1 hpanel.hostinger.com, tab-2 resend.com ] }
=== CASE B — later, SAME previewId, all tabs DESTROYED ===
preview_list()
→ []
Session preview: {
"previewId": "preview-local_119d07a2-9a06-43fa-9a80-716c2d88e1c2",
"tabs": []
}
tabs_context()
→ ERROR: No preview is open. Use preview_start with {"url": "https://…"} to open a
browser tab at a URL, or with {"name": "…"} to start a dev server from
.claude/launch.json.
NOTE: the previewId is IDENTICAL in both cases
(preview-local_119d07a2-9a06-43fa-9a80-716c2d88e1c2).
The session did not change — the same session silently lost its tabs.
No error, no warning, no log entry at the moment the tabs were destroyed.
Steps to Reproduce
Start a dev server: preview_start({name: "my-dev"})
Open unrelated third-party sites in the pane (e.g. a dashboard you're logged into)
Let the dev server stop or crash
Observe: sometimes the external tabs survive, sometimes the whole pane is wiped
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.219
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other