diff --git a/src/evolution-loop.test.ts b/src/evolution-loop.test.ts index 1606393..5e29b74 100644 --- a/src/evolution-loop.test.ts +++ b/src/evolution-loop.test.ts @@ -1381,7 +1381,7 @@ describe("evolution loop", () => { ) .replace(AUTOMATION_MODEL_RE, 'model = "custom-model"') .replace(AUTOMATION_REASONING_RE, 'reasoning_effort = "medium"') - .replace(AUTOMATION_RRULE_RE, 'rrule = "RRULE:FREQ=WEEKLY;BYDAY=FR"') + + .replace(AUTOMATION_RRULE_RE, 'rrule = "FREQ=WEEKLY;BYDAY=FR"') + '\nnotification_policy = "failed_runs_only"\nexecution_environment = "local"\ntarget = { type = "project", project_id = "saved-project" }\n'; await Bun.write(automationPath, updated); await Bun.write( @@ -1392,7 +1392,7 @@ describe("evolution loop", () => { true ); const reenabled = await enableEvolutionLoop(project); - expect(reenabled.config.rrule).toContain("WEEKLY"); + expect(reenabled.config.rrule).toBe("RRULE:FREQ=WEEKLY;BYDAY=FR"); const after = Bun.TOML.parse( await readFile(automationPath, "utf8") ) as Record; diff --git a/src/evolution-loop.ts b/src/evolution-loop.ts index 9f2c06b..6700a59 100644 --- a/src/evolution-loop.ts +++ b/src/evolution-loop.ts @@ -671,7 +671,11 @@ async function enableEvolutionLoopScoped(args: { ); } if (existingAutomation.exists && !args.rrule && existingAutomation.rrule) { - config.rrule = normalizeRrule(existingAutomation.rrule); + config.rrule = normalizeRrule( + existingAutomation.rrule.startsWith("RRULE:") + ? existingAutomation.rrule + : `RRULE:${existingAutomation.rrule}` + ); } const scaffold = existingAutomation.exists ? { path: join(args.homeDir, ".codex", "automations", name) } @@ -697,7 +701,7 @@ async function enableEvolutionLoopScoped(args: { homeDir: args.homeDir, name, status: "ACTIVE", - rrule: config.rrule, + rrule: args.rrule ? config.rrule : undefined, }); await appendLoopAudit(args, { generatedAt: now,