diff --git a/crates/ml/tests/dqn_early_stopping_termination_test.rs b/crates/ml/tests/dqn_early_stopping_termination_test.rs index cbbd34f8c..757b68514 100644 --- a/crates/ml/tests/dqn_early_stopping_termination_test.rs +++ b/crates/ml/tests/dqn_early_stopping_termination_test.rs @@ -147,7 +147,8 @@ async fn test_early_stopping_terminates_with_error() { hyperparams.epochs = 10; hyperparams.gradient_collapse_multiplier = 1e9; hyperparams.gradient_collapse_patience = 3; - hyperparams.min_epochs_before_stopping = 1; // Allow collapse at any epoch + hyperparams.min_epochs_before_stopping = 1; + hyperparams.early_stopping_enabled = true; hyperparams.checkpoint_frequency = 1; hyperparams.batch_size = 32; hyperparams.buffer_size = 1024; @@ -220,6 +221,7 @@ async fn test_gradient_collapse_propagates_error() { hyperparams.gradient_collapse_multiplier = 1e9; hyperparams.gradient_collapse_patience = 3; hyperparams.min_epochs_before_stopping = 1; + hyperparams.early_stopping_enabled = true; hyperparams.batch_size = 32; hyperparams.buffer_size = 1024; hyperparams.min_replay_size = 32; @@ -250,10 +252,11 @@ async fn test_gradient_collapse_propagates_error() { let error = result.unwrap_err(); let error_msg = error.to_string(); - // Verify error mentions gradient collapse + // Verify error indicates training stopped (gradient collapse or patience-based) assert!( - error_msg.contains("Gradient collapse") || error_msg.contains("gradient collapse"), - "Error should mention gradient collapse, got: {}", + error_msg.contains("collapse") || error_msg.contains("Collapse") + || error_msg.contains("early stopping") || error_msg.contains("Early stopping"), + "Error should mention collapse or early stopping, got: {}", error_msg );