Skip to content

fix(tab): activate requested tab reliably#72

Open
ox01024 wants to merge 4 commits intoepiral:mainfrom
ox01024:fix/tab-activate-target
Open

fix(tab): activate requested tab reliably#72
ox01024 wants to merge 4 commits intoepiral:mainfrom
ox01024:fix/tab-activate-target

Conversation

@ox01024
Copy link
Copy Markdown
Contributor

@ox01024 ox01024 commented Mar 19, 2026

Summary

  • merge the branch onto current main
  • call Target.activateTarget in the daemon tab_select path before committing currentTargetId
  • add a daemon unit test that locks the tab_select activation behavior

Validation

  • corepack pnpm --filter @bb-browser/daemon test
  • manual verification on 2026-04-02 against a real Chrome instance with two tabs and daemon CDP direct mode:
    • released bb-browser 0.11.0 still reproduced the bug: tab_select returned success, but Chrome stayed on the old visible tab
    • this branch switched the visible Chrome tab correctly, and follow-up get title / tab_list matched the visible browser state

Closes #71

@yan5xu
Copy link
Copy Markdown
Collaborator

yan5xu commented Mar 19, 2026

LGTM — fixes both CDP path (missing Target.activateTarget) and extension path (missing windows.update for cross-window focus). The tabId/targetId protocol separation is a clean improvement.

Merging.

@yan5xu
Copy link
Copy Markdown
Collaborator

yan5xu commented Mar 19, 2026

Heads up: this PR now has merge conflicts (likely from #80 or #69 that just merged). Please rebase on main to resolve, then I'll merge. The code itself is approved.

@ox01024 ox01024 force-pushed the fix/tab-activate-target branch from 6602066 to c6d0757 Compare March 19, 2026 14:02
@ox01024
Copy link
Copy Markdown
Contributor Author

ox01024 commented Mar 19, 2026

@yan5xu Rebased onto current main and force-pushed in c6d0757.

The only manual conflict was in packages/cli/src/cdp-client.ts; I resolved it by keeping both parts that matter:

  • Target.activateTarget so the requested target is actually focused in direct CDP mode
  • setCurrentTargetId(...) so the selected target is still persisted for follow-up commands

Local verification:

  • pnpm test
  • pnpm build

This should clear the merge-conflict blocker now.

@yan5xu
Copy link
Copy Markdown
Collaborator

yan5xu commented Mar 22, 2026

This PR has merge conflicts with the latest main. Could you rebase on top of the current main?

git fetch upstream
git rebase upstream/main
git push --force-with-lease

The conflicts are likely from recent merges (#82, #89, #91) which touched protocol.ts and other shared files.

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.

tab <n> reports success but does not activate the visible tab

2 participants