Skip to content

Commit 695f58d

Browse files
committed
Revert "fix(server): preview agents on threads sharing a provider session keep their own tabs"
This reverts commit aaf0004.
1 parent 07d82da commit 695f58d

2 files changed

Lines changed: 1 addition & 44 deletions

File tree

‎apps/server/src/mcp/PreviewAutomationBroker.test.ts‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,41 +1579,3 @@ it.effect.each([
15791579
}),
15801580
),
15811581
);
1582-
1583-
it.effect("keeps each thread's current tab when threads share a provider session", () =>
1584-
Effect.scoped(
1585-
Effect.gen(function* () {
1586-
const broker = yield* makeBroker;
1587-
const routed: Array<RoutedRequest> = [];
1588-
const requests = requestsFrom(yield* broker.connect(makeHost(), { preferred: true }));
1589-
yield* Stream.runForEach(requests, (request) => {
1590-
routed.push(request);
1591-
return broker.respond({
1592-
clientId: "client-1",
1593-
connectionId: request.connectionId,
1594-
requestId: request.requestId,
1595-
ok: true,
1596-
result: { tabId: request.tabId ?? `tab-${request.threadId}` },
1597-
});
1598-
}).pipe(Effect.forkScoped);
1599-
yield* Effect.yieldNow;
1600-
// Codex runs every thread of an instance in one provider session.
1601-
const otherThread = {
1602-
...scope,
1603-
thread: { ...scope.thread, threadId: ThreadId.make("thread-2") },
1604-
};
1605-
1606-
yield* broker.invoke({ scope, operation: "open", input: {} });
1607-
yield* broker.invoke({ scope: otherThread, operation: "snapshot", input: {} });
1608-
yield* broker.invoke({ scope, operation: "snapshot", input: {} });
1609-
1610-
expect(routed.map(({ threadId, tabId }) => [threadId, tabId])).toEqual([
1611-
["thread-1", undefined],
1612-
["thread-2", undefined],
1613-
["thread-1", "tab-thread-1"],
1614-
]);
1615-
// Each thread's agent owns its own tabs and tab budget.
1616-
expect(routed[0]!.agentSessionId).not.toBe(routed[1]!.agentSessionId);
1617-
}),
1618-
),
1619-
);

‎apps/server/src/mcp/PreviewAutomationBroker.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,8 @@ const selectorDiagnosticsFromInput = (
176176
return {};
177177
};
178178

179-
/**
180-
* One agent: a provider session on one thread. Codex and OpenCode run every
181-
* thread of a provider instance in one session, so the session alone would
182-
* share one current tab, tab budget, and tab ownership across chats.
183-
*/
184179
const hostAssignmentKey = (scope: McpInvocationContext.McpThreadInvocationScope): string =>
185-
`${scope.environmentId}\u0000${scope.thread.providerSessionId}\u0000${scope.thread.threadId}`;
180+
`${scope.environmentId}\u0000${scope.thread.providerSessionId}`;
186181

187182
const isPreviewTabId = Schema.is(PreviewTabId);
188183
const decodeControlReason = Schema.decodeUnknownOption(PreviewAutomationControlReason);

0 commit comments

Comments
 (0)