Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): stop an oversized provider diff from exhausting the backend heap #10965

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

Showing 4 changed files with 100 additions and 1 deletion (loading 1).

x
0 of 4 viewed, 4 left
39 additions and 0 deletionsapps/server/src/provider/Layers/CodexAdapter.test.tsModified
View file
@@ -1233,6 +1233,45 @@
+ it.effect("carries a turn diff once instead of mirroring it into the raw payload", () =>
+ Effect.gen(function* () {
+ const { adapter, runtime } = yield* startLifecycleRuntime();
+ const firstEventFiber = yield* Stream.runHead(adapter.streamEvents).pipe(Effect.forkChild);
+​
+ const diff = `diff --git a/file.ts b/file.ts
++${"x".repeat(4_096)}
+`;
+ yield* runtime.emit({
+ id: asEventId("evt-turn-diff"),
+ kind: "notification",
+ provider: ProviderDriverKind.make("codex"),
+ createdAt: "2026-01-01T00:00:00.000Z",
+ method: "turn/diff/updated",
+ threadId: asThreadId("thread-1"),
+ turnId: asTurnId("turn-1"),
+ payload: { threadId: "thread-1", turnId: "turn-1", diff },
+ });
+​
+ const firstEvent = yield* Fiber.join(firstEventFiber);
+ NodeAssert.equal(firstEvent._tag, "Some");
+ if (firstEvent._tag !== "Some") {
+ return;
+ }
+ const mapped = firstEvent.value;
+ NodeAssert.equal(mapped.type, "turn.diff.updated");