Skip to content

Add production-grade randomization to error recovery retry system #214

Description

@milliondreams

Description

The error recovery system currently uses a simplified random implementation for jitter calculations in retry delays. This should be replaced with a proper randomization implementation for production use.

Current Implementation

In crates/mandrel-mcp-th/src/error_handling/recovery.rs, there is a placeholder rand module that always returns 0.5:

mod rand {
    pub fn random<T>() -> T
    where
        T: From<f64>,
    {
        // Placeholder implementation
        T::from(0.5)
    }
}

Required Changes

  1. Add rand crate dependency to Cargo.toml
  2. Replace the placeholder implementation with proper randomization
  3. Ensure thread-safe random number generation for concurrent retry operations
  4. Add tests to verify jitter behavior is properly randomized

Priority

Enhancement for production deployment

Labels

  • enhancement
  • testing
  • code-quality
  • performance

Related Code

  • File: crates/mandrel-mcp-th/src/error_handling/recovery.rs
  • Function: RetryExecutor::calculate_delay()
  • Context: Jitter calculation for exponential backoff retry delays

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-qualityCode quality improvements and standardsenhancementNew feature or requestperformancePerformance analysis and optimizationtestingTesting infrastructure and test coverage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions