fix: address review findings in plugin sync PR

- OpenClaw schedule_cmd: pass project as required positional arg
- OpenClaw schedule_cmd/unschedule_cmd: unpack Tuple[bool, str] return
- OpenClaw schedule_cmd: propagate failure status (return 1 on not ok)
- OpenClaw unschedule_cmd: pass project to avoid silent no-op
- OpenClaw --minute default: 17 (consistent with engine and MCP)
- harvest.py: move datetime import to module level

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
carpedkm
2026-06-20 12:04:07 +00:00
parent 0be780052a
commit 7d36b1d592
2 changed files with 10 additions and 8 deletions
+9 -7
View File
@@ -214,9 +214,10 @@ def schedule_cmd(hour: int, minute: int) -> int:
except ImportError: except ImportError:
print("ERROR: skillopt_sleep.scheduler not available — is SkillOpt-Sleep installed?") print("ERROR: skillopt_sleep.scheduler not available — is SkillOpt-Sleep installed?")
return 1 return 1
result = schedule(hour=hour, minute=minute) project = str(SKILL_DIR)
print(result) ok, msg = schedule(project, hour=hour, minute=minute)
return 0 print(msg)
return 0 if ok else 1
def unschedule_cmd(all_projects: bool) -> int: def unschedule_cmd(all_projects: bool) -> int:
@@ -226,9 +227,10 @@ def unschedule_cmd(all_projects: bool) -> int:
except ImportError: except ImportError:
print("ERROR: skillopt_sleep.scheduler not available — is SkillOpt-Sleep installed?") print("ERROR: skillopt_sleep.scheduler not available — is SkillOpt-Sleep installed?")
return 1 return 1
result = unschedule(all_projects=all_projects) project = str(SKILL_DIR)
print(result) ok, msg = unschedule(project, all_projects=all_projects)
return 0 print(msg)
return 0 if ok else 1
def cost() -> int: def cost() -> int:
@@ -291,7 +293,7 @@ def main():
sub.add_parser("cost", help="estimate cost") sub.add_parser("cost", help="estimate cost")
p_schedule = sub.add_parser("schedule", help="install nightly cron entry") p_schedule = sub.add_parser("schedule", help="install nightly cron entry")
p_schedule.add_argument("--hour", type=int, default=3, help="hour (0-23)") p_schedule.add_argument("--hour", type=int, default=3, help="hour (0-23)")
p_schedule.add_argument("--minute", type=int, default=0, help="minute (0-59)") p_schedule.add_argument("--minute", type=int, default=17, help="minute (0-59)")
p_unschedule = sub.add_parser("unschedule", help="remove cron entry") p_unschedule = sub.add_parser("unschedule", help="remove cron entry")
p_unschedule.add_argument("--all", dest="all_projects", action="store_true", p_unschedule.add_argument("--all", dest="all_projects", action="store_true",
help="remove entries for all projects") help="remove entries for all projects")
+1 -1
View File
@@ -17,6 +17,7 @@ from __future__ import annotations
import json import json
import os import os
from datetime import datetime
from typing import Any, Dict, Iterable, List, Optional from typing import Any, Dict, Iterable, List, Optional
from skillopt_sleep.types import SessionDigest from skillopt_sleep.types import SessionDigest
@@ -150,7 +151,6 @@ def _is_headless_replay(digest: "SessionDigest") -> bool:
# Sub-3-second single-turn sessions are almost certainly programmatic. # Sub-3-second single-turn sessions are almost certainly programmatic.
if digest.started_at and digest.ended_at: if digest.started_at and digest.ended_at:
try: try:
from datetime import datetime
fmt = "%Y-%m-%dT%H:%M:%S" fmt = "%Y-%m-%dT%H:%M:%S"
start = datetime.strptime(digest.started_at[:19], fmt) start = datetime.strptime(digest.started_at[:19], fmt)
end = datetime.strptime(digest.ended_at[:19], fmt) end = datetime.strptime(digest.ended_at[:19], fmt)