Skip to content

Studio: stop empty browser tabs piling up across chats - #17650

Merged
shimmyshimmer merged 2 commits into
mainfrom
studio-browser-empty-tabs
Nov 13, 2026
Merged

shimmyshimmer merged 2 commits into
mainfrom
studio-browser-empty-tabs

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

What changed

With the browser panel open, every chat you pass through got a new empty tab, and that tab stayed in the browser's state after you left. Clicking New chat four times left three empty tabs behind for chats that may never be shown again. They are small, but nothing removed them until a reload, and they count toward the 50 tab limit on what a reload restores, so in a long running window they could push real tabs out of the saved session.

Leaving a chat whose only tab is an untouched new tab now drops that tab. The chat still remembers that its panel was open (and full view), so coming back to it looks the same as before: it opens on a new tab. A tab that was renamed or pinned is kept.

How it was verified

  • New test in tests/browser-store-chats.test.ts; it fails without the change.
  • npm run typecheck, npm test (15882 passed, 0 failed) and npm run build in studio/frontend.
  • Driven in a local web Studio with a scripted browser: after four New chat clicks the saved tab state held no leftover empty tabs (three before the change), the first chat kept its two pages, and browser Back and Forward still showed each chat its own tabs.

Not tested here

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T07:46:46.587975Z cf91408 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25f919eb7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +569 to +570
// An untouched new tab is remade on return (`fresh` below), so it isn't kept for every chat visited.
const blank = left.length === 1 && isBlankTab(left[0]) ? left[0] : null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve closed-panel state after pruning its blank tab

If chat A has only a new tab and the user closes its browser panel, leaving A now removes that tab. The first return correctly restores open: false, but creates no replacement tab; leaving A again then reaches showChat's existing left.length === 0 branch and deletes A's saved panel state. After opening the browser in chat B, the next return to A consequently inherits B's open panel instead of keeping A's panel closed. Preserve the saved panel state for tabless chats created by this pruning so repeated chat switches do not undo the user's close action.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in cf91408: the empty tab is only dropped while the panel is open, so a chat closed on an empty tab keeps its tab and its closed state. Added a test that fails without the guard.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 25f919eb7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf914081fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// An untouched new tab is remade on return (`fresh` below), so it isn't kept for every chat visited.
// Only with the panel open: a closed panel makes no `fresh`, and the chat would lose its closed state.
const blank = state.open && left.length === 1 && isBlankTab(left[0]) ? left[0] : null;
const tabs = blank ? state.tabs.filter((tab) => tab !== blank) : state.tabs;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist panel settings for chats whose blank tab is pruned

When a saved chat A has only a blank tab, switching away now removes its last tab, but tab-session.ts's kept() serializes panel settings only for chats represented in the remaining tabs. Consequently, A's saved open, fullView, and floating settings disappear on reload. For example, leave A with its panel open in full view, switch to B and close B's panel, then reload: returning to A now leaves its panel closed instead of restoring its previous layout. Preserve tabless chats' panel metadata in session serialization so pruning the placeholder does not discard settings that previously survived reloads.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Intended. An untouched empty tab holds nothing to restore, so after a reload its chat follows the current panel state like any chat without tabs. Persisting a panel record for every chat passed through would bring back the growth this PR removes. Within a session the chat still reopens on a new tab.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: cf914081fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer
shimmyshimmer merged commit 624ddb3 into main Nov 13, 2026
@shimmyshimmer
shimmyshimmer deleted the studio-browser-empty-tabs branch November 13, 2026 07:59
shimmyshimmer added a commit that referenced this pull request Nov 14, 2026
## What changed

Comment-only follow-up to #17650: the two comment lines above the empty
tab check in `store.ts` become one, and a line of test narration is
removed. No code changes.

## How it was verified

- The diff touches comment lines only.
- `npm run typecheck` and `tests/browser-store-chats.test.ts` (7 passed)
in `studio/frontend`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant