Scheduled runs are pre-approved: they carry out their brief instead of drafting for confirmation. A run that can't do its brief calls report_run_failed and is retried 5 and 10 minutes later; only then does the user get one "failed after N tries" message, and the routine keeps why in last_error. Every reply and task now gets ActionCheckNote: look for an existing record before creating one, and verify an action took effect before saying it's done. Memory and instructions saves are read back, and create_bot, create_schedule, start_task and delegate_task refuse duplicates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
22 lines
731 B
TypeScript
22 lines
731 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import reportRunFailedTool from "./report-run-failed-tool";
|
|
|
|
const signal = new AbortController().signal;
|
|
|
|
describe("reportRunFailedTool", () => {
|
|
test("passes the reason on", async () => {
|
|
const reasons: string[] = [];
|
|
const tool = reportRunFailedTool({ onFail: ({ reason }) => reasons.push(reason) });
|
|
|
|
await tool.run({ args: { reason: " SMTP refused the login. " }, signal });
|
|
|
|
expect(reasons).toEqual(["SMTP refused the login."]);
|
|
});
|
|
|
|
test("rejects an empty reason", () => {
|
|
const tool = reportRunFailedTool({ onFail: () => {} });
|
|
|
|
expect(tool.schema?.safeParse({ reason: " " }).success).toBe(false);
|
|
});
|
|
});
|