fix(gateway): propagate MCP yield session context · openclaw/openclaw@88e4a0f
zhangguiping
·
2026-06-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1687,6 +1687,37 @@ describe("runCliAgent reliability", () => {
|
1687 | 1687 | expect(completion.refusal).toBe(false); |
1688 | 1688 | }); |
1689 | 1689 | |
| 1690 | +it("marks CLI runs as yielded when bundle MCP records sessions_yield", async () => { |
| 1691 | +const exit = { |
| 1692 | +reason: "exit" as const, |
| 1693 | +exitCode: 0, |
| 1694 | +exitSignal: null, |
| 1695 | +durationMs: 50, |
| 1696 | +stdout: "yield acknowledged", |
| 1697 | +stderr: "", |
| 1698 | +timedOut: false, |
| 1699 | +noOutputTimedOut: false, |
| 1700 | +}; |
| 1701 | +supervisorSpawnMock.mockResolvedValueOnce({ |
| 1702 | + ...createManagedRun(exit), |
| 1703 | +wait: vi.fn(async () => { |
| 1704 | +const runtime = await import("../gateway/mcp-http.loopback-runtime.js"); |
| 1705 | +await runtime.resolveMcpLoopbackYieldHandler("s1")?.("waiting on subagents"); |
| 1706 | +return exit; |
| 1707 | +}), |
| 1708 | +}); |
| 1709 | + |
| 1710 | +const result = await runPreparedCliAgent(buildPreparedContext()); |
| 1711 | + |
| 1712 | +expect(result.meta.yielded).toBe(true); |
| 1713 | +expect(result.meta.livenessState).toBe("paused"); |
| 1714 | +expect(result.meta.stopReason).toBe("end_turn"); |
| 1715 | +const completion = requireRecord(result.meta.completion, "completion"); |
| 1716 | +expect(completion.finishReason).toBe("end_turn"); |
| 1717 | +expect(completion.stopReason).toBe("end_turn"); |
| 1718 | +expect(completion.refusal).toBe(false); |
| 1719 | +}); |
| 1720 | + |
1690 | 1721 | it("seeds fresh CLI sessions from the OpenClaw transcript", async () => { |
1691 | 1722 | supervisorSpawnMock.mockResolvedValueOnce( |
1692 | 1723 | createManagedRun({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。