feat: generic scheduling and reposition OpenClaw cron as optional#41
feat: generic scheduling and reposition OpenClaw cron as optional#41WellDunDun merged 5 commits intodevfrom
Conversation
…optional The primary automation story is now agent-agnostic. `selftune schedule` generates ready-to-use snippets for system cron, macOS launchd, and Linux systemd timers. `selftune cron` is repositioned as an optional OpenClaw integration rather than the main automation path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cli/selftune/schedule.ts`:
- Around line 27-52: SCHEDULE_ENTRIES duplicates the same job set already
defined as DEFAULT_CRON_JOBS in cron/setup.ts; to fix, remove the hard-coded
SCHEDULE_ENTRIES array and instead import the single source of truth
(DEFAULT_CRON_JOBS) and map/transform it into any format-specific shape required
by the schedule command (e.g., add CLI-only fields like command or render
descriptions) so both cron/setup and schedule.ts use the same underlying job
metadata; update any references to SCHEDULE_ENTRIES to use the imported
DEFAULT_CRON_JOBS (or a small adapter function) and ensure
descriptions/semantics are preserved by deriving them from that single constant.
- Around line 152-175: The file is failing the repo formatter (Biome) around the
formatOutput function; run the project's formatter or reformat this function to
match project style (e.g., consistent quotes, spacing, and blank-line rules) and
re-commit the formatted result. Specifically ensure the formatOutput
implementation (references: formatOutput, isValidFormat, VALID_FORMATS,
sections, generateCrontab, generateLaunchd, generateSystemd) is formatted by the
repo's formatter so CI no longer rejects the file.
- Around line 74-107: The current generateLaunchd output only installs a single
"sync" job; update the generator to either (A) produce one launchd plist per
scheduled task by iterating SCHEDULE_ENTRIES and emitting a plist with the
proper Label and ProgramArguments for each entry (use the SCHEDULE_ENTRIES
symbol and generateLaunchd as the location to change), or (B) make the output
and docs explicitly say "sync-only example" by renaming labels/strings and
comments in generateLaunchd; apply the same change to the systemd generator (the
corresponding function that emits unit files referenced around lines 109-139) so
systemd and launchd behave consistently. Ensure each generated plist/unit uses
the entry's command/name for Label and ProgramArguments and maps timing to
StartInterval (or the unit's timer) accordingly.
In `@docs/integration-guide.md`:
- Around line 393-395: The fenced code block containing the sequence "sync →
status → evolve --sync-first → watch --sync-first" needs a language tag to
satisfy markdownlint; edit the opening fence from ``` to ```text so the block is
labeled as plain text (i.e., change the fence that contains "sync → status →
evolve --sync-first → watch --sync-first" to start with ```text).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 60b7692e-5d02-4c18-8793-0a144eb271a4
📒 Files selected for processing (7)
cli/selftune/cron/setup.tscli/selftune/index.tscli/selftune/schedule.tsdocs/integration-guide.mdskill/Workflows/Cron.mdskill/Workflows/Schedule.mdtests/schedule/schedule.test.ts
…tors and formatting Derive SCHEDULE_ENTRIES from DEFAULT_CRON_JOBS (single source of truth), generate launchd/systemd configs for all 4 entries instead of sync-only, fix biome formatting, and add markdown language tag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cli/selftune/schedule.ts`:
- Around line 106-147: The launchd generator currently drops chained commands by
taking only the last segment (in generateLaunchd) — change the ProgramArguments
creation to detect if entry.command contains shell operators like && (and
similarly update the systemd generator around the code that builds ExecStart)
and, when present, emit a shell wrapper (e.g., ProgramArguments:
["/bin/sh","-c","<full command>"] for generateLaunchd and ExecStart=/bin/sh -c
"<full command>" for systemd) instead of splitting by spaces and using .pop();
alternatively, if you intend to rely on a separate sync job, add a clear comment
in the generated plist output stating the dependency on the separate sync
schedule.
- Around line 56-84: cronToInterval currently returns a numeric StartInterval
for all cron patterns, which silently misrepresents fixed-time schedules; modify
cronToInterval to detect fixed-calendar crons (e.g. "0 8 * * *", "0 3 * * 0",
any expression with specific minute/hour/day fields) and return null (change
signature to number | null) to signal "not representable as StartInterval", and
adjust callers to use a launchd StartCalendarInterval instead when
cronToInterval returns null; also improve cronToOnCalendar mappings in
cronToOnCalendar for those fixed patterns (use full timestamp syntax like "*-*-*
08:00:00" and include weekday for weekly crons) so systemd OnCalendar and the
launchd StartCalendarInterval can be generated correctly rather than
approximating with an interval.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 460503e0-01e4-43bb-895c-d4292b22f724
📒 Files selected for processing (4)
cli/selftune/index.tscli/selftune/schedule.tsdocs/integration-guide.mdtests/schedule/schedule.test.ts
…ers for chained commands - launchd: use StartCalendarInterval (Hour/Minute/Weekday) for fixed-time schedules instead of approximating with StartInterval - launchd/systemd: use /bin/sh -c wrapper for commands with && chains so prerequisite steps (like sync) are not silently dropped Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Make selftune's automation story generic and agent-agnostic. The primary path is now
selftune schedule, which generates ready-to-use snippets for system cron, macOS launchd, and Linux systemd timers.selftune cronis repositioned as an optional OpenClaw integration rather than the main automation path.Changes
selftune schedulecommand: Generates scheduling snippets for cron, launchd, and systemd with--formatfilteringThe core automation loop (sync → status → evolve --sync-first → watch --sync-first) is now runnable on any machine with standard system tools.