Skip to content

browse tab new doesn't add a scheme to bare hosts like browse open does #3574

Done

Description

@abhiramshaji-cyber

Hi everyone, hope you're doing well! Thanks a lot for #3512, browse open example.com and browse open localhost:3000 now just work, which is really nice for quick sessions.

Before submitting an issue, please:

Environment Information

Stagehand:

  • Language/SDK: TypeScript, browse CLI
  • Stagehand version: browse 0.12.0 (stagehand 4.4.0), local Chrome, Node 26; code checked on main at 97ff3e1

AI Provider:

  • Provider: none (no AI commands involved)
  • Model: n/a

Issue Description

browse tab new <url> sends the url to Chrome as typed, so bare hosts that browse open now accepts (example.com, localhost:8123) fail in tab new.

browse tab new [url] opens a new tab, makes it active and optionally navigates it. The browse skill offers it next to browse open <url> as an equal way to recover from "No active page" (SKILL.md L394), so agents tend to pass it the same kind of url.

What happens today:

  1. Open.run passes the url through normalizeUrlScheme (open.ts L40-L42), so localhost:8123 becomes http://localhost:8123.
  2. TabNew.run sends args.url straight to the tab.new driver command (tab/new.ts L26-L29).
  3. The tab.new handler hands it to context.newPage(url) unchanged (tabs.ts L12-L15).
  4. browse tab new example.com exits 1 with -32000 Cannot navigate to invalid URL.
  5. browse tab new localhost:8123 waits 15s and exits 1 with Navigation start timed out after 15000ms, since Chrome reads localhost: as a scheme.

Expected: when a url is given, tab new handles the scheme the same way open does, so browse tab new example.com lands on https://example.com and browse tab new localhost:8123 on http://localhost:8123.

flowchart LR
  A["browse open localhost:8123"] --> N["normalizeUrlScheme"] --> D1["open handler"] --> OK["http://localhost:8123 loads"]
  B["browse tab new localhost:8123"] --> D2["tab.new handler"] --> P["context.newPage raw url"] --> F["timeout, exit 1"]
Loading

Steps to Reproduce

  1. Serve any page on port 8123 (python3 -m http.server 8123).
  2. browse open localhost:8123 --local --headless --session sg works.
  3. browse tab new example.com --session sg and browse tab new localhost:8123 --session sg both fail.

Minimal Reproduction Code

browse open localhost:8123 --local --headless --session sg
browse tab new http://localhost:8123 --session sg   # ok
browse tab new example.com --session sg; echo "exit=$?"
browse tab new localhost:8123 --session sg; echo "exit=$?"
browse tab list --session sg

The published browse 0.12.0 already includes #3512, and tab/new.ts is the same there and on main.

Error Messages / Log trace

$ browse open localhost:8123
{"title":"Repro Page","url":"http://localhost:8123/"}
$ browse tab new http://localhost:8123
{"title":"Repro Page","url":"http://localhost:8123/"}
$ browse tab new example.com
-32000 Cannot navigate to invalid URL
exit=1
$ browse tab new localhost:8123
Navigation start timed out after 15000ms
exit=1
$ browse tab list
[0,"Repro Page","http://localhost:8123/"]
[1,"Repro Page","http://localhost:8123/"]
[2,"Stagehand","chrome-extension://amonopfneclcghjeccidjnfgaekhjeph/blank.html"]
[3,"Stagehand","localhost:8123"]

A smaller, separate thing visible above: each failed call leaves a tab behind (2 and 3). It looks like newPage creates the target first and then navigates, so any failed navigation in tab new leaves a tab, not only the scheme case.

Screenshots / Videos

normalizeUrlScheme callers

normalizeUrlScheme with its single caller Open.run and its three callees, Functions view in Architect

Related Issues

Would you prefer the fix to simply call normalizeUrlScheme in TabNew.run when a url is given (after #3562 lands), and would you also like a failed navigation to close the new tab, or keep that as a separate change? Happy to send a small PR for whichever you prefer.

Activity

  1. shrey150 commented on Nov 30, 2026

    @shrey150
    Collaborator

    Hey @abhiramshaji-cyber thanks for reporting this! looks like we have a suitable implementation from @embrace897 - I'll get this over the line and into the next release. appreciate the contribution :)

  2. added a commit that references this issue on Nov 30, 2026
    bbdaf94
  3. abhiramshaji-cyber commented on Nov 30, 2026

    @abhiramshaji-cyber
    Author

    Thanks so much @shrey150 for landing this so quickly, really appreciate it! And a big thank you to @embrace897 for the original fix and tests in #3577, it made for a really clean change. Looking forward to seeing it in the next browse release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions