diff --git a/skillopt_sleep/__main__.py b/skillopt_sleep/__main__.py index 78f22f3..3a3e047 100644 --- a/skillopt_sleep/__main__.py +++ b/skillopt_sleep/__main__.py @@ -111,8 +111,10 @@ def _cfg_from_args(args, task_meta: Dict[str, Any] | None = None) -> Any: overrides["codex_home"] = os.path.abspath(args.codex_home) if getattr(args, "source", ""): overrides["transcript_source"] = args.source - if getattr(args, "lookback_hours", 0): + if getattr(args, "lookback_hours", None) is not None and args.lookback_hours != 0: overrides["lookback_hours"] = args.lookback_hours + elif getattr(args, "lookback_hours", None) == 0: + overrides["lookback_hours"] = 0 # explicit opt-out: scan full history if getattr(args, "edit_budget", 0): overrides["edit_budget"] = args.edit_budget if getattr(args, "max_sessions", 0): diff --git a/skillopt_sleep/cycle.py b/skillopt_sleep/cycle.py index 9375784..57b06a9 100644 --- a/skillopt_sleep/cycle.py +++ b/skillopt_sleep/cycle.py @@ -148,7 +148,7 @@ def run_sleep_cycle( # scan the entire transcript history and trigger massive LLM mining. if since is None: lookback_hours = cfg.get("lookback_hours", 72) - if lookback_hours and lookback_hours > 0: + if lookback_hours is not None and lookback_hours > 0: import time ref_time = clock if clock is not None else time.time() cutoff = ref_time - lookback_hours * 3600 diff --git a/skillopt_sleep/harvest.py b/skillopt_sleep/harvest.py index 84446f8..851e5f1 100644 --- a/skillopt_sleep/harvest.py +++ b/skillopt_sleep/harvest.py @@ -294,9 +294,10 @@ def harvest( if not _project_matches(d.project or "", scope, invoked_project): continue if since_iso and d.ended_at and d.ended_at < since_iso: - # Files are sorted newest-first by mtime; once we see one that - # is older than the cutoff, all remaining files are older too. - break + # Note: files are sorted by mtime but we compare the embedded + # ended_at timestamp — mtime can diverge (copy/touch), so we + # cannot break here; we must continue to check all files. + continue digests.append(d) if limit and len(digests) >= limit: break