Presumably the failure is caused by zsh not having finished drawing the prompt when the cursor shape is changed. So instead wait till the expected prompt is drawn. There are probably more places where this change needs to be made, which I cant tell since I cant reproduce.
= kitty - the fast, feature-rich, cross-platform, GPU based terminal See https://sw.kovidgoyal.net/kitty/[the kitty website]. image:https://github.com/kovidgoyal/kitty/workflows/CI/badge.svg["Build status", link="https://github.com/kovidgoyal/kitty/actions?query=workflow%3ACI"] https://sw.kovidgoyal.net/kitty/faq/[Frequently Asked Questions] To ask other questions about kitty usage, use either the https://github.com/kovidgoyal/kitty/discussions/[discussions on GitHub] or the https://www.reddit.com/r/KittyTerminal[Reddit community] Packaging status in various repositories: image:https://repology.org/badge/vertical-allrepos/kitty.svg["Packaging status", link="https://repology.org/project/kitty/versions"]
Languages
Python
43.6%
C
28.3%
Go
20%
Objective-C
6%
Shell
1.5%
Other
0.5%