
























@@ -105,18 +105,17 @@ describe("runAgentHarnessAttemptWithFallback", () => {
105105expect(piRunAttempt).toHaveBeenCalledTimes(1);
106106});
107107108-it("falls back to the PI harness in auto mode when the selected plugin harness fails", async () => {
108+it("falls back to the PI harness in auto mode when no plugin harness matches", async () => {
109109process.env.OPENCLAW_AGENT_RUNTIME = "auto";
110-registerFailingCodexHarness();
111110112111const result = await runAgentHarnessAttemptWithFallback(createAttemptParams());
113112114113expect(result.sessionIdUsed).toBe("pi");
115114expect(piRunAttempt).toHaveBeenCalledTimes(1);
116115});
117116118-it("surfaces a forced plugin harness failure instead of replaying through PI", async () => {
119-process.env.OPENCLAW_AGENT_RUNTIME = "codex";
117+it("surfaces an auto-selected plugin harness failure instead of replaying through PI", async () => {
118+process.env.OPENCLAW_AGENT_RUNTIME = "auto";
120119registerFailingCodexHarness();
121120122121await expect(runAgentHarnessAttemptWithFallback(createAttemptParams())).rejects.toThrow(
@@ -125,26 +124,25 @@ describe("runAgentHarnessAttemptWithFallback", () => {
125124expect(piRunAttempt).not.toHaveBeenCalled();
126125});
127126128-it("disables PI retry fallback when auto-selected harness fails and fallback is none", async () => {
129-process.env.OPENCLAW_AGENT_RUNTIME = "auto";
127+it("surfaces a forced plugin harness failure instead of replaying through PI", async () => {
128+process.env.OPENCLAW_AGENT_RUNTIME = "codex";
130129registerFailingCodexHarness();
131130132-await expect(
133-runAgentHarnessAttemptWithFallback(
134-createAttemptParams({ agents: { defaults: { embeddedHarness: { fallback: "none" } } } }),
135-),
136-).rejects.toThrow("codex startup failed");
131+await expect(runAgentHarnessAttemptWithFallback(createAttemptParams())).rejects.toThrow(
132+"codex startup failed",
133+);
137134expect(piRunAttempt).not.toHaveBeenCalled();
138135});
139136140137it("honors env fallback override over config fallback", async () => {
141138process.env.OPENCLAW_AGENT_RUNTIME = "auto";
142139process.env.OPENCLAW_AGENT_HARNESS_FALLBACK = "none";
143-registerFailingCodexHarness();
144140145-await expect(runAgentHarnessAttemptWithFallback(createAttemptParams())).rejects.toThrow(
146-"codex startup failed",
147-);
141+await expect(
142+runAgentHarnessAttemptWithFallback(
143+createAttemptParams({ agents: { defaults: { embeddedHarness: { fallback: "pi" } } } }),
144+),
145+).rejects.toThrow("PI fallback is disabled");
148146expect(piRunAttempt).not.toHaveBeenCalled();
149147});
150148});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。