Skip to content

Avoid activating tabs in the default CDP startup sequence #8

Open

Description

@ZJHSteven

Hi! I noticed a small concurrency problem when multiple agents use browser-harness-js against the same Chrome instance.

The startup sequence in interaction-skills/connection.md currently includes Target.activateTarget(...) after session.use(targetId). Agents tend to follow that literally, so concurrent agents repeatedly pull their own tabs to the foreground and fight over the visible active tab.

session.use() is enough to attach and route page-level CDP commands to a target; Target.activateTarget() is only needed when the tab should actually be brought to the foreground. interaction-skills/tabs.md already describes those two operations as independent.

I also tested the background case locally: Runtime/DOM inspection, navigation, screenshots, mouse clicks, and text input all worked on a background target without activating it.

Would it make sense to remove the activation step from the default startup sequence and mark the existing "Bringing Chrome to front" section as something to use when needed? The change is docs-only and very small.

Activity

  1. ZJHSteven commented on Sep 1, 2026

    @ZJHSteven
    Author

    I opened #9 with the small docs-only change described above.

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