I think that’s the problem. The discourse_replies_html filter only accepts one argument. Something like this should work:
function cosmos_custom_discourse_replies( $input ) {
ob_start();
?>
custom output here
<?php
$output = ob_get_clean();
return $output;
}
add_filter( 'discourse_replies_html', 'cosmos_custom_discourse_replies' );
You can see all the templates here: wp-discourse/templates/html-templates.php at main · discourse/wp-discourse · GitHub. Look at the call to apply_filters at the bottom of each template to see the parameters that are passed to the filter.