























@@ -2735,17 +2735,18 @@ describe("runCodexAppServerAttempt", () => {
27352735});
2736273627372737it("does not drop turn completion notifications emitted while turn/start is in flight", async () => {
2738-let harness: ReturnType<typeof createAppServerHarness>;
2739-harness = createAppServerHarness(async (method) => {
2740-if (method === "thread/start") {
2741-return threadStartResult();
2742-}
2743-if (method === "turn/start") {
2744-await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2745-return turnStartResult("turn-1", "completed");
2746-}
2747-return {};
2748-});
2738+const harness: ReturnType<typeof createAppServerHarness> = createAppServerHarness(
2739+async (method) => {
2740+if (method === "thread/start") {
2741+return threadStartResult();
2742+}
2743+if (method === "turn/start") {
2744+await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2745+return turnStartResult("turn-1", "completed");
2746+}
2747+return {};
2748+},
2749+);
2749275027502751const result = await runCodexAppServerAttempt(
27512752createParams(path.join(tempDir, "session.jsonl"), path.join(tempDir, "workspace")),
@@ -2755,30 +2756,31 @@ describe("runCodexAppServerAttempt", () => {
27552756});
2756275727572758it("does not fail when a buffered terminal notification is followed by client close", async () => {
2758-let harness: ReturnType<typeof createAppServerHarness>;
27592759let resolveBufferedTerminal!: () => void;
27602760const bufferedTerminal = new Promise<void>((resolve) => {
27612761resolveBufferedTerminal = resolve;
27622762});
2763-harness = createAppServerHarness(async (method) => {
2764-if (method === "thread/start") {
2765-return threadStartResult();
2766-}
2767-if (method === "turn/start") {
2768-await harness.notify({
2769-method: "item/started",
2770-params: {
2771-threadId: "thread-1",
2772-turnId: "turn-1",
2773-item: { id: "tool-1", type: "commandExecution" },
2774-},
2775-});
2776-await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2777-resolveBufferedTerminal();
2778-return turnStartResult("turn-1", "inProgress");
2779-}
2780-return {};
2781-});
2763+const harness: ReturnType<typeof createAppServerHarness> = createAppServerHarness(
2764+async (method) => {
2765+if (method === "thread/start") {
2766+return threadStartResult();
2767+}
2768+if (method === "turn/start") {
2769+await harness.notify({
2770+method: "item/started",
2771+params: {
2772+threadId: "thread-1",
2773+turnId: "turn-1",
2774+item: { id: "tool-1", type: "commandExecution" },
2775+},
2776+});
2777+await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2778+resolveBufferedTerminal();
2779+return turnStartResult("turn-1", "inProgress");
2780+}
2781+return {};
2782+},
2783+);
2782278427832785const run = runCodexAppServerAttempt(
27842786createParams(path.join(tempDir, "session.jsonl"), path.join(tempDir, "workspace")),
@@ -2795,24 +2797,25 @@ describe("runCodexAppServerAttempt", () => {
27952797});
2796279827972799it("does not time out when turn progress arrives before turn/start returns", async () => {
2798-let harness: ReturnType<typeof createAppServerHarness>;
2799-harness = createAppServerHarness(async (method) => {
2800-if (method === "thread/start") {
2801-return threadStartResult();
2802-}
2803-if (method === "turn/start") {
2804-await harness.notify({
2805-method: "turn/started",
2806-params: {
2807-threadId: "thread-1",
2808-turnId: "turn-1",
2809-turn: { id: "turn-1", status: "inProgress" },
2810-},
2811-});
2812-return turnStartResult("turn-1", "inProgress");
2813-}
2814-return {};
2815-});
2800+const harness: ReturnType<typeof createAppServerHarness> = createAppServerHarness(
2801+async (method) => {
2802+if (method === "thread/start") {
2803+return threadStartResult();
2804+}
2805+if (method === "turn/start") {
2806+await harness.notify({
2807+method: "turn/started",
2808+params: {
2809+threadId: "thread-1",
2810+turnId: "turn-1",
2811+turn: { id: "turn-1", status: "inProgress" },
2812+},
2813+});
2814+return turnStartResult("turn-1", "inProgress");
2815+}
2816+return {};
2817+},
2818+);
28162819const params = createParams(
28172820path.join(tempDir, "session.jsonl"),
28182821path.join(tempDir, "workspace"),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。