fix(wake-briefing): add freshness stamp, staleness guard, honest hourly wording#2871
Merged
Conversation
…hourly wording Issue #2868: WAKE.md carried no composed-at timestamp and no self-staleness guard. When recomposition halted (feature disabled, cron wedged), every consumer silently trusted fossil data — in production the file froze for 15 days while still claiming 'last 24h', causing a false alarm. - Add a machine+human-readable generated_at (UTC) line to the rendered WAKE.md so any reader can see the digest age at a glance. - Self-staleness guard: thread file mtime through the datamachine_memory_file_content filter (backward-compatible 4th param) and prepend a visible '⚠ This briefing is N hours old' warning when the on-disk file is older than the rolling window. The guard is registered by WakeBriefingTask::registerStalenessGuard() and targets only WAKE.md by filename — no impact on other memory files. Issue #2869: The class docblock claimed 'recomputed from the current time on every run' and the rendered header injected '(recomputed each session; not personal to one session)' into every session context. Neither is true — the only trigger is the hourly Action Scheduler schedule. Rewrote both to describe the hourly reality honestly while keeping the accurate stateless-rolling-window and not-personal-to-one-session claims. Closes #2868, closes #2869
Contributor
Homeboy Results —
|
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.
Summary
Fixes two WAKE.md freshness bugs in one PR — both edit
WakeBriefingTask.php, so they must land together.Closes #2868, closes #2869.
Issue #2868 — no freshness stamp / no self-staleness guard
Problem: WAKE.md is injected into every agent session as "what changed in the last 24h" but carried NO composed-at timestamp and no self-staleness guard. When recomposition halted (feature disabled, cron wedged), every consumer silently trusted fossil data. In production the file froze for 15 days while still claiming "last 24h", causing a false alarm about a healthy task.
What changed:
generated_atstamp inrender(): The rendered WAKE.md header now includes a machine+human-readable_Generated at YYYY-MM-DD HH:MM UTC._line. Any reader can see the digest age at a glance. This stamp is baked into the file at composition time.Self-staleness guard at injection time: If the on-disk WAKE.md is older than the rolling window (mtime >
window_hoursago), a leading warning is prepended:The guard is implemented as a
datamachine_memory_file_contentfilter callback (WakeBriefingTask::applyStalenessGuard()), registered fromWakeBriefingTask::registerStalenessGuard()called inSystemAgentServiceProvider::__construct(). It targets onlyWAKE.mdby filename — zero impact on other memory files.Filter plumbing (
CoreMemoryFilesDirective.php): The file'supdated_at(mtime, already populated by the store fromfilemtime()) is now threaded throughnormalize_for_injection()as a backward-compatible 4th argument to thedatamachine_memory_file_contentfilter. This is the only change to the generic directive layer — purely additive, existing 3-arg callbacks are unaffected.Issue #2869 — docblock + header claim "recomputed each session" but only hourly cron triggers it
Decision: OPTION B (honest hourly wording). No session-start hook wired.
What changed:
Class docblock (L12-19): Was "recomputed from the current time on every run." Now: "recomputed hourly via Action Scheduler (see SystemAgentServiceProvider, schedule interval=hourly) — not per session." The stateless-rolling-window rationale is kept intact.
Rendered header (
render()~L335): Was:Now:
Dropped "recomputed each session." Kept the accurate "not personal to one session" and the rolling-window claim. Matches the actual
window_hoursvalue thatrender()already receives.Files changed
inc/Engine/AI/System/Tasks/WakeBriefingTask.phpgenerated_atstamp + staleness guard methods (#2868)inc/Engine/AI/Directives/CoreMemoryFilesDirective.phpupdated_atintodatamachine_memory_file_contentfilter (#2868)inc/Engine/AI/System/SystemAgentServiceProvider.phpVerification
inc/Core/Admin/shared/utils/api.js(not touched by this PR)Layer purity
The staleness guard logic lives on
WakeBriefingTask(the class that owns WAKE.md semantics), not in the generic directive. The generic layer change is limited to threading an already-availableupdated_atvalue through an existing filter — no WAKE-specific knowledge inCoreMemoryFilesDirective.