Commit 8d6f824
fix(programs): replace rolling-sweep monitor with passive watch + status panel
Tear out the 1-program-every-3s rolling sweep daemon (program_monitor.go); replace
with a passive watch that piggybacks on data the warmer already fetches. The Programs
page already has `latest_target_updated_at` for every program — use it.
How it works now:
- internal/api/program_watch.go: ProgramWatchOnRefresh(programs) is called from
refreshProgramsCache after every catalogue rebuild. It scans
latest_target_updated_at, fires one Discord alert per program whose timestamp
exceeds the persisted watermark (settings key program_watch_latest_seen), then
advances the watermark. Capped at 10 alerts/cycle to defeat one-time corpus shifts.
- BOOT INTRO: once per process (post-restart), sends a "📌 Scope watch ready —
most recent update: X" message so the operator sees immediate confirmation the
watch is alive. Removes the 1-hour "is it working?" black box.
- Programs page: new "Scope Update Watch" status card at the top showing daemon
state, freshest update right now, watermark age, alerts this session, plus a
🔔 Test webhook button (POST /api/scope/watch-test) that fires a sample Discord
message instantly. No more "wait an hour to know if it works".
- GET /api/scope/watch-status powers the panel; POST /api/scope/watch-test does the
manual delivery probe.
Webhook helper: utils.SendMonitorWebhookErr (returns delivery error) and
utils.MonitorWebhookConfigured added — SendMonitorWebhook keeps logging behavior.
Removed: program_monitor.go (272 lines), the boot StartProgramMonitor() call,
PROGRAM_MONITOR_SPACING_MS env, the full rolling-sweep cost model. The
program_assets table + RecordProgramScopeAssets stay (used by the one-shot reset
on previous boot); they're dormant going forward.
Verified: go build/vet/db+utils tests, node --check programs.js — all clean.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent dc8544f commit 8d6f824
8 files changed
Lines changed: 380 additions & 288 deletions
File tree
- internal
- api
- ui
- pages
- app
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
| 584 | + | |
| 585 | + | |
584 | 586 | | |
585 | 587 | | |
586 | 588 | | |
| |||
This file was deleted.
0 commit comments