The agent flush row (_db_flush_row) always sets token_count, None for a replayed message, so keying the keep on the key's absence missed the main production writer and a digest-matched rewrite still nulled the stored count. Key it on the value.