pi-sleep-agent 0.8.20 → 0.8.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -163,7 +163,7 @@ entries, and backs up JSON/TOML files before changing them. It is one Python
163
163
  script and works on macOS, Linux, and Windows; per-platform scheduling is chosen
164
164
  automatically:
165
165
 
166
- - **macOS** - a LaunchAgent (`~/Library/LaunchAgents/com.aydinnyunus.sleep-nightly.plist`).
166
+ - **macOS** - a LaunchAgent (`~/Library/LaunchAgents/com.aydinnyunus.sleep-nightly.plist`), registered with `launchctl bootstrap` and read back with `launchctl print`, so an install that launchd did not take says so instead of printing "loaded".
167
167
  - **Linux** - a cron job (`crontab -l`, kept inside owned `# BEGIN/END aydinnyunus-sleep-nightly` markers).
168
168
  - **Windows** - a Task Scheduler task via `schtasks /create /tn aydinnyunus-sleep-nightly`.
169
169
 
package/docs/EVIDENCE.md CHANGED
@@ -636,3 +636,65 @@ Pinned by `tests/test_core.py::T` (`test_urgency_weights_come_from_the_table_and
636
636
  `test_every_weight_the_doctor_can_emit_is_a_known_row`,
637
637
  `test_urgency_waives_the_interval_but_never_the_record_floor`,
638
638
  `test_run_sleep_reports_why_it_ran_early`).
639
+
640
+
641
+ ## 2026-11-05: a scheduled pass that was never scheduled
642
+
643
+ The nightly pass existed, was installed, and had not run for two nights. The plist was
644
+ present (`~/Library/LaunchAgents/com.aydinnyunus.sleep-nightly.plist`, mtime 2026-11-01
645
+ 21:44, `StartCalendarInterval` 03:41, `RunAtLoad` true) and `launchctl list` did not
646
+ carry its label at all. `nightly.log` held exactly two records, `2026-11-01T03:41:05`
647
+ and `2026-11-01T21:44:57`; nothing on 11-02, 11-03, 11-04 or 11-05.
648
+
649
+ Measured (before the change):
650
+
651
+ $ launchctl list | grep aydinnyunus
652
+ - 0 com.aydinnyunus.claude-curator
653
+ $ launchctl print gui/502/com.aydinnyunus.sleep-nightly
654
+ Could not find service ... in domain for user gui: 502
655
+ $ launchctl print-disabled gui/502 | grep sleep
656
+ (nothing)
657
+
658
+ The job was not disabled, it was never registered. `tools/install.py` registered it with
659
+ `launchctl load <path>`, which exits 0 in a case where launchd holds no job: the install
660
+ printed "loaded" and the schedule was inert. A silent install failure is the worst shape
661
+ here, because the only symptom is a night with no output, and a night with no
662
+ consolidation looks exactly like a night where nothing needed consolidating.
663
+
664
+ The loader now uses `launchctl bootstrap gui/<uid> <path>` and then reads the job back
665
+ with `launchctl print`; `enable` is called after `bootstrap` so a label a previous run
666
+ disabled cannot stay disabled across an install; `bootout` runs first because `bootstrap`
667
+ is not idempotent (EEXIST over a loaded label). The uninstall side now `bootout`s by
668
+ label as well as `unload`ing by path.
669
+
670
+ Measured (after the change, on this machine, `load_launchd()` called directly):
671
+
672
+ load_launchd before: False
673
+ load_launchd -> True
674
+ load_launchd after: True
675
+
676
+ $ launchctl print gui/502/com.aydinnyunus.sleep-nightly
677
+ path = /Users/yunus.aydin/Library/LaunchAgents/com.aydinnyunus.sleep-nightly.plist
678
+ state = not running
679
+ runs = 1
680
+ last exit code = 0
681
+
682
+ `runs = 1` and `last exit code = 0` are the `RunAtLoad` fire, and it wrote a record into
683
+ `nightly.log` while this was being measured:
684
+
685
+ "ts": "2026-11-05T23:59:24+0300"
686
+ "sleep": {"action": "skipped", "buffer_records": 1,
687
+ "gate": {"min_interval_hours": 0.0, "min_records": 2, "min_urgency": 2.0,
688
+ "urgency": 1,
689
+ "urgency_detail": "quarantine-awaiting-review (+1; quarantine-awaiting-review x1)"},
690
+ "reason": "buffer has 1 record(s), needs 2"}
691
+
692
+ Two things land in that line: the schedule runs now, and the 0.8.20 gate carries its
693
+ reason into the unattended report (`urgency 1` is below `min_urgency 2`, and the record
694
+ floor refuses regardless).
695
+
696
+ Pinned by `tests/test_cli.py::InstallUninstall`
697
+ (`test_mac_scheduler_bootstraps_the_agent_and_reads_it_back`,
698
+ `test_mac_scheduler_reports_a_bootstrap_that_registers_nothing`). The fakes hold jobs in
699
+ a state file, so the read-back is a real second call and not a restatement of the first,
700
+ and the second test fails if "loaded" is ever printed on the strength of an exit code.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-sleep-agent",
3
- "version": "0.8.20",
3
+ "version": "0.8.21",
4
4
  "description": "A reviewable sleep and dream cycle for Pi agent memory.",
5
5
  "type": "module",
6
6
  "license": "MIT",