Skip to content

Commit 2265123

Browse files
only21milclaude
andcommitted
test(opencode): cover scratch-session cleanup when the prompt request rejects
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1db661b commit 2265123

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎packages/provider-opencode/src/server/textGeneration.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,21 @@ it.layer(layerOpenCodeTextGenerationTest)("OpenCodeTextGeneration", (it) => {
413413
),
414414
);
415415

416+
it.effect("deletes the session when the prompt request rejects", () =>
417+
withOpenCodeTextGeneration(DEFAULT_OPENCODE_SETTINGS, (textGeneration) =>
418+
Effect.gen(function* () {
419+
runtimeMock.state.promptRequestError = new Error("prompt transport failed");
420+
421+
const error = yield* textGeneration
422+
.generateCommitMessage(DEFAULT_COMMIT_MESSAGE_INPUT)
423+
.pipe(Effect.flip);
424+
425+
expect(error.detail).toBe("OpenCode session.prompt request failed.");
426+
expect(runtimeMock.state.sessionCalls).toEqual(["delete http://127.0.0.1:4301/session"]);
427+
}),
428+
),
429+
);
430+
416431
it.effect("parses JSON returned as plain text output", () =>
417432
withOpenCodeTextGeneration(DEFAULT_OPENCODE_SETTINGS, (textGeneration) =>
418433
Effect.gen(function* () {

0 commit comments

Comments
 (0)