Skip to content

fix(wake-briefing): add freshness stamp, staleness guard, honest hourly wording#2871

Merged
chubes4 merged 1 commit into
mainfrom
wake-briefing-freshness
Jul 11, 2026
Merged

fix(wake-briefing): add freshness stamp, staleness guard, honest hourly wording#2871
chubes4 merged 1 commit into
mainfrom
wake-briefing-freshness

Conversation

@chubes4

@chubes4 chubes4 commented Jul 11, 2026

Copy link
Copy Markdown
Member

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_at stamp in render(): 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_hours ago), a leading warning is prepended:

    This briefing is N hours old — recomposition may be stalled. The data below may be out of date.

    The guard is implemented as a datamachine_memory_file_content filter callback (WakeBriefingTask::applyStalenessGuard()), registered from WakeBriefingTask::registerStalenessGuard() called in SystemAgentServiceProvider::__construct(). It targets only WAKE.md by filename — zero impact on other memory files.

  • Filter plumbing (CoreMemoryFilesDirective.php): The file's updated_at (mtime, already populated by the store from filemtime()) is now threaded through normalize_for_injection() as a backward-compatible 4th argument to the datamachine_memory_file_content filter. 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:

    What changed in the last 24h across the network (recomputed each session; not personal to one session).

    Now:

    What changed in the last 24h across the network (recomposed hourly; a rolling 24h window; not personal to one session).

    Dropped "recomputed each session." Kept the accurate "not personal to one session" and the rolling-window claim. Matches the actual window_hours value that render() already receives.

Files changed

File Change
inc/Engine/AI/System/Tasks/WakeBriefingTask.php Docblock honesty (#2869); generated_at stamp + staleness guard methods (#2868)
inc/Engine/AI/Directives/CoreMemoryFilesDirective.php Thread updated_at into datamachine_memory_file_content filter (#2868)
inc/Engine/AI/System/SystemAgentServiceProvider.php Register staleness guard (#2868)

Verification

  • PHPCS: passed
  • PHPStan (level 7): passed
  • ESLint: 1 pre-existing warning in inc/Core/Admin/shared/utils/api.js (not touched by this PR)
  • Tests: could not run — WP Codebox recipe builder unavailable on this host (infrastructure, not code)

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-available updated_at value through an existing filter — no WAKE-specific knowledge in CoreMemoryFilesDirective.

…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
@homeboy-ci

homeboy-ci Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine

Lint

review lint — passed

ℹ️ Full options: homeboy self docs commands/lint
Deep dive: homeboy review lint data-machine --changed-since 361dcd9

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-review-lint-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-review-lint-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/29155584683

Test

review test — passed

ℹ️ No impacted tests found for --changed-since 361dcd9
ℹ️ Run full suite if needed: homeboy test data-machine
Deep dive: homeboy review test data-machine --changed-since 361dcd9

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-review-test-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-review-test-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/29155584683

Audit

review audit — passed

  • audit — 30 finding(s)
  • Total: 30 finding(s)

Deep dive: homeboy review audit data-machine --changed-since 361dcd9

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-review-audit-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-review-audit-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/29155584683
Tooling versions
  • Homeboy CLI: homeboy 0.281.20+123145ee082b+c49841f7
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: f89b4297
  • Action: unknown@unknown

@chubes4 chubes4 merged commit bf141db into main Jul 11, 2026
5 checks passed
@chubes4 chubes4 deleted the wake-briefing-freshness branch July 11, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant