AI structured context should report feed staleness, not just failure counts #61

Closed
opened 2026-07-18 05:31:25 +00:00 by claude-bot · 1 comment
Contributor

_freshness_status (app/services/ai_context.py:81-86) returns "ok" for any
feed with zero failures and any historical success, regardless of age — a
silently-stalled feed is described as fresh in the LLM prompt context. Apply
the diagnostics staleness thresholds (stale_after_seconds pattern) to
last_success_at and emit "stale" as a distinct status; ensure prompts and
validators treat stale context conservatively.

Acceptance criteria:

  • Feed with old last_success_at and no failures reports "stale"
  • Unit test covers ok/stale/failing/unknown boundaries

Filed from the 2026-07-17 codebase audit (docs/.internal/report-2026-07-17.md), finding F-22.

`_freshness_status` (app/services/ai_context.py:81-86) returns "ok" for any feed with zero failures and any historical success, regardless of age — a silently-stalled feed is described as fresh in the LLM prompt context. Apply the diagnostics staleness thresholds (`stale_after_seconds` pattern) to `last_success_at` and emit "stale" as a distinct status; ensure prompts and validators treat stale context conservatively. **Acceptance criteria:** - [ ] Feed with old last_success_at and no failures reports "stale" - [ ] Unit test covers ok/stale/failing/unknown boundaries --- _Filed from the 2026-07-17 codebase audit (`docs/.internal/report-2026-07-17.md`), finding F-22._
Author
Contributor

Done in #104 (merged). _freshness_status now returns a distinct stale status when a feed has zero failures but its last_success_at is older than the category threshold (mirroring the diagnostics thresholds — nws_alerts 15m, spc_fetch 30m, forecasts 3h, etc.), plus per-entry age_seconds/stale_after_seconds. So a silently-stalled feed is reported to the LLM as stale rather than fresh; the freshness field is already whitelisted for cloud, so both local and cloud prompts get the signal. Tests cover ok/stale/failing/unknown boundaries.

Done in #104 (merged). `_freshness_status` now returns a distinct `stale` status when a feed has zero failures but its `last_success_at` is older than the category threshold (mirroring the diagnostics thresholds — nws_alerts 15m, spc_fetch 30m, forecasts 3h, etc.), plus per-entry `age_seconds`/`stale_after_seconds`. So a silently-stalled feed is reported to the LLM as stale rather than fresh; the `freshness` field is already whitelisted for cloud, so both local and cloud prompts get the signal. Tests cover ok/stale/failing/unknown boundaries.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/WeatherBot#61
No description provided.