Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(codex): bound pending requests after app-server stdout closes #24600

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/24600/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 61 additions and 5 deletions.

x
0 of 2 viewed, 2 left
46 additions and 0 deletionspackages/effect-codex-app-server/src/protocol.test.tsModified
View file
@@ -5,6 +5,7 @@
import * as Schema from "effect/Schema";
import * as Stdio from "effect/Stdio";
import * as Stream from "effect/Stream";
+import * as TestClock from "effect/testing/TestClock";
​
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
@@ -644,4 +645,49 @@
assert.notInclude(error.message, secret);
}),
+​
+ it.effect("fails pending requests when input ends while the process is still running", () =>
+ Effect.gen(function* () {
+ const { stdio, input, output } = yield* makeInMemoryStdio();
+ const transport = yield* CodexProtocol.makeCodexAppServerPatchedProtocol({
+ stdio,
+ terminationError: Effect.never,
+ });
+ const pending = yield* transport.request("thread/read", {}).pipe(Effect.forkScoped);
+ yield* Queue.take(output);
+​
+ yield* Queue.end(input);
+ yield* TestClock.adjust("249 millis");
+ assert.isUndefined(pending.pollUnsafe());
+ yield* TestClock.adjust("1 millis");
+​
+ const failure = yield* Fiber.join(pending).pipe(