iai-personal-memory-engine icon indicating copy to clipboard operation
iai-personal-memory-engine copied to clipboard

should_bootstrap_trigger is defined and imported but never called

Open tom-shields-stitch opened this issue 3 months ago • 1 comments

What happens

quiet_window.py has a complete, already-tested bootstrap fallback: should_bootstrap_trigger() returns True after BOOTSTRAP_IDLE_HOURS (2h) of inactivity, meant to cover a fresh install for the MIN_DAYS_FOR_LEARN (7-day) window before the presence-based quiet-window learner has enough history to run.

It's imported into daemon/__init__.py:

from iai_mcp.quiet_window import (
    ...
    should_bootstrap_trigger,
    ...
)

but grepping the whole package for should_bootstrap_trigger( turns up only its own definition — nothing ever calls it.

Effect

A fresh install's automatic nightly consolidation depends entirely on the fixed night-default window (2-6am local, from effective_consolidation_window's fallback) landing on a stretch where the daemon happens to be running continuously with genuine idle time — with no faster path available during the whole first week. In practice (verified on a real 5-day-old install with heavy multi-session usage) this meant zero automatic consolidation had ever run: lifecycle status showed WAKE for 5 straight days across multiple daemon restarts, and events_query for trajectory events returned empty.

Fix

PR incoming: wire the check into _in_consolidation_window (the gate _may_enter_sleep actually consults) — before a quiet window has been learned, check should_bootstrap_trigger against the lifecycle state's last_activity_ts before falling through to the fixed-window check.

tom-shields-stitch avatar Aug 11 '26 09:08 tom-shields-stitch

Fixed in 3.0.2 — should_bootstrap_trigger is gone from the source; it was removed as a dead path rather than given a caller. Thanks for catching it — you're credited in the 3.0.2 changelog for the dead-path finds.

CodeAbra avatar Aug 16 '26 21:08 CodeAbra