Repository navigation
fix(codex): a crashed app-server reports its exit code and stderr again #30995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1fa2ac5
ecbfc0a
b035599
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -888,4 +888,42 @@ it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => { | |
| assert.strictEqual(yield* Deferred.await(termination), exitError); | ||
| }), | ||
| ); | ||
|
|
||
| it.effect("reports a process exit that follows a failed write", () => | ||
| Effect.gen(function* () { | ||
| const { stdio: baseStdio } = yield* makeInMemoryStdio(); | ||
| const writeFailure = PlatformError.systemError({ | ||
| _tag: "Unknown", | ||
| module: "Stdio", | ||
| method: "stdout", | ||
| cause: new Error("EPIPE"), | ||
| }); | ||
| const exitError = new CodexError.CodexAppServerProcessExitedError({ code: 1, pid: 123 }); | ||
| const exited = yield* Deferred.make<CodexError.CodexAppServerError>(); | ||
| const termination = yield* Deferred.make<CodexError.CodexAppServerError>(); | ||
| const transport = yield* CodexProtocol.makeCodexAppServerPatchedProtocol({ | ||
| stdio: Stdio.make({ | ||
| args: baseStdio.args, | ||
| stdin: baseStdio.stdin, | ||
| stdout: () => Sink.forEach(() => Effect.fail(writeFailure)), | ||
| stderr: baseStdio.stderr, | ||
| }), | ||
| terminationError: Deferred.await(exited), | ||
| onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid), | ||
| }); | ||
|
|
||
| const pending = yield* transport.request("thread/read", {}).pipe(Effect.forkScoped); | ||
| yield* TestClock.adjust("100 millis"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait for the failed-write path before signaling exit.
|
||
| yield* Deferred.succeed(exited, exitError); | ||
|
|
||
| assert.strictEqual(yield* Deferred.await(termination), exitError); | ||
| const requestFailure = yield* Fiber.join(pending).pipe( | ||
| Effect.match({ | ||
| onFailure: (error) => error, | ||
| onSuccess: () => assert.fail("Expected the pending request to fail"), | ||
| }), | ||
| ); | ||
| assert.strictEqual(requestFailure, exitError); | ||
| }), | ||
| ); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing
fails pending requests when a write fails while input stays opencase already constructs this failing-stdout fixture and checks both pending and subsequent requests. Adding a separateitduplicates that regression setup rather than extending it, contrary toAGENTS.md's “Extend before you add” rule. Parameterize the existing case for an absent versus delayedterminationError, retaining its rejection assertions for both outcomes, so the failed-write fixture and termination checks do not diverge.AGENTS.md reference: AGENTS.md:L106-L106
Useful? React with 👍 / 👎.