Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(codex): end the session when an incoming message is too long #19733

Mergedonly21mil(GitHub profile, opens in a new tab)merged 9 commits intomain fromrefs/pull/19733/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 100 additions and 16 deletions.

x
0 of 2 viewed, 2 left
74 additions and 0 deletionspackages/effect-codex-app-server/src/protocol.test.tsModified
View file
@@ -371,6 +371,80 @@
}),
​
+ it.effect.each(["newline-terminated", "unfinished"])(
+ "rejects an oversized %s message using UTF-8 bytes before logging or parsing",
+ (framing) =>
+ Effect.gen(function* () {
+ const { stdio, input, output } = yield* makeInMemoryStdio();
+ const notifications: Array<CodexProtocol.CodexAppServerIncomingNotification> = [];
+ const logged: Array<unknown> = [];
+ const termination = yield* Deferred.make<CodexError.CodexAppServerError>();
+ let reachedEnd = false;
+ const transport = yield* CodexProtocol.makeCodexAppServerPatchedProtocol({
+ stdio: Stdio.make({
+ ...stdio,
+ stdin: stdio.stdin.pipe(
+ Stream.concat(
+ Stream.suspend(() => {
+ reachedEnd = true;
+ return Stream.empty;
+ }),
+ ),
+ ),
+ }),
+ maxIncomingMessageBytes: 16,
+ logIncoming: true,
+ logger: (event) =>
+ Effect.sync(() => {
+ logged.push(event.payload);