Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): drop Codex sessions whose runtime exited #10799

Closedstephenjason89(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/10799/headopened View on GitHub

Showing 2 changed files with 108 additions and 17 deletions.

x
0 of 2 viewed, 2 left
81 additions and 1 deletionapps/server/src/provider/Layers/CodexAdapter.test.tsModified
View file
@@ -23,6 +23,7 @@
import { it, vi } from "@effect/vitest";
​
import * as Context from "effect/Context";
+import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
import * as Fiber from "effect/Fiber";
@@ -75,6 +76,7 @@
updatedAt: this.now,
} satisfies ProviderSession),
);
+ public startEffect: Effect.Effect<ProviderSession> | undefined;
​
public readonly sendTurnImpl = vi.fn(
(_input: CodexSessionRuntimeSendTurnInput): Promise<ProviderTurnStartResult> =>
@@ -127,7 +129,7 @@
​
start() {
- return Effect.promise(() => this.startImpl());
+ return this.startEffect ?? Effect.promise(() => this.startImpl());
​
getSession = Effect.promise(() => this.startImpl());
@@ -188,13 +190,24 @@
function makeScopedRuntimeFactory(options?: { readonly failConstruction?: boolean }) {