This function got shortened quite a bit by "With mdlog lock and unlock functionality, listing and trimming base on shard_id", including the removal of the thing that had set the truncated out param. We're now setting it based on ENOENT, despite LogListCtx having a "done" member. I think you might want to look at what happened in that sequence of commits again.
(I'm not checking them at all as you said you'd reviewed them, but I came across this one because of the ENOENT handling commit.)