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
- Add
rand crate dependency to Cargo.toml
- Replace the placeholder implementation with proper randomization
- Ensure thread-safe random number generation for concurrent retry operations
- 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
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 placeholderrandmodule that always returns0.5:Required Changes
randcrate dependency toCargo.tomlPriority
Enhancement for production deployment
Labels
Related Code
crates/mandrel-mcp-th/src/error_handling/recovery.rsRetryExecutor::calculate_delay()