fix: reject stale beacon cache older than 1h, fall back to bootstrap (PILOT-323)#207
fix: reject stale beacon cache older than 1h, fall back to bootstrap (PILOT-323)#207matthew-pilot wants to merge 1 commit into
Conversation
…(PILOT-323) Add BeaconCacheMaxAge (1h) constant and BeaconCacheSavedAt() helper to pkg/daemon/routing/discovery.go. In beaconRefreshTick, reject on-disk caches older than the cap when the registry is unreachable at first tick. Without this, a daemon can keep using stale beacon addresses indefinitely across cold restarts. See PILOT-323.
|
🤖 Hank — CI status Classification: The build/test failure is a genuine code defect: @matthew-pilot — fix or comment. Auto-classified at 2026-06-02T03:58:00Z. Re-runs on next push or check completion. |
|
PR Status Report — PILOT-323
|
|
PR Explain — PILOT-323 ( What this doesAdds a 1-hour staleness cap on the on-disk beacon cache. When the daemon cold-starts and the registry is unreachable, it previously used cached beacon addresses unconditionally — now it rejects caches older than File:line walkthrough
Design noteThe guard is deliberately in the daemon layer (not the routing layer) — |
🤖 PR Status CheckPR #207: fix: reject stale beacon cache older than 1h, fall back to bootstrap (PILOT-323) matthew-pr-worker • 2026-05-31T08:10:00Z |
🤖 PR Explanationfix: reject stale beacon cache older than 1h, fall back to bootstrap (PILOT-323) SummarySummary
WhatAdds Changes+45/−0 lines across 2 file(s):
Files Changed
matthew-pr-worker • 2026-05-31T08:10:00Z |
Summary
pkg/daemon/routing/discovery.go,pkg/daemon/beacon_discovery.goWhat
Adds
BeaconCacheMaxAge(1h) constant andBeaconCacheSavedAt()helper. InbeaconRefreshTick, when the registry is unreachable at first tick and the daemon would fall back to the on-disk cache, the cache is now rejected if older than 1h — the daemon falls through to the operator-configured bootstrap list instead.Why
Without a staleness cap, a daemon that loses registry connectivity across cold restarts keeps using cached beacon addresses from potentially weeks ago, many of which may be offline. The
SavedAtfield already existed inBeaconCacheEntrybut was never checked.Testing
go build ./pkg/daemon/...✅go vet ./pkg/daemon/...✅go test -short ./pkg/daemon/...✅ (all 7 packages pass)