From 01075c90d36fa8973e5342ce0165def490cf5753 Mon Sep 17 00:00:00 2001 From: carpedkm Date: Sat, 20 Jun 2026 14:21:18 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20address=20codex=20round=202=20=E2=80=94?= =?UTF-8?q?=20revert=20harvest=20break=20+=20allow=20lookback=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - harvest.py: revert break to continue — mtime ordering can diverge from embedded ended_at timestamps (copy/touch), so we must check all files rather than early-exiting on the first old one - cycle.py: use `is not None and > 0` so lookback_hours=0 means "scan full history" (opt-out of the cutoff) - __main__.py: propagate --lookback-hours 0 to config as explicit 0 Co-Authored-By: Claude Fable 5 --- skillopt_sleep/__main__.py | 4 +++- skillopt_sleep/cycle.py | 2 +- skillopt_sleep/harvest.py | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) 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