Repository navigation
CC-390: keep both Muse alerts visible + bound detector state - #462
Conversation
…r state (24h TTL + 512 cap)
This comment has been minimized.
This comment has been minimized.
|
Automatic approval held Kody's assessment:
|
…ack, legacy sessions evict first at cap
This comment has been minimized.
This comment has been minimized.
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
Automatic approval held: Stateful detector adds 24h TTL eviction and 512-session cap that changes alert refire semantics; production behavior unverified, test runs unreported, in historically bug-prone area. |
Carries the two still-real fixes from the #390 preservation matrix (verified against main e7fca82):
Remaining tracked from #390: f6 (reparse efficiency) is carried by #464.
CC-390: keep both Muse alerts visible + bound detector state
Burn and standard-session alerts are now independent so both stay visible when both are present.
MuseCodeStandardSessionDetectornow trackslastObservedAt, evicts sessions unobserved for 24 hours, and caps tracked state at 512 sessions by least-recently-observed, keeping backward compatibility for legacy persisted blobs without timestamps.User-visible impact: Monitor page can show Burn Alert and Standard Session Alert together. Operationally, detector state is bounded and long-absent sessions refire as first-observed on return; production behavior is unverified.
Tests added (run status not reported):
testBothMuseAlertsStayVisibleTogether,testSessionUnobservedPastTTLIsEvictedAndRefiresAsNew,testTrackedStateIsCappedByEvictingLeastRecentlyObserved,testLegacyPersistedStateWithoutTimestampsStillDecodes.Unresolved review findings (medium, 3): Nil-model sessions never refresh liveness and may be TTL-evicted; empty polls skip TTL eviction and retain stale sessions; unstamped legacy sessions sort newest so live sessions may evict first.
Summary
For CC-390, keeps tracked Muse sessions alive on model-less polls while still bounding detector state. Empty polls now expire stale sessions against the wall clock. Legacy sessions without timestamps now sort oldest so cap trimming evicts them first.
Changes
lastObservedAtfor every observation before the model-id guard, so presence without a model reading advances liveness and prevents refire on return.Date()when eviction has no newest observation, allowing idle periods to advance TTL expiry..distantFutureto.distantPastfor unstamped entries.Tests
Added
testModelLessPollsKeepASessionAlive,testEmptyPollStillEvictsSessionsPastTTL, andtestUnstampedLegacySessionsEvictBeforeStampedOnesAtCapinMuseCodeStandardSessionDetectorTests. No run results were provided in the changes, so pass status is unverified.Open risk
Automated review flagged uncapped
lastObservedAtgrowth for model-less sessions (Sources/QuotaCore/MuseCodeStandardSessionDetector.swift:145). This remains unresolved in the provided changes.Summary
CC-390: Bounds
MuseCodeStandardSessionDetectorstate for model-less sessions. Prevents orphan liveness stamps from accumulating unbounded until TTL.Changes
trimToCap()inMuseCodeStandardSessionDetectorto caplastObservedAtorphan entries in addition to trackedlastKnownModels. Oldest orphans are evicted first once the map exceedsmaxTrackedSessions, and stamps backing a tracked session are left alone.testModelLessOrphanStampsAreCappedTooto cover cap behavior for model-less sessions.Impact
Operational: detector memory remains bounded at the configured cap. Model-less sessions still record no model state, and liveness eviction remains oldest-first.
Review / Testing
Automated code review completed and found no issues in the changes it reviewed. Test execution and runtime verification were not reported, so behavior beyond the added test is unverified.