Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/server/src/provider/Layers/GrokAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,30 @@ it.layer(grokAdapterTestLayer)("GrokAdapterLive", (it) => {
}),
);

it.effect("keeps the notification consumer alive after the session starter fiber exits", () =>
Effect.gen(function* () {
const threadId = ThreadId.make("grok-session-notification-scope");
const wrapperPath = yield* Effect.promise(() => makeMockGrokWrapper());
const adapter = yield* makeTestAdapter(wrapperPath);

const starter = yield* adapter
.startSession({
threadId,
provider: ProviderDriverKind.make("grok"),
cwd: process.cwd(),
runtimeMode: "full-access",
})
.pipe(Effect.forkChild);
yield* Fiber.join(starter);

yield* adapter
.sendTurn({ threadId, input: "survive the starter fiber", attachments: [] })
.pipe(Effect.timeout("5 seconds"));

yield* adapter.stopSession(threadId);
}),
);

it.effect("continues streaming events when native notification logging fails", () =>
Effect.gen(function* () {
const threadId = ThreadId.make("grok-native-log-failure");
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/Layers/GrokAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ export function makeGrokAdapter(grokSettings: GrokSettings, options?: GrokAdapte
Effect.catch((cause) =>
Effect.logError("Failed to process Grok runtime notification.", { cause }),
),
Effect.forkChild,
Effect.forkIn(sessionScope),
);

ctx.notificationFiber = nf;
Expand Down
Loading