From 49252a0b8ea1c15b31ad8d9c052b6c0394400a95 Mon Sep 17 00:00:00 2001 From: Sean McGuire Date: Wed, 3 Dec 2025 17:03:11 -0800 Subject: [PATCH 1/2] dont attach to targets if already attached --- packages/core/lib/v3/understudy/context.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/lib/v3/understudy/context.ts b/packages/core/lib/v3/understudy/context.ts index d5d8ae171..1d309efbb 100644 --- a/packages/core/lib/v3/understudy/context.ts +++ b/packages/core/lib/v3/understudy/context.ts @@ -415,6 +415,7 @@ export class V3Context { const targets = await this.conn.getTargets(); for (const t of targets) { + if (t.attached) continue; // auto-attach already handled this target try { await this.conn.attachToTarget(t.targetId); } catch { From 688f44f3330b04bf914ac910636903e03ed4cee7 Mon Sep 17 00:00:00 2001 From: Sean McGuire Date: Wed, 3 Dec 2025 17:36:14 -0800 Subject: [PATCH 2/2] changeset --- .changeset/fruity-clowns-pick.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fruity-clowns-pick.md diff --git a/.changeset/fruity-clowns-pick.md b/.changeset/fruity-clowns-pick.md new file mode 100644 index 000000000..47dc40621 --- /dev/null +++ b/.changeset/fruity-clowns-pick.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +fix: don't attach to targets twice