Repository navigation
fix(memory): stop background scoring from resetting core_memory.updated_at - #184
Merged
Merged
Conversation
…ed_at `updated_at` is the age that `lifecycle.forgetting.decay` reads and that the archive cutoff compares against. Two background paths stamped it with `now` on every score change, so a rescored or frequently recalled row looked freshly written forever: it never aged, never decayed and never archived, while the scheduler's own candidate filter (`updated_at > now - only_recent_days`) kept handing it back. Measured on the live bases before the fix: Hermes had 94 rows older than 60 days by `created_at` that read as younger than 30 by `updated_at` (634 of 973 rows had been touched within a day). Both writers now update `importance` only: - `lifecycle/importance_scheduler.py::_rescore_user` (periodic sweep) - `features/replay.py::cls_replay` (nightly hook, recall boost) The rescore time is already recorded in `importance_audit.rescored_at`, which is where it belongs. `features/quality.py::record_feedback` keeps writing `updated_at` on purpose: it is reachable only from the interactive `memory_quality` tool, not from a timer, and an explicit feedback action really does touch the row. Rows that previously never aged will now age and become archivable. That is the fix, not a side effect: `created_at` is untouched and no data is lost.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что
core_memory.updated_at— это возраст строки: по немуlifecycle/forgetting.pyсчитает дни для затухания и сравнивает с cutoff архива. Два фоновых пути штамповали егоnowпри каждом изменении оценки, поэтому пересчитанная или часто вспоминаемая строка выглядела вечно свежей: не старела, не затухала, не архивировалась. А фильтр кандидатов свипа (updated_at > now - only_recent_days) снова и снова возвращал её на пересчёт.Измерено на живых базах до фикса: в Hermes 94 строки старше 60 дней по
created_atчитались как моложе 30 поupdated_at(всего 634 из 973 строк имелиupdated_atсвежее суток).updated_atсвежее сутокcreated_at, но моложе 30 поupdated_atФикс
Обе фоновые ветки обновляют только
importance:lifecycle/importance_scheduler.py::_rescore_user— периодический свип;features/replay.py::cls_replay— ночной хук (hooks/user_hooks.py:90-91), буст заrecall_useful.Время пересчёта уже пишется в
importance_audit.rescored_at— там ему и место.features/quality.py::record_feedbackсознательно оставлен пишущимupdated_at: он достижим только из интерактивного инструментаmemory_quality, не из таймера, и явное действие действительно означает «строку только что тронули».Полный перебор всех писателей
core_memory.updated_atв репозитории: фоновых таймеров после правки не осталось.Радиус
Строки, которые раньше не старели, начнут стареть и попадут в архив. Это цель, а не побочный эффект:
created_atцел, данные не теряются, строка просто перестаёт считаться свежей.Проверка
cls_replay), который я пропустила, — исправлен здесь же. Второй прогон: 14/14 PASS, регрессий нет (83 теста поquality/blame/branches/compact/forgetting/diagnostics), поведение доказано на живом archive-lookup с контрольной рукой.Вне объёма
F42 (
created_atrefresh вgraph_miners._insert_edge) — отдельный пакет: нужно решить, что NREM считает жизнью ребра (created_atкак рождение противlast_evidence), а это меняет семантику ночного прохода.