fix(keeld): log the effective ambient cadence, not the raw setting
A settings.json predating the ambient fields deserializes cadence to 0; the sentinel clamps that to its 5m default, so log the clamped value instead of a misleading cadence=0s. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+9
-2
@@ -150,6 +150,13 @@ func main() {
|
||||
if ambMode == "" {
|
||||
ambMode = settings.AmbientNotify
|
||||
}
|
||||
// Compute the effective cadence so the log reflects what the sentinel will
|
||||
// actually use: New clamps a non-positive value (e.g. a settings.json that
|
||||
// predates these fields) to a default, mirrored here for the log line.
|
||||
ambCadence := time.Duration(cfg.AmbientCadenceSecs) * time.Second
|
||||
if ambCadence <= 0 {
|
||||
ambCadence = 5 * time.Minute
|
||||
}
|
||||
sentinel := ambient.New(ambient.Deps{
|
||||
AI: base.AI,
|
||||
Knowledge: base.Knowledge,
|
||||
@@ -158,8 +165,8 @@ func main() {
|
||||
Memory: base.Memory,
|
||||
Clock: time.Now,
|
||||
ActiveMode: func() string { return h.State().ActiveMode },
|
||||
}, time.Duration(cfg.AmbientCadenceSecs)*time.Second, ambMode)
|
||||
log.Printf("ambient: mode=%s cadence=%ds", ambMode, cfg.AmbientCadenceSecs)
|
||||
}, ambCadence, ambMode)
|
||||
log.Printf("ambient: mode=%s cadence=%s", ambMode, ambCadence)
|
||||
|
||||
srv := web.NewServer(h)
|
||||
srv.Init() // re-arm or expire a restored deadline-bearing session
|
||||
|
||||
Reference in New Issue
Block a user