SkillOpt icon indicating copy to clipboard operation
SkillOpt copied to clipboard

schedule: --scope is silently dropped from the generated cron entry

Open vrdr58 opened this issue 2 weeks ago • 0 comments

What happened

Running:

python -m skillopt_sleep schedule --project /path/to/project --hour 6 --minute 30 --scope all --backend claude

installs a cron entry that does not contain --scope all. The generated line always omits --scope entirely, so the scheduled run falls back to its own default (invoked) regardless of what was passed to schedule.

Where

skillopt_sleep/__main__.py, cmd_schedule (currently lines 835-841 on commit 6ee29a0):

def cmd_schedule(args) -> int:
    from skillopt_sleep.scheduler import list_scheduled, schedule
    cfg = _cfg_from_args(args)
    project = cfg.get("invoked_project") or os.getcwd()
    ok, msg = schedule(project, backend=cfg.get("backend", "mock"),
                       hour=args.hour, minute=args.minute,
                       extra=("--auto-adopt" if getattr(args, "auto_adopt", False) else ""))

extra only ever carries --auto-adopt. cfg.get("scope") (and any other run-forwardable flag the schedule parser accepts via _add_common, e.g. --lookback-hours, --max-tasks, --edit-budget, --preferences) is parsed by argparse but never threaded into the cron command string built by scheduler.schedule() / _runner_cmd().

Impact

Anyone using --scope all to intentionally schedule a cross-project nightly harvest silently gets --scope invoked instead — a correctness bug, and in the opposite direction also a quiet widening-of-scope risk if the defaults ever change. Since schedule is meant to configure an unattended background job, a flag that's accepted but discarded without warning is easy to miss.

Suggested fix

In cmd_schedule, forward --scope (and ideally the other common flags accepted by the schedule subparser) into extra/runner_cmd, the same way --auto-adopt is handled now. At minimum, warn at schedule-time if a flag accepted by the parser isn't actually represented in the installed cron line.

Repro

git clone https://github.com/microsoft/SkillOpt
cd SkillOpt
python -m skillopt_sleep schedule --project "$(pwd)" --hour 6 --minute 30 --scope all --backend claude
crontab -l   # inspect the installed line — no --scope flag present

vrdr58 avatar Nov 12 '26 05:11 vrdr58