feat: per-source sync status (persisted sweep state + knox sync-status + knox_sync_status MCP tool) #54
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Ingest sweeps (browser, gitea, git, opencode sessions, karakeep, bookorbit, brevier) report outcome only to the log. A sweep that fails, or that silently does nothing because its env config is missing, is invisible from the MCP/CLI surface.
Concrete case found today: the
knox watchcontainer has noKARAKEEP_URL/KARAKEEP_API_KEY, soKarakeepIngester.IngestAll()is a silent no-op — thekarakeepscope in the index has zero entries and nothing indicates why.The existing
sourcesregistry table is dead weight: seeded once, never read or updated.Proposal
sourcestable (extend it):status(ok|error|unconfigured),last_attempt_at,last_success_at,last_error_at,last_error,last_counts(JSON: new/updated/unchanged/scanned),interval_seconds.The watcher records after every sweep — including errors and "not configured".
internal/db: per-source status joined with derived per-source stats fromobservations(distinct fingerprints, MAX(collected_at)), plus a staleness verdict (last success older than ~2.5x interval → stale; error newer than success → failing; no row → never ran).knox sync-status [--json]CLI command and aknox_sync_statusMCP tool.Out of scope: Prometheus per-source gauges (metrics port already exists — follow-up if wanted).
Implemented in
65fdcbcand deployed: CI green, casaos replica containers rolled via the workflow restart step (both healthy), laptop origin binary rebuilt and the knox user service restarted.Verified live:
knox sync-statusshows opencode-session and browser-history recording ok sweeps with their intervals; remaining tickers (gitea/git 10m, karakeep/bookorbit 30m) fill in on their next fire.