Repository navigation
Run model-sync and deriver as systemd --user timers on Linux - #2815
Heretic-tripto wants to merge 2 commits into
Conversation
Both nightly jobs were macOS-only. On Linux InstallModelSync.ts failed at launchctl, and manage-deriver.sh exited 0 with "macOS only. Skipping", so Services reported the deriver as installed when nothing was scheduled. - InstallModelSync.ts: add a Linux branch on lib/SystemdUser (same shape as InstallHealthSync). Schedule matches the plist: daily 05:10. - InstallDeriverSystemd.ts (new): systemd --user timer for the deriver, daily 03:00, same command as the launchd plist. - manage-deriver.sh: delegate install/uninstall/status to the systemd installer on non-Darwin hosts. macOS path unchanged. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CNVp6Ee6Tan1v5P3HENTHB
isihussain
left a comment
There was a problem hiding this comment.
Code Review: Multi-Axis Evaluation
Thank you @Heretic-tripto for expanding Linux support! Providing first-class systemd --user unit and timer automation for the nightly deriver and model-sync brings much-needed parity with the macOS launchd automation.
1. Architecture & Systemd User Standards
- Leveraging Shared Infrastructure: Utilizing
lib/SystemdUser(which is already proven inInstallHealthSync.ts) ensures systemd unit and timer definitions adhere to standard XDG user directories (~/.config/systemd/user/) with clean calendar schedules (OnCalendarformat). - Schedule Parity: Matching the macOS launchd schedules (03:00 for the nightly deriver and 05:10 for model-sync) maintains synchronization consistency across heterogeneous operating systems.
- Immediate First Sync: In
InstallModelSync.ts, triggering an initial sync immediately following installation:gives the user immediate feedback and seeds initial model pricing data without requiring them to wait for the next scheduled timer event.const first = await sh([bunPath, lifeosPath("TOOLS", "ModelSync.ts"), "--sync"]);
2. Portability Consideration
- Claude Directory Path in Shell Wrapper:
- In
manage-deriver.sh:hardcodesexec "$BUN_PATH" "$HOME/.claude/LIFEOS/TOOLS/InstallDeriverSystemd.ts" "$1"
$HOME/.claude. - In contrast, the TypeScript tool itself uses
getClaudeDir()fromPaths.ts, which respects custom installation roots (such asCLAUDE_HOMEor symlinked workspaces). - Recommendation: Consider checking
${CLAUDE_HOME:-$HOME/.claude}inmanage-deriver.shto ensure consistency for users utilizing custom directory locations.
- In
3. Error Handling & Bun Resolution
- Explicit validation via
await systemd.which("bun")and throwing early with actionable guidance ("bun not found in PATH - install bun first") provides clean operational debugging if the daemon environment lacks user binary paths.
Summary: Well-structured Linux timer integration that mirrors macOS launchd behavior cleanly. LGTM!
The shell wrapper hardcoded $HOME/.claude. The TypeScript resolver reads CLAUDE_PLUGIN_ROOT, CLAUDE_CONFIG_DIR and LIFEOS_SKILLS_DIR, so the two could point at different roots. Resolving the installer from the script's own location follows whatever root the install lives in, without copying the resolver into bash. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CNVp6Ee6Tan1v5P3HENTHB
|
Thanks for the review. Applied the portability point in a follow-up commit. The suggested Checked: 🤖 Generated with Claude Code |
Problem
Two nightly jobs only run on macOS:
InstallModelSync.tscallslaunchctlunconditionally, so on Linux theinstall fails with
Executable not found in $PATH: "launchctl". In aServices.ts installrun this fails the core-services leg of the update.manage-deriver.shon Linux printsmacOS only. Skippingand exits 0, soServicesreports the deriver as installed while nothing is scheduled.Change
InstallModelSync.ts: Linux branch onlib/SystemdUser, same shape asInstallHealthSync. Schedule matches the plist (daily 05:10). macOS pathunchanged.
InstallDeriverSystemd.ts(new): systemd--usertimer for the deriver,daily 03:00, same command as the launchd plist.
manage-deriver.sh:install|uninstall|statusdelegate to the systemdinstaller on non-Darwin hosts. macOS path unchanged.
Testing
--user:InstallModelSync.tsandmanage-deriver.sh installboth reportactive · enabled, with the nextrun at the scheduled time. The model-sync first run completed.
bash -non the script andbun build --no-bundleparse on both TS files.--uninstallon Linux, and anything on macOS.🤖 Generated with Claude Code