From 7d36b1d59224218df7d8d39db41014110c309d1f Mon Sep 17 00:00:00 2001 From: carpedkm Date: Sat, 20 Jun 2026 12:04:07 +0000 Subject: [PATCH] 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 --- plugins/openclaw/slash_sleep.py | 16 +++++++++------- skillopt_sleep/harvest.py | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/openclaw/slash_sleep.py b/plugins/openclaw/slash_sleep.py index 09c7486..a09c500 100755 --- a/plugins/openclaw/slash_sleep.py +++ b/plugins/openclaw/slash_sleep.py @@ -214,9 +214,10 @@ def schedule_cmd(hour: int, minute: int) -> int: except ImportError: print("ERROR: skillopt_sleep.scheduler not available — is SkillOpt-Sleep installed?") return 1 - result = schedule(hour=hour, minute=minute) - print(result) - return 0 + project = str(SKILL_DIR) + ok, msg = schedule(project, hour=hour, minute=minute) + print(msg) + return 0 if ok else 1 def unschedule_cmd(all_projects: bool) -> int: @@ -226,9 +227,10 @@ def unschedule_cmd(all_projects: bool) -> int: except ImportError: print("ERROR: skillopt_sleep.scheduler not available — is SkillOpt-Sleep installed?") return 1 - result = unschedule(all_projects=all_projects) - print(result) - return 0 + project = str(SKILL_DIR) + ok, msg = unschedule(project, all_projects=all_projects) + print(msg) + return 0 if ok else 1 def cost() -> int: @@ -291,7 +293,7 @@ def main(): sub.add_parser("cost", help="estimate cost") 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("--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.add_argument("--all", dest="all_projects", action="store_true", help="remove entries for all projects") diff --git a/skillopt_sleep/harvest.py b/skillopt_sleep/harvest.py index 4086717..c971d8c 100644 --- a/skillopt_sleep/harvest.py +++ b/skillopt_sleep/harvest.py @@ -17,6 +17,7 @@ from __future__ import annotations import json import os +from datetime import datetime from typing import Any, Dict, Iterable, List, Optional 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. if digest.started_at and digest.ended_at: try: - from datetime import datetime fmt = "%Y-%m-%dT%H:%M:%S" start = datetime.strptime(digest.started_at[:19], fmt) end = datetime.strptime(digest.ended_at[:19], fmt)