mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 14:10:35 +00:00
fix(cron): treat transient tool error payloads as recoverable (openclaw#29527) thanks @Sid-Qin
Verified: - pnpm install --frozen-lockfile - pnpm check - pnpm test -- --run src/cron/isolated-agent.uses-last-non-empty-agent-text-as.test.ts Co-authored-by: Sid-Qin <201593046+Sid-Qin@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -197,6 +197,50 @@ describe("runCronIsolatedAgentTurn", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("treats transient error payloads as non-fatal when a later success payload exists", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
mockEmbeddedPayloads([
|
||||
{
|
||||
text: "⚠️ ✍️ Write: failed",
|
||||
isError: true,
|
||||
},
|
||||
{
|
||||
text: "Write completed successfully.",
|
||||
isError: false,
|
||||
},
|
||||
]);
|
||||
const { res } = await runCronTurn(home, {
|
||||
jobPayload: DEFAULT_AGENT_TURN_PAYLOAD,
|
||||
mockTexts: null,
|
||||
});
|
||||
|
||||
expect(res.status).toBe("ok");
|
||||
expect(res.summary).toBe("Write completed successfully.");
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps error status when run-level error accompanies post-error text", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
|
||||
payloads: [
|
||||
{ text: "Model context overflow", isError: true },
|
||||
{ text: "Partial assistant text before error" },
|
||||
],
|
||||
meta: {
|
||||
durationMs: 5,
|
||||
agentMeta: { sessionId: "s", provider: "p", model: "m" },
|
||||
error: { kind: "context_overflow", message: "exceeded context window" },
|
||||
},
|
||||
});
|
||||
const { res } = await runCronTurn(home, {
|
||||
jobPayload: DEFAULT_AGENT_TURN_PAYLOAD,
|
||||
mockTexts: null,
|
||||
});
|
||||
|
||||
expect(res.status).toBe("error");
|
||||
});
|
||||
});
|
||||
|
||||
it("passes resolved agentDir to runEmbeddedPiAgent", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const { res } = await runCronTurn(home, {
|
||||
|
||||
Reference in New Issue
Block a user