Conversation
899a7d0 to
9513ea6
Compare
|
|
||
| installHourlyGitSyncScript({ fs, openclawDir: OPENCLAW_DIR }); | ||
| await installHourlyGitSyncCron({ fs, openclawDir: OPENCLAW_DIR }); | ||
| await installHourlyGitSyncCron({ |
There was a problem hiding this comment.
On macOS, the managed scheduler only starts during process startup in bin/alphaclaw.js when the sync script already exists. In a fresh onboarding flow, we create the script/config here, but never start the scheduler in-process afterward, so hourly sync will not run until the service restarts. Can we start the managed scheduler after successful cron config install on darwin (or have installHourlyGitSyncCron do that) so onboarding is immediately effective?
There was a problem hiding this comment.
Hello, I wanted to contribute MacOS porting patches, but I found open PR's here, so i rebased on top of those first.
Fixed in 2d3cd2c:
fresh macOS onboarding installs the cron config and script but never
starts the in-process managed scheduler, so hourly sync would not run
until the next service restart.
Fix: call startManagedScheduler() in installHourlyGitSyncCron() after a
successful install. startManagedScheduler() is a no-op on Linux
(normalizeCronPlatform guard), so the linux/docker path is unchanged.
There was a problem hiding this comment.
Fixed in 2d3cd2c. Added startManagedScheduler({ fs, openclawDir, platform }) inside installHourlyGitSyncCron() (lib/server/onboarding/cron.js) after status.installed returns true. Placed the call in onboarding/cron.js rather than onboarding/index.js so the responsibility stays with the cron module — per your suggestion. startManagedScheduler has its own normalizeCronPlatform !== "darwin" guard so the linux/docker path is unchanged.
| const normalizeCronPlatform = (platform = os.platform()) => | ||
| platform === "darwin" ? "darwin" : "linux"; | ||
|
|
||
| const isValidCronSchedule = (value) => |
There was a problem hiding this comment.
isValidCronSchedule currently accepts any 5-token expression, but the managed scheduler matcher below only supports numeric tokens (*, ranges, steps, comma lists). Schedules like 0 9 * * MON will be accepted/saved but can never match on macOS, so sync silently never runs. Can we either tighten validation to supported syntax or add parser support for named day/month tokens?
There was a problem hiding this comment.
Hello, I wanted to contribute MacOS porting patches, but I found open PR's here, so i rebased on top of those first.
Fixed in 2d3cd2c:
isValidCronSchedule() accepted any 5-token expression including named
weekday/month tokens (MON, SUN, JAN, etc.).
The managed scheduler parser uses Number.parseInt() which returns NaN
for named tokens, causing cronMatchesDate() to always return false,
sync silently never runs.
Fix: tighten validation to numeric tokens only (digits, *, -, /, comma).
Named tokens are now rejected at save time rather than silently failing at runtime.
There was a problem hiding this comment.
Fixed in 2d3cd2c. Tightened isValidCronSchedule to reject any token containing letters — each field must now match [\d,*/\-]+. Named tokens like 0 9 * * MON are rejected at save time rather than accepted and silently failing at runtime. Parser support for named tokens would require a translation table (MON→1, etc.) and feels out of scope here — the validation fix is the safer boundary. If named token support is wanted later it can be added independently.
chrysb
left a comment
There was a problem hiding this comment.
Great direction overall on macOS support and shared cron plumbing. I'm requesting changes for two blockers:
- On fresh macOS onboarding, the managed scheduler is not started after cron/script install, so hourly sync does not run until a restart.
- Cron validation accepts schedules the managed parser cannot execute (e.g. named weekdays), which can silently disable sync on macOS.
I left inline comments on both code paths with suggested fixes.
|
I opened a new PR: #63 Targeting: https://github.com/chrysb/alphaclaw/tree/pr-4-macos Thanks! |
Summary
/etc/cron.dwhile macOS runs the saved five-field cron schedule from AlphaClaw's managed in-process schedulergogand shim binaries into AlphaClaw's managed internal bin on macOS instead of assuming/usr/local/binALPHACLAW_ROOT_DIRandPORTare resolved before server constants are imported, which makes local macOS roots and ports behave correctlyTesting
npm test -- tests/server/routes-system.test.js tests/server/routes-onboarding.test.jsnode bin/alphaclaw.js --root-dir /tmp/alphaclaw-live-test startagainst an existing local.openclawon macOS