test(codex): avoid app-server diagnostic notification race · openclaw/openclaw@bee8ad3
steipete
·
2026-05-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6786,7 +6786,27 @@ describe("runCodexAppServerAttempt", () => {
|
6786 | 6786 | const sessionFile = path.join(tempDir, "session.jsonl"); |
6787 | 6787 | const workspaceDir = path.join(tempDir, "workspace"); |
6788 | 6788 | testing.setOpenClawCodingToolsFactoryForTests(() => [createRuntimeDynamicTool("message")]); |
6789 | | -const harness = createStartedThreadHarness(); |
| 6789 | +const harness = createAppServerHarness(async (method) => { |
| 6790 | +if (method === "thread/start") { |
| 6791 | +return threadStartResult(); |
| 6792 | +} |
| 6793 | +if (method === "turn/start") { |
| 6794 | +return { |
| 6795 | +turn: { |
| 6796 | + ...turnStartResult("turn-1", "completed").turn, |
| 6797 | +items: [ |
| 6798 | +{ |
| 6799 | +id: "msg-1", |
| 6800 | +type: "agentMessage", |
| 6801 | +text: "hello back", |
| 6802 | +status: "completed", |
| 6803 | +}, |
| 6804 | +], |
| 6805 | +}, |
| 6806 | +}; |
| 6807 | +} |
| 6808 | +return {}; |
| 6809 | +}); |
6790 | 6810 | const params = createParams(sessionFile, workspaceDir); |
6791 | 6811 | params.disableTools = false; |
6792 | 6812 | params.runtimePlan = createCodexRuntimePlanFixture(); |
@@ -6808,17 +6828,6 @@ describe("runCodexAppServerAttempt", () => {
|
6808 | 6828 | } as never; |
6809 | 6829 | const run = runCodexAppServerAttempt(params); |
6810 | 6830 | await harness.waitForMethod("turn/start"); |
6811 | | -await new Promise<void>((resolve) => setImmediate(resolve)); |
6812 | | -await harness.notify({ |
6813 | | -method: "item/agentMessage/delta", |
6814 | | -params: { |
6815 | | -threadId: "thread-1", |
6816 | | -turnId: "turn-1", |
6817 | | -itemId: "msg-1", |
6818 | | -delta: "hello back", |
6819 | | -}, |
6820 | | -}); |
6821 | | -await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" }); |
6822 | 6831 | await run; |
6823 | 6832 | await flushDiagnosticEvents(); |
6824 | 6833 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。