Skip to content

fix(browser): honor active=false for browser_open_tab - #89

Open
zzalancelot wants to merge 1 commit into
omdsh-dev:mainfrom
zzalancelot:feat/browser-open-tab-active
Open

zzalancelot wants to merge 1 commit into
omdsh-dev:mainfrom
zzalancelot:feat/browser-open-tab-active

Conversation

@zzalancelot

@zzalancelot zzalancelot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix browser_open_tab so callers can pass active (default true); active:false opens in the background and keeps the current visible tab in front.
  • Thread active through to chrome.tabs.create and bind background opens with rebindControlled instead of always forcing the new tab forward.
  • Update approval copy and EN/ZH docs; add coverage for schema forwarding, dispatch behavior, and approval summaries.

Test plan

  • pnpm --filter @yuxianglin/dsh-bridge-browser test
  • pnpm --filter dsh-browser-extension test
  • Manually: browser_open_tab({ url, active: false }) keeps the current tab focused while the new tab becomes controlled
  • Manually: default browser_open_tab({ url }) still activates the new tab

RetriggerConfidence Score: 5/5

The implementation appears safe to merge, though the non-blocking route-level coverage gap remains.

Findings

  1. P2 Binding branch lacks coverage

Summary

  • Adds the optional active argument to the bridge tool schema and forwards it through tab creation.
  • Uses controlled affinity for background tabs while retaining active affinity for foreground tabs.
  • Updates approval summaries, documentation, and focused affinity/dispatch tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[browser_open_tab] --> B{active is false?}
  B -- No --> C[Create active tab]
  C --> D[rebindActive]
  B -- Yes --> E[Create background tab]
  E --> F[rebindControlled]
  D --> G[Later tools target new tab]
  F --> G
Loading

Reviews (4) · Last reviewed commit: "fix(browser): honor active:false for bro..."

(prompt) => authorizeToolCall(prompt, controller.signal, target.windowId, call.sessionId, unrestrictedAccess),
controller.signal,
(tab) => bindOpenedTab(tab, call.sessionId),
(tab) => bindOpenedTab(tab, call.sessionId, { active: call.args.active !== false }),

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 Binding branch lacks coverage

The new background-open binding branch is not exercised by the added tests. The test in background-tools.spec.ts replaces bindCreatedTab with a mock, so it verifies background tab creation but not that routeToolCall selects rebindControlled and makes the new tab the target of later browser tools. A route-level test should cover active:false through the real affinity binding; otherwise, a wiring regression could make later tools target the wrong tab while the current tests still pass.

Open background tabs without activating them, rebind controlled affinity,
and cover the binding path so later tools target the new tab.
@zzalancelot
zzalancelot force-pushed the feat/browser-open-tab-active branch 3 times, most recently from 61ff43a to 6d6ce25 Compare September 14, 2026 06:35
@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

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