Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(claude): isolate subagent tool streams #10575

Closedyashranaway(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/10575/headopened View on GitHub

Showing 2 changed files with 175 additions and 10 deletions.

x
0 of 2 viewed, 2 left
164 additions and 0 deletionsapps/server/src/provider/Layers/ClaudeAdapter.test.tsModified
View file
@@ -1691,6 +1691,170 @@
+ for (const ending of ["results", "turn-completed", "stream-failed"] as const) {
+ it.effect(`isolates parent and sibling tool streams through ${ending}`, () => {
+ const harness = makeHarness();
+ return Effect.gen(function* () {
+ const adapter = yield* ClaudeAdapter;
+ const eventsFiber = yield* adapter.streamEvents.pipe(
+ Stream.takeUntil((event) => event.type === "turn.completed"),
+ Stream.runCollect,
+ Effect.forkChild,
+ );
+ yield* adapter.startSession({
+ threadId: THREAD_ID,
+ provider: ProviderDriverKind.make("claudeAgent"),
+ runtimeMode: "full-access",
+ });
+ yield* adapter.sendTurn({ threadId: THREAD_ID, input: "Delegate work", attachments: [] });
+ const stream = (owner: string | null, event: unknown) =>
+ harness.query.emit({
+ type: "stream_event",
+ session_id: "sdk-isolated",
+ uuid: "stream-isolated",
+ parent_tool_use_id: owner,
+ event,
+ } as unknown as SDKMessage);
+ const owners = [null, "task-a", "task-b"] as const;
+ for (const owner of ["task-a", "task-b"]) {