The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 09:45 UTC
test(acp-registry): Kimi outcome test waits for each poll before advancing the clock (#37574)
Julius Marminge committed
Nov 16, 2026 at 00:25 UTC
d6672df27384cf0f5960426b938ba114e2db1840
1 file changed
+15
-3
packages/provider-acp-registry/src/server/kimiAcp.test.ts
+15
-3
@@ -4,6 +4,7 @@ import * as Effect from "effect/Effect";
4
import * as Fiber from "effect/Fiber";
5
import * as FileSystem from "effect/FileSystem";
6
import * as Path from "effect/Path";
7
+import * as Queue from "effect/Queue";
8
import * as TestClock from "effect/testing/TestClock";
9
10
import { makeKimiPromptOutcomeWatch } from "./kimiAcp.ts";
@@ -42,17 +43,28 @@ it.layer(NodeServices.layer)("makeKimiPromptOutcomeWatch", (it) => {
43
// An earlier turn's failure is history, not this prompt's outcome.
44
yield* fileSystem.writeFileString(wire, failedTurn(0));
45
const append = (text: string) => fileSystem.writeFileString(wire, text, { flag: "a" });
45
- const watch = yield* makeKimiPromptOutcomeWatch(home);
46
+ // Signals once a poll has closed the log, so the check is already waiting for its next poll.
47
+ const polls = yield* Queue.unbounded<void>();
48
+ const watch = yield* makeKimiPromptOutcomeWatch(home).pipe(
49
+ Effect.provideService(FileSystem.FileSystem, {
50
+ ...fileSystem,
51
+ open: (path, options) =>
52
+ Effect.addFinalizer(() => Queue.offer(polls, undefined)).pipe(
53
+ Effect.andThen(fileSystem.open(path, options)),
54
+ ),
55
+ }),
56
+ );
57
58
const completed = yield* watch(SESSION_ID);
59
yield* append(completedTurn(1));
60
assert.isUndefined(yield* completed(endTurn));
61
+ yield* Queue.take(polls);
62
63
// Kimi answers the prompt before `turn.ended` reaches disk.
64
const failed = yield* watch(SESSION_ID);
53
- const pending = yield* failed(endTurn).pipe(Effect.forkChild);
65
yield* append(failedTurn(2).slice(0, 40));
55
- yield* TestClock.adjust("50 millis");
66
+ const pending = yield* failed(endTurn).pipe(Effect.forkChild);
67
+ yield* Queue.take(polls);
68
yield* append(failedTurn(2).slice(40));
69
yield* TestClock.adjust("50 millis");
70
assert.deepStrictEqual(yield* Fiber.join(pending), {