magi-code 0.63.4

Repository-aware CLI coding agent for terminal work
Documentation
const REPLAY_DROP_DEBUG_LOG_LIMIT: usize = 8;

#[derive(Debug)]
pub(super) struct ReplayDropTrace {
    provider: &'static str,
    dropped: usize,
}

impl ReplayDropTrace {
    pub(super) const fn new(provider: &'static str) -> Self {
        Self {
            provider,
            dropped: 0,
        }
    }

    pub(super) fn drop_item(&mut self, reason: &str) {
        self.dropped += 1;
        if std::env::var_os("MC_PROVIDER_REPLAY_DEBUG").is_some()
            && self.dropped <= REPLAY_DROP_DEBUG_LOG_LIMIT
        {
            eprintln!(
                "provider_replay_drop provider={} reason={reason} count={}",
                self.provider, self.dropped
            );
        }
    }

    pub(super) fn trace_summary(&self) {
        if self.dropped > 0 && std::env::var_os("MC_PROVIDER_REPLAY_DEBUG").is_some() {
            eprintln!(
                "provider_replay_drop_summary provider={} dropped_replay_items={}",
                self.provider, self.dropped
            );
        }
    }
}