Window 1 is the org file, window 2 is org-agenda, window 1 currently has two tasks, I put the cursor on task2, then switch to window 2, move the cursor to task1, at this time press shift + i (org-agenda-clock-in), as you can see from the picture, the actual recorded time is task2.
This sounds like a package issue with org I think you should try to reproduce this issue on vanilla emacs and if the bug persists open an issue with org-agenda.
Window 1 is the org file, window 2 is org-agenda, window 1 currently has two tasks, I put the cursor on task2, then switch to window 2, move the cursor to task1, at this time press shift + i (org-agenda-clock-in), as you can see from the picture, the actual recorded time is task2.