Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(handoff-browser): offer the browser move only to child hand-off turns, not a resumed root

AdityaUmale6360b2b48a7f
diff --git a/server/index.ts b/server/index.ts
index d9ce694c38..b237c14533 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -7767,7 +7767,7 @@ async function beginTurn(
!opts?.commsDepth && !opts?.coordination && !inheritedTeamComputer(bot) && bot.computer !== "off" && agentsMounted) {
const source = store.activePath(threadId).findLast(message => message.id === userMessage?.id && message.role === "user" && !message.peerAsk);
if (source) computerSelectionTurns.set(threadId, { generation: dispatchClaimId, botId: bot.id, source, text, dataContext: opts?.dataContext });
- } else if (opts?.coordination && opts.commsDepth && !opts.computerSelectionContinuation && !opts.goalRunId && !opts.automationSource && !inheritedTeamComputer(bot) && bot.computer !== "off" && agentsMounted && browserSelectable(bot)) computerSelectionTurns.set(threadId, { generation: dispatchClaimId, botId: bot.id, text, handoff: { opts } });
+ } else if (opts?.coordination && coordinator.node(opts.coordination.id)?.parentId && opts.commsDepth && !opts.computerSelectionContinuation && !opts.goalRunId && !opts.automationSource && !inheritedTeamComputer(bot) && bot.computer !== "off" && agentsMounted && browserSelectable(bot)) computerSelectionTurns.set(threadId, { generation: dispatchClaimId, botId: bot.id, text, handoff: { opts } });
store.setTaskActivity(bot.id, threadId, "working");
// Watch from admission, not dispatch: a turn can wedge in setup long before any provider event exists.
watchdog.watch(threadId, bot.id);
diff --git a/server/surface-pins.e2e.test.ts b/server/surface-pins.e2e.test.ts
index 4463f7d3d6..f1b9e2b95c 100644
--- a/server/surface-pins.e2e.test.ts
+++ b/server/surface-pins.e2e.test.ts
@@ -502,11 +502,19 @@ describe("surface pin provenance against the real server", () => {
const workThread = (await apiOk("GET", "/api/bots?messages=0")).bots.find((bot: any) => bot.id === tester.id)
.tasks.find((task: any) => task.openedBy?.botId === asker.id).threadId as string;
rmSync(teammateDump, { force: true });
+ // Hold the asker's own turn that resumes with the result, to check it is not offered the hand-off's browser move.
+ rmSync(dumpFile, { force: true });
+ rmSync(finishFile, { force: true });
writeFileSync(teammateFinish, "finish");
const moved = await teammateTurn();
expect(JSON.stringify(moved.prompt)).toContain("Continue the handed-off request");
expect(moved.mcpConfig.mcpServers.browser).toBeDefined();
expect(savedTask(tester.id, workThread)).toMatchObject({ surface: "browser" });
+ const resumedToken = (await dump()).mcpConfig.mcpServers.agents.env.OMB_COMMS_TOKEN;
+ const resumedOffer = await (await fetch(base + "/api/internal/computer/select", {
+ headers: { authorization: `Bearer ${resumedToken}` } })).json() as any;
+ expect(resumedOffer.canSelect).not.toBe(true);
+ writeFileSync(finishFile, "finish");
// The asker hears back from the browser turn, never from the turn that only asked to move.
const replies = async () => JSON.stringify((await apiOk("GET", `/api/threads/${own.threadId}/messages?limit=60`)).messages);
// "reply to: ..." is the fixture engine's own answer from the browser turn, not the prompt that started it.