mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
Preserve cron task ledger run IDs
This commit is contained in:
@@ -182,6 +182,35 @@ describe("cron service ops seam coverage", () => {
|
||||
stop(state);
|
||||
});
|
||||
|
||||
it("keeps manual acknowledgement IDs separate from recoverable task run IDs", async () => {
|
||||
const { storePath } = await makeStorePath();
|
||||
const now = Date.parse("2026-03-23T12:00:00.000Z");
|
||||
const restoreStateDir = withStateDirForStorePath(storePath);
|
||||
|
||||
try {
|
||||
await writeDueIsolatedJobSnapshot(storePath, now);
|
||||
|
||||
const state = createOkIsolatedCronState({ storePath, now, summary: "done" });
|
||||
const manualRunId = `manual:isolated-timeout:${now}:1`;
|
||||
|
||||
await expect(
|
||||
run(state, "isolated-timeout", "force", { runId: manualRunId }),
|
||||
).resolves.toEqual({
|
||||
ok: true,
|
||||
ran: true,
|
||||
});
|
||||
|
||||
expect(findTaskByRunId(`cron:isolated-timeout:${now}`)).toMatchObject({
|
||||
runtime: "cron",
|
||||
status: "succeeded",
|
||||
sourceId: "isolated-timeout",
|
||||
});
|
||||
expect(findTaskByRunId(manualRunId)).toBeUndefined();
|
||||
} finally {
|
||||
restoreStateDir();
|
||||
}
|
||||
});
|
||||
|
||||
it("records timed out manual runs as timed_out in the shared task registry", async () => {
|
||||
const { storePath } = await makeStorePath();
|
||||
const now = Date.parse("2026-03-23T12:00:00.000Z");
|
||||
|
||||
@@ -508,9 +508,8 @@ function tryCreateManualTaskRun(params: {
|
||||
state: CronServiceState;
|
||||
job: CronJob;
|
||||
startedAt: number;
|
||||
runId?: string;
|
||||
}): string | undefined {
|
||||
const runId = params.runId ?? createCronExecutionId(params.job.id, params.startedAt);
|
||||
const runId = createCronExecutionId(params.job.id, params.startedAt);
|
||||
try {
|
||||
createRunningTaskRun({
|
||||
runtime: "cron",
|
||||
@@ -662,7 +661,6 @@ async function prepareManualRun(
|
||||
state,
|
||||
job,
|
||||
startedAt: preflight.now,
|
||||
runId: opts?.runId,
|
||||
});
|
||||
const executionJob = structuredClone(job);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user