Skip to content

macOS crontab sync fails with Operation not permitted, leaving heartbeat schedule stale #150

Description

@metatrinity8

Summary

On macOS, agent-manager can render the correct heartbeat/schedule crontab preview, but applying it fails because the system crontab command cannot write its temporary file and exits with Operation not permitted.

This blocks updating the actual installed heartbeat frequency even when the desired agent config is already correct.

Environment

  • Repo: fractalmind-ai/agent-manager-skill
  • Host: macOS
  • Workspace desired heartbeat: */10 * * * *
  • Actual installed crontab heartbeat remained: */30 * * * *

Expected

Running either:

  • python3 .agent/skills/agent-manager/scripts/main.py heartbeat sync
  • python3 .agent/skills/agent-manager/scripts/main.py schedule sync

should update the user crontab to the rendered schedule.

Actual

Preview is correct, but apply fails.

Desired preview includes

  • # daily-yesterday-work-report
  • # heartbeat [HB]
  • */10 * * * * ... heartbeat run main --timeout 8m

Actual crontab still shows

# heartbeat [HB]
*/30 * * * * cd /Users/Sulabs005/oh-my-fractalbot && mkdir -p /Users/Sulabs005/oh-my-fractalbot/.crontab_logs && python3 /Users/Sulabs005/oh-my-fractalbot/.agent/skills/agent-manager/scripts/main.py start main --restore && python3 /Users/Sulabs005/oh-my-fractalbot/.agent/skills/agent-manager/scripts/main.py heartbeat run main --timeout 8m >> /Users/Sulabs005/oh-my-fractalbot/.crontab_logs/agent-main-heartbeat.log 2>&1

Attempts tried

1) agent-manager sync dry run

Command:

python3 .agent/skills/agent-manager/scripts/main.py heartbeat sync --dry-run

Result:

  • Preview rendered correctly with */10
  • Confirms generation logic is not the problem

2) agent-manager sync apply

Command:

python3 .agent/skills/agent-manager/scripts/main.py heartbeat sync

Result:

❌ Failed to sync crontab

3) direct stdin crontab write

Command:

crontab - < /tmp/agent-manager-crontab-preview.txt

Result:

crontab: tmp/tmp.33353: Operation not permitted

4) direct file crontab write

Command:

crontab /tmp/agent-manager-crontab.txt

Result:

crontab: tmp/tmp.34324: Operation not permitted

Notes

  • A stdin-based compatibility change was already merged in fix: use stdin when syncing crontab #148, but this environment still fails because the macOS crontab implementation appears to create an internal temp file anyway.
  • So the remaining problem is no longer schedule rendering; it is OS-level crontab write failure on this machine.

Impact

  • Desired heartbeat/schedule config can diverge from the actually installed crontab
  • Auto frequency changes (for example */30 -> */10) cannot be applied reliably
  • Users may think heartbeat frequency changed when the real scheduler did not

Current workaround used locally

A per-user LaunchAgent was installed as a workaround to run the main heartbeat every 600 seconds, while the old crontab entry remains at */30.

That restores effective 10-minute scheduling for this machine, but it does not solve crontab sync itself.

Suggested follow-ups

  • Detect and surface this macOS failure mode more explicitly in CLI output
  • Consider a first-class launchd/LaunchAgent backend for macOS scheduling
  • Persist and show “desired schedule vs installed schedule” drift more prominently

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions