Can you please try the attached patch (on top of the emacs-29 HEAD) and tell us if it fixes the bug? Thanks.