Like discussed in https://mail.gnu.org/archive/html/emacs-devel/2024-11/msg00094.html here is the patch that implements completion on comint history: