Open History to see the last commit
1import * as Path from "effect/Path";
2import * as AcpError from "./errors.ts";
3import * as Effect from "effect/Effect";
4import * as Deferred from "effect/Deferred";
5import * as Fiber from "effect/Fiber";
6import * as Queue from "effect/Queue";
7import * as Schema from "effect/Schema";
8import * as Stream from "effect/Stream";
9import * as Ref from "effect/Ref";
10import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
11
12import { it, assert } from "@effect/vitest";
13import * as NodeServices from "@effect/platform-node/NodeServices";
14
15import * as AcpSchema from "./_generated/schema.gen.ts";
16import * as AcpProtocol from "./protocol.ts";
17import {
18 encodeJsonl,
19 jsonRpcNotification,
20 jsonRpcRequest,
21 jsonRpcResponse,
22} from "./_internal/shared.ts";
23import { makeInMemoryStdio, makeTerminationError, makeChildStdio } from "./_internal/stdio.ts";
24
25const SessionCancelNotification = jsonRpcNotification(
26 "session/cancel",
27 AcpSchema.CancelNotification,
28);
29const SessionUpdateNotification = jsonRpcNotification(
30 "session/update",
31 AcpSchema.SessionNotification,
32);
33const ElicitationCompleteNotification = jsonRpcNotification(
34 "session/elicitation/complete",
35 AcpSchema.ElicitationCompleteNotification,
36);
37const RequestPermissionRequest = jsonRpcRequest(
38 "session/request_permission",
39 AcpSchema.RequestPermissionRequest,
40);
41const RequestPermissionResponse = jsonRpcResponse(AcpSchema.RequestPermissionResponse);
42const ExtRequest = jsonRpcRequest("x/test", Schema.Struct({ hello: Schema.String }));
43const ExtResponse = jsonRpcResponse(Schema.Struct({ ok: Schema.Boolean }));
44const decodeSessionCancelNotification = Schema.decodeEffect(
45 Schema.fromJsonString(SessionCancelNotification),
46);
47const decodeExtRequest = Schema.decodeEffect(Schema.fromJsonString(ExtRequest));
48const decodeExtResponse = Schema.decodeEffect(Schema.fromJsonString(ExtResponse));
49const decodeRequestPermissionResponse = Schema.decodeEffect(
50 Schema.fromJsonString(RequestPermissionResponse),
51);
52const encodeUnknownJsonString = Schema.encodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
53const encoder = new TextEncoder();
54const mockPeerPath = Effect.map(Effect.service(Path.Path), (path) =>
55 path.join(import.meta.dirname, "../test/fixtures/acp-mock-peer.ts"),
56);
57const mockPeerArgs = (path: string) => [path];
58
59const makeHandle = (env?: Record<string, string>) =>
60 Effect.gen(function* () {
61 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
62 const path = yield* Path.Path;
63 const command = ChildProcess.make(process.execPath, mockPeerArgs(yield* mockPeerPath), {
64 cwd: path.join(import.meta.dirname, ".."),
65 ...(env ? { env: { ...process.env, ...env } } : {}),
66 });
67 return yield* spawner.spawn(command);
68 });
69
70it.layer(NodeServices.layer)("effect-acp protocol", (it) => {
71 it.effect(
72 "emits exact JSON-RPC notifications and decodes inbound session/update and elicitation completion",
73 () =>
74 Effect.gen(function* () {
75 const { stdio, input, output } = yield* makeInMemoryStdio();
76 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
77 stdio,
78 serverRequestMethods: new Set(),
79 });
80
81 const notifications =
82 yield* Deferred.make<ReadonlyArray<AcpProtocol.AcpIncomingNotification>>();
83 yield* transport.incoming.pipe(
84 Stream.take(2),
85 Stream.runCollect,
86 Effect.flatMap((notificationChunk) => Deferred.succeed(notifications, notificationChunk)),
87 Effect.forkScoped,
88 );
89
90 yield* transport.notify("session/cancel", { sessionId: "session-1" });
91 const outbound = yield* Queue.take(output);
92 assert.deepEqual(yield* decodeSessionCancelNotification(outbound), {
93 jsonrpc: "2.0",
94 method: "session/cancel",
95 params: {
96 sessionId: "session-1",
97 },
98 });
99
100 yield* Queue.offer(
101 input,
102 yield* encodeJsonl(SessionUpdateNotification, {
103 jsonrpc: "2.0",
104 method: "session/update",
105 params: {
106 sessionId: "session-1",
107 update: {
108 sessionUpdate: "plan",
109 entries: [
110 {
111 content: "Inspect repository",
112 priority: "high",
113 status: "in_progress",
114 },
115 ],
116 },
117 },
118 }),
119 );
120
121 yield* Queue.offer(
122 input,
123 yield* encodeJsonl(ElicitationCompleteNotification, {
124 jsonrpc: "2.0",
125 method: "session/elicitation/complete",
126 params: {
127 elicitationId: "elicitation-1",
128 },
129 }),
130 );
131
132 const [update, completion] = yield* Deferred.await(notifications);
133 assert.equal(update?._tag, "SessionUpdate");
134 assert.equal(completion?._tag, "ElicitationComplete");
135 }),
136 );
137
138 it.effect("keeps only recent raw notifications after their callbacks run", () =>
139 Effect.gen(function* () {
140 const { stdio, input } = yield* makeInMemoryStdio();
141 const handled = yield* Deferred.make<void>();
142 let handledCount = 0;
143 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
144 stdio,
145 serverRequestMethods: new Set(),
146 onNotification: () =>
147 Effect.sync(() => ++handledCount).pipe(
148 Effect.flatMap((count) =>
149 count === 64 ? Deferred.succeed(handled, undefined).pipe(Effect.asVoid) : Effect.void,
150 ),
151 ),
152 });
153
154 const messages = Array.from({ length: 64 }, (_, index) =>
155 encodeUnknownJsonString({
156 jsonrpc: "2.0",
157 method: "x/performance",
158 params: { index },
159 }),
160 );
161 yield* Queue.offer(input, encoder.encode(`${messages.join("\n")}\n`));
162 yield* Deferred.await(handled);
163
164 const retained = yield* transport.incoming.pipe(Stream.take(32), Stream.runCollect);
165
166 assert.equal(handledCount, 64);
167 assert.equal(retained.length, 32);
168 assert.deepEqual(retained[0]?.params, { index: 32 });
169 assert.deepEqual(retained[31]?.params, { index: 63 });
170 }),
171 );
172
173 it.effect("keeps invalid core notification values only in the schema cause", () =>
174 Effect.gen(function* () {
175 const secret = "acp-core-notification-secret-sentinel";
176 const { stdio, input } = yield* makeInMemoryStdio();
177 const termination = yield* Deferred.make<AcpError.AcpError>();
178 yield* AcpProtocol.makeAcpPatchedProtocol({
179 stdio,
180 serverRequestMethods: new Set(),
181 onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
182 });
183
184 yield* Queue.offer(
185 input,
186 encoder.encode(
187 `${encodeUnknownJsonString({
188 jsonrpc: "2.0",
189 method: "session/update",
190 params: {
191 sessionId: { secret },
192 update: {
193 sessionUpdate: "plan",
194 entries: [],
195 },
196 },
197 })}\n`,
198 ),
199 );
200
201 const error = yield* Deferred.await(termination);
202 assert.instanceOf(error, AcpError.AcpProtocolParseError);
203 const parseError = error as AcpError.AcpProtocolParseError;
204 const { cause, ...directDiagnostics } = parseError;
205 assert.equal(parseError.operation, "decode-notification-payload");
206 assert.equal(parseError.method, "session/update");
207 assert.isAbove(parseError.issueCount ?? 0, 0);
208 assert.include(parseError.issueKinds ?? [], "Pointer");
209 assert.isAbove(parseError.maximumPathDepth ?? 0, 0);
210 assert.isTrue(Schema.isSchemaError(cause));
211 assert.notInclude(parseError.message, secret);
212 assert.notInclude(encodeUnknownJsonString(directDiagnostics), secret);
213 }),
214 );
215
216 it.effect("logs outgoing notifications when logOutgoing is enabled", () =>
217 Effect.gen(function* () {
218 const { stdio } = yield* makeInMemoryStdio();
219 const events: Array<AcpProtocol.AcpProtocolLogEvent> = [];
220 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
221 stdio,
222 serverRequestMethods: new Set(),
223 logOutgoing: true,
224 logger: (event) =>
225 Effect.sync(() => {
226 events.push(event);
227 }),
228 });
229
230 yield* transport.notify("session/cancel", { sessionId: "session-1" });
231
232 assert.deepEqual(events, [
233 {
234 direction: "outgoing",
235 stage: "decoded",
236 payload: {
237 _tag: "Request",
238 id: "",
239 tag: "session/cancel",
240 payload: {
241 sessionId: "session-1",
242 },
243 headers: [],
244 },
245 },
246 {
247 direction: "outgoing",
248 stage: "raw",
249 payload:
250 '{"jsonrpc":"2.0","method":"session/cancel","params":{"sessionId":"session-1"},"id":"","headers":[]}\n',
251 },
252 ]);
253 }),
254 );
255
256 it.effect("logs decode failures without copying the cause or wire payload", () =>
257 Effect.gen(function* () {
258 const secret = "acp-wire-secret-sentinel";
259 const { stdio, input } = yield* makeInMemoryStdio();
260 const events: Array<AcpProtocol.AcpProtocolLogEvent> = [];
261 const termination = yield* Deferred.make<AcpError.AcpError>();
262 yield* AcpProtocol.makeAcpPatchedProtocol({
263 stdio,
264 serverRequestMethods: new Set(),
265 logIncoming: true,
266 logger: (event) =>
267 Effect.sync(() => {
268 events.push(event);
269 }),
270 onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
271 });
272
273 yield* Queue.offer(input, encoder.encode(`{"secret":"${secret}"\n`));
274 yield* Deferred.await(termination);
275
276 const event = events.find(({ stage }) => stage === "decode_failed");
277 assert.deepEqual(event, {
278 direction: "incoming",
279 stage: "decode_failed",
280 payload: {
281 operation: "decode-wire-message",
282 },
283 });
284 assert.notInclude(encodeUnknownJsonString(event), secret);
285 }),
286 );
287
288 it.effect("fails notification encoding through the declared ACP error channel", () =>
289 Effect.gen(function* () {
290 const { stdio } = yield* makeInMemoryStdio();
291 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
292 stdio,
293 serverRequestMethods: new Set(),
294 });
295
296 const bigintError = yield* transport.notify("x/test", 1n).pipe(Effect.flip);
297 assert.instanceOf(bigintError, AcpError.AcpProtocolParseError);
298 assert.equal(bigintError.operation, "encode-message");
299 assert.equal(bigintError.method, "x/test");
300 assert.instanceOf(bigintError.cause, TypeError);
301 assert.equal(
302 bigintError.message,
303 "ACP protocol operation 'encode-message' failed for method 'x/test'.",
304 );
305
306 const circular: Record<string, unknown> = {};
307 circular.self = circular;
308 const circularError = yield* transport.notify("x/test", circular).pipe(Effect.flip);
309 assert.instanceOf(circularError, AcpError.AcpProtocolParseError);
310 assert.equal(circularError.operation, "encode-message");
311 assert.equal(circularError.method, "x/test");
312 assert.instanceOf(circularError.cause, TypeError);
313
314 const requestError = yield* transport.request("x/request", 1n).pipe(
315 Effect.match({
316 onFailure: (error) => error,
317 onSuccess: () => assert.fail("Expected request encoding to fail"),
318 }),
319 );
320 assert.instanceOf(requestError, AcpError.AcpProtocolParseError);
321 assert.deepInclude(requestError, {
322 operation: "encode-message",
323 method: "x/request",
324 requestId: 1,
325 });
326 }),
327 );
328
329 it.effect("supports generic extension requests over the patched transport", () =>
330 Effect.gen(function* () {
331 const { stdio, input, output } = yield* makeInMemoryStdio();
332 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
333 stdio,
334 serverRequestMethods: new Set(),
335 });
336
337 const response = yield* transport
338 .request("x/test", { hello: "world" })
339 .pipe(Effect.forkScoped);
340 const outbound = yield* Queue.take(output);
341 assert.deepEqual(yield* decodeExtRequest(outbound), {
342 jsonrpc: "2.0",
343 id: 1,
344 method: "x/test",
345 params: {
346 hello: "world",
347 },
348 headers: [],
349 });
350
351 yield* Queue.offer(
352 input,
353 yield* encodeJsonl(ExtResponse, {
354 jsonrpc: "2.0",
355 id: 1,
356 result: {
357 ok: true,
358 },
359 }),
360 );
361
362 const resolved = yield* Fiber.join(response);
363 assert.deepEqual(resolved, { ok: true });
364 }),
365 );
366
367 it.effect("correlates extension response errors with the originating request", () =>
368 Effect.gen(function* () {
369 const { stdio, input, output } = yield* makeInMemoryStdio();
370 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
371 stdio,
372 serverRequestMethods: new Set(),
373 });
374
375 const response = yield* transport
376 .request("x/private", { hello: "world" })
377 .pipe(Effect.forkScoped);
378 yield* Queue.take(output);
379 yield* Queue.offer(
380 input,
381 encoder.encode(
382 `${encodeUnknownJsonString({
383 jsonrpc: "2.0",
384 id: 1,
385 error: {
386 _tag: "Cause",
387 code: -32602,
388 message: "Invalid params",
389 data: [
390 {
391 _tag: "Fail",
392 error: {
393 code: -32602,
394 message: "Invalid params",
395 data: { field: "hello" },
396 },
397 },
398 ],
399 },
400 })}\n`,
401 ),
402 );
403
404 const error = yield* Fiber.join(response).pipe(
405 Effect.match({
406 onFailure: (error) => error,
407 onSuccess: () => assert.fail("Expected extension request to fail"),
408 }),
409 );
410 assert.instanceOf(error, AcpError.AcpRequestError);
411 assert.deepInclude(error, {
412 code: -32602,
413 errorMessage: "Invalid params",
414 method: "x/private",
415 requestId: 1,
416 operation: "receive-response",
417 });
418 }),
419 );
420
421 it.effect("preserves numeric ids for inbound extension requests", () =>
422 Effect.gen(function* () {
423 const { stdio, input, output } = yield* makeInMemoryStdio();
424 yield* AcpProtocol.makeAcpPatchedProtocol({
425 stdio,
426 serverRequestMethods: new Set(),
427 onExtRequest: () => Effect.succeed({ ok: true }),
428 });
429
430 yield* Queue.offer(
431 input,
432 yield* encodeJsonl(ExtRequest, {
433 jsonrpc: "2.0",
434 id: 7,
435 method: "x/test",
436 params: {
437 hello: "world",
438 },
439 headers: [],
440 }),
441 );
442
443 const outbound = yield* Queue.take(output);
444 assert.deepEqual(yield* decodeExtResponse(outbound), {
445 jsonrpc: "2.0",
446 id: 7,
447 result: {
448 ok: true,
449 },
450 });
451 }),
452 );
453
454 it.effect("preserves zero-valued ids for inbound core client requests", () =>
455 Effect.gen(function* () {
456 const { stdio, input, output } = yield* makeInMemoryStdio();
457 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
458 stdio,
459 serverRequestMethods: new Set(["session/request_permission"]),
460 });
461 const inboundRequest = yield* Deferred.make<unknown>();
462
463 yield* transport.serverProtocol
464 .run((_clientId, message) => Deferred.succeed(inboundRequest, message).pipe(Effect.asVoid))
465 .pipe(Effect.forkScoped);
466
467 yield* Queue.offer(
468 input,
469 yield* encodeJsonl(RequestPermissionRequest, {
470 jsonrpc: "2.0",
471 id: 0,
472 method: "session/request_permission",
473 params: {
474 sessionId: "session-1",
475 toolCall: {
476 toolCallId: "tool-1",
477 title: "Allow mock action",
478 },
479 options: [{ optionId: "allow", name: "Allow", kind: "allow_once" }],
480 },
481 headers: [],
482 }),
483 );
484
485 const message = yield* Deferred.await(inboundRequest);
486 assert.deepEqual(message, {
487 _tag: "Request",
488 id: 0,
489 tag: "session/request_permission",
490 payload: {
491 sessionId: "session-1",
492 toolCall: {
493 toolCallId: "tool-1",
494 title: "Allow mock action",
495 },
496 options: [{ optionId: "allow", name: "Allow", kind: "allow_once" }],
497 },
498 headers: [],
499 });
500
501 yield* transport.serverProtocol.send(0, {
502 _tag: "Exit",
503 requestId: 0,
504 exit: {
505 _tag: "Success",
506 value: {
507 outcome: {
508 outcome: "selected",
509 optionId: "allow",
510 },
511 },
512 },
513 });
514
515 const outbound = yield* Queue.take(output);
516 assert.deepEqual(yield* decodeRequestPermissionResponse(outbound), {
517 jsonrpc: "2.0",
518 id: 0,
519 result: {
520 outcome: {
521 outcome: "selected",
522 optionId: "allow",
523 },
524 },
525 });
526 }),
527 );
528
529 it.effect("cleans up interrupted extension requests before a late response arrives", () =>
530 Effect.gen(function* () {
531 const { stdio, input, output } = yield* makeInMemoryStdio();
532 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
533 stdio,
534 serverRequestMethods: new Set(),
535 });
536 const lateResponse = yield* Deferred.make<unknown>();
537
538 yield* transport.clientProtocol
539 .run(0, (message) => Deferred.succeed(lateResponse, message).pipe(Effect.asVoid))
540 .pipe(Effect.forkScoped);
541
542 const response = yield* transport
543 .request("x/test", { hello: "world" })
544 .pipe(Effect.forkScoped);
545 const outbound = yield* Queue.take(output);
546 assert.deepEqual(yield* decodeExtRequest(outbound), {
547 jsonrpc: "2.0",
548 id: 1,
549 method: "x/test",
550 params: {
551 hello: "world",
552 },
553 headers: [],
554 });
555
556 yield* Fiber.interrupt(response);
557 yield* Queue.offer(
558 input,
559 yield* encodeJsonl(ExtResponse, {
560 jsonrpc: "2.0",
561 id: 1,
562 result: {
563 ok: true,
564 },
565 }),
566 );
567
568 const message = yield* Deferred.await(lateResponse);
569 assert.deepEqual(message, {
570 _tag: "Exit",
571 requestId: 1,
572 exit: {
573 _tag: "Success",
574 value: {
575 ok: true,
576 },
577 },
578 });
579 }),
580 );
581
582 it.effect("propagates the real child exit code when the input stream ends", () =>
583 Effect.gen(function* () {
584 const handle = yield* makeHandle({ ACP_MOCK_EXIT_IMMEDIATELY_CODE: "7" });
585 const firstMessage = yield* Deferred.make<unknown>();
586 const termination = yield* Deferred.make<AcpError.AcpError>();
587 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
588 stdio: makeChildStdio(handle),
589 terminationError: makeTerminationError(handle),
590 serverRequestMethods: new Set(),
591 onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
592 });
593
594 yield* transport.clientProtocol
595 .run(0, (message) => Deferred.succeed(firstMessage, message).pipe(Effect.asVoid))
596 .pipe(Effect.forkScoped);
597
598 const message = yield* Deferred.await(firstMessage);
599 const exitError = yield* Deferred.await(termination);
600 assert.instanceOf(exitError, AcpError.AcpProcessExitedError);
601 assert.equal((exitError as AcpError.AcpProcessExitedError).code, 7);
602 assert.equal((message as { readonly _tag?: string })._tag, "ClientProtocolError");
603 const defect = (message as { readonly error: { readonly reason: unknown } }).error.reason as {
604 readonly _tag: string;
605 readonly message: string;
606 readonly cause: unknown;
607 };
608 assert.equal(defect._tag, "RpcClientDefect");
609 assert.equal(defect.message, "ACP protocol terminated.");
610 assert.instanceOf(defect.cause, AcpError.AcpProcessExitedError);
611 assert.equal((defect.cause as AcpError.AcpProcessExitedError).code, 7);
612 }),
613 );
614
615 it.effect("classifies an input stream ending without inventing a cause", () =>
616 Effect.gen(function* () {
617 const { stdio, input } = yield* makeInMemoryStdio();
618 const termination = yield* Deferred.make<AcpError.AcpError>();
619 yield* AcpProtocol.makeAcpPatchedProtocol({
620 stdio,
621 serverRequestMethods: new Set(),
622 onTermination: (error) => Deferred.succeed(termination, error).pipe(Effect.asVoid),
623 });
624
625 yield* Queue.end(input);
626
627 const error = yield* Deferred.await(termination);
628 assert.instanceOf(error, AcpError.AcpInputStreamEndedError);
629 assert.equal(error.message, "ACP input stream ended.");
630 assert.equal("cause" in error, false);
631 }),
632 );
633
634 it.effect("does not emit a second process-exit error after a decode failure", () =>
635 Effect.gen(function* () {
636 const handle = yield* makeHandle({
637 ACP_MOCK_MALFORMED_OUTPUT: "1",
638 ACP_MOCK_MALFORMED_OUTPUT_EXIT_CODE: "23",
639 });
640 const terminationCalls = yield* Ref.make(0);
641 const firstMessage = yield* Deferred.make<unknown>();
642 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
643 stdio: makeChildStdio(handle),
644 terminationError: makeTerminationError(handle),
645 serverRequestMethods: new Set(),
646 onTermination: () => Ref.update(terminationCalls, (count) => count + 1),
647 });
648
649 yield* transport.clientProtocol
650 .run(0, (message) => Deferred.succeed(firstMessage, message).pipe(Effect.asVoid))
651 .pipe(Effect.forkScoped);
652
653 const message = yield* Deferred.await(firstMessage);
654 assert.equal(yield* Ref.get(terminationCalls), 1);
655 assert.equal((message as { readonly _tag?: string })._tag, "ClientProtocolError");
656 const defect = (message as { readonly error: { readonly reason: unknown } }).error.reason as {
657 readonly _tag: string;
658 readonly message: string;
659 readonly cause: unknown;
660 };
661 assert.equal(defect._tag, "RpcClientDefect");
662 assert.equal(defect.message, "ACP protocol terminated.");
663 assert.instanceOf(defect.cause, AcpError.AcpProtocolParseError);
664 }),
665 );
666
667 it.effect("keeps client send failure messages independent from the cause", () =>
668 Effect.gen(function* () {
669 const { stdio } = yield* makeInMemoryStdio();
670 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
671 stdio,
672 serverRequestMethods: new Set(),
673 });
674
675 const failure = yield* transport.clientProtocol
676 .send(0, {
677 _tag: "Request",
678 id: "request-1",
679 tag: "x/test",
680 payload: 1n,
681 headers: [],
682 })
683 .pipe(Effect.flip);
684 const defect = failure.reason as {
685 readonly _tag: string;
686 readonly message: string;
687 readonly cause: unknown;
688 };
689
690 assert.equal(defect._tag, "RpcClientDefect");
691 assert.equal(defect.message, "Failed to send ACP protocol message.");
692 assert.instanceOf(defect.cause, AcpError.AcpProtocolParseError);
693 }),
694 );
695
696 it.effect("fails pending extension requests with the propagated exit code", () =>
697 Effect.gen(function* () {
698 const { stdio, input, output } = yield* makeInMemoryStdio();
699 const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
700 stdio,
701 terminationError: Effect.succeed(new AcpError.AcpProcessExitedError({ code: 0 })),
702 serverRequestMethods: new Set(),
703 });
704
705 const response = yield* transport
706 .request("x/test", { hello: "world" })
707 .pipe(Effect.forkScoped);
708 yield* Queue.take(output);
709 yield* Queue.end(input);
710
711 const error = yield* Fiber.join(response).pipe(
712 Effect.match({
713 onFailure: (error) => error,
714 onSuccess: () => assert.fail("Expected request to fail after process exit"),
715 }),
716 );
717 assert.instanceOf(error, AcpError.AcpProcessExitedError);
718 assert.equal(error.code, 0);
719 }),
720 );
721});