I encountered this "bug" again in a different situation
I wrote a configuration equivalent to the following one
#+begin_src emacs-lisp
(defun my-todo-hook ()
(minibuffer-with-setup-hook
;; This simulates a minibuffer prompt with avy
(lambda ()
(enlarge-window 5))
(read-string "Please select enter/return key")))
(add-hook 'org-after-todo-state-change-hook #'my-todo-hook)
#+end_src
I evaluate it, and open a file with two Org entries like these:
```
* Repeated task 1
SCHEDULED: <2026-04-30 Thu .+1d>
* TODO Repeated task 2
SCHEDULED: <2026-04-30 Thu .+1d>
```
Then I move the point to "Repeated task 1" and invoke the agenda for
that buffer, resulting in a frame split in two buffers: the Org file
and the agenda.
I mark as done "Repeated task 2" from the agenda buffer, and the hook
is called. After pressing TODO the Org buffer ends like this:
```
* TODO Repeated task 1
SCHEDULED: <2026-05-01 Fri .+1d>
* DONE Repeated task 2
SCHEDULED: <2026-04-30 Thu .+1d>
```
This is because after the running the hook, the `org-todo' function
does not continue at the right entry ("Repeated task 2"), but at the
one the point was originally when invoking the agenda ("Repeated task
1").
It's basically the same problem as the I bug reported
originally. Again, a simple solution on my side is adding
`save-excursion' to the hook I wrote. But this time I think it makes
more sense to fix it in Org Mode, we could just run the hook inside a
`save-excursion' in the original `org-todo' function. What do you think?