Skip to content

fix(chromium-tabs): say why a tab cannot be opened in an Electron app - #659

Open
filip131311 wants to merge 2 commits into
mainfrom
filip/chromium-tabs-new-message
Open

fix(chromium-tabs): say why a tab cannot be opened in an Electron app#659
filip131311 wants to merge 2 commits into
mainfrom
filip/chromium-tabs-new-message

Conversation

@filip131311

Copy link
Copy Markdown
Collaborator

Fixes #634.

before:  [Tool:chromium-tabs] Not supported

after:   [Tool:chromium-tabs] Could not open a tab: Not supported. An Electron app has no
         browser-level target creation, so a tab cannot be made from outside it — have the app open
         one (e.g. `window.open()` through `debugger-evaluate`) and it will show up in
         `chromium-tabs list`. The list, select and close actions are unaffected.

The old text is Electron's own CDP answer to Target.createTarget, passed through untouched. The
limitation is real, but the message names neither the cause nor a way forward, and reads as though the
tool were unavailable — when only this one action is.

Two things I checked before writing the message

  • The workaround actually works. On the Electron testbed I ran window.open('about:blank') via
    debugger-evaluate and the new window appeared in chromium-tabs list as t2. I didn't want to
    ship advice I hadn't run.
  • The rest of the tool really is finelist returns correctly both before and after.

Why the cause is kept rather than matched on

Target.createTarget can fail for reasons other than Electron's missing browser shell — a dropped
connection, or a real Chrome refusing the url. The CDP client keeps only the error's message and
discards its numeric code, so branching would mean matching on the string "Not supported", which
breaks the moment Electron rephrases it.

Instead any failure is wrapped, with the original message embedded. The explanation is worded as a
property of Electron rather than a claim about this failure, so it stays accurate when the cause is
something else — and the underlying error is still right there to read.

Verification

Live against the Electron testbed (Electron 42 / Chrome 148): the message above is the real output,
and list still works alongside it. tool-server 3087 passed, plus a new test asserting the message
keeps the original cause and carries the reason, the workaround, and the note that the other actions
are unaffected.

🤖 Generated with Claude Code

`chromium-tabs action=new` failed with a bare "Not supported" — Electron's own
answer to `Target.createTarget`, passed through untouched. It names neither the
cause nor a way forward, and reads as though the tool were unavailable, when in
fact only this one action is: list, select and close all work, and the app can
open a window itself, which then shows up in the list.

The failure is now wrapped with that explanation. The underlying error is kept in
the message rather than matched on, so a different cause — a dropped connection,
a real Chrome refusing the url — stays legible instead of being relabelled as an
Electron limitation.

Fixes #634
The new case constructed it positionally, which vitest ran happily but the
test typecheck rejected.
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.

chromium-tabs action=new fails with a bare "Not supported" that names neither the cause nor the workaround

1 participant