Skip to content

Close the stray about:blank tab in the browse handoff window (#4323) - #4330

Closed
Simba3696 wants to merge 2 commits into
garrytan:mainfrom
Simba3696:fix/handoff-blank-tab
Closed

Simba3696 wants to merge 2 commits into
garrytan:mainfrom
Simba3696:fix/handoff-blank-tab

Conversation

@Simba3696

@Simba3696 Simba3696 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Why (in your own words)

Every browse handoff window opens with two tabs: the page I'm meant to sign in to, and an empty about:blank tab next to it. On Windows I hand the window over several times a day to sign in to local apps, and the extra tab gets in the way every time (and it's easy to click into by mistake). It comes from launchPersistentContext(), which opens a first tab of its own. restoreState() then opens a new page for each saved tab and never closes that first one. This change closes it at the end of restoreState(), but only a context page that browse doesn't track and that is still on about:blank. Tracked tabs, and any untracked page that has navigated somewhere, are left alone.

Fixes #4323

Live evidence

Real use, Windows 11, browse daemon rebuilt from this branch, then browse stop and (the internal app's name, title and port redacted as <…>):

$ browse goto http://localhost:<port>/
Navigated to http://localhost:<port>/ (200)
$ browse handoff "<sign-in message>"
HANDOFF: Browser opened at http://localhost:<sign-in port>/login?next=<…>
$ browse tabs
→ [2] <app title> — http://localhost:<port>/

Before the fix the headed window showed that tab plus an about:blank tab that browse tabs doesn't list (it isn't tracked, which is also why no browse command can close it). After it, the window shows the one tab.

The new test, with and without the fix, on current main:

$ bun test browse/test/handoff.test.ts -t "closes the blank tab"
 1 pass
 0 fail

$ git stash push -- browse/src/browser-manager.ts   # fix removed
$ bun test browse/test/handoff.test.ts -t "closes the blank tab"
(fail) restoreState > closes the blank tab a fresh persistent context opens on its own [243.92ms]
 0 pass
 1 fail

Whole file and the type gates on this branch:

$ bun test browse/test/handoff.test.ts
 16 pass
 9 skip
 0 fail
Ran 25 tests across 1 file.
$ bun run typecheck        # exit 0
$ bun run typecheck:test
test typecheck ratchet: 812 known diagnostics, none new.

Scope

  • Changed: BrowserManager.restoreState() closes untracked about:blank pages after restoring the saved tabs (browse/src/browser-manager.ts). Adds one test case to browse/test/handoff.test.ts that mirrors handoff(): fresh tab maps plus a blank tab the context opened, then restoreState().
  • Verified live by: handing off on Windows 11 to a local app several times and looking at the headed window's tab strip.
  • Did NOT test: macOS or Linux headed windows (the 9 Xvfb-dependent handoff tests skip on Windows). I also didn't test the recreateContext() paths beyond the existing round-trip test (a newContext() has no first tab, so the cleanup finds nothing there), or the extension and connect headed modes.

Liveness proof (required for external contributors)

Authenticated GitHub login checked with gh api user --jq .login: Simba3696.

Screenshot 2026-11-13 071910

Checklist

  • Liveness screenshot attached (GSTACK PR typed live into a real surface) or PR author is @garrytan (owner exemption)
  • This is not a generated-file-only diff (I edited the source/template and regenerated)
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references
  • New public command / external service / host adapter has an accepted issue linked (or N/A)
  • Linked issue or reproduction: browse: handoff window opens with a stray about:blank tab that browse can't close #4323

…arrytan#4323)

launchPersistentContext() opens a first tab of its own, and restoreState() never closed it, so every handoff window showed an untracked about:blank tab next to the restored ones. Close untracked context pages still on about:blank once the saved tabs are restored.
@trunk-io

trunk-io Bot commented Nov 13, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@Simba3696
Simba3696 marked this pull request as ready for review November 13, 2026 01:52
@Simba3696 Simba3696 changed the title fix(browse): close the stray about:blank tab in the handoff window Close the stray about:blank tab in the browse handoff window (#4323) Nov 13, 2026
@capy-ai

capy-ai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Thank you, @Simba3696. On main at 1d3c63c, handoff() opens a new persistent context, and restoreState() then opens a fresh page for each saved tab, so the context's own first page is left behind as an empty tab. Your fix and test cover exactly that. We're picking this up: a maintainer will land it on current main, crediting you.

@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you for this. We're picking up the idea. A maintainer agent working through a batch of fixes (our tracking thread GSTA-801) will first reproduce the problem on current main. If it reproduces, the agent rebuilds the fix on main with you credited as co-author, because we don't merge outside branches directly, and we'll close this PR with a link when it lands. If it no longer reproduces, we'll close this and say what changed.

@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you for the root cause and the live evidence from Windows. Your fix was rebuilt on current main and landed in #4684, with you credited as co-author: the handoff window now closes the untracked about:blank tab and leaves tracked tabs and anything that has navigated alone. Closing this in favour of that PR.

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.

browse: handoff window opens with a stray about:blank tab that browse can't close

1 participant