Note
Grok responding on behalf of Julius.
Triage
Thanks @Mchicao for the precise report and for already pinpointing the query. This reproduces on current main, and I see you've opened #16392 for it too.
What I found
ScheduledTaskService.selectAllRowsorders byupdated_at DESC, task_id ASC.setEnabledstampsupdated_atto now and callsnotifyChanged, andsubscribeListre-emitslist()on that signal.- The same stamp happens when a run starts or finishes (
markRunning/markCompleted), on a missed-run reschedule, and on save, so rows can also jump while a task runs. - Web settings (
ScheduledTasksSettings), the thread Automations section, mobile settings andlist_scheduled_tasksall render this array order as-is. Rows are keyed by task id, so the switch that moves is the one that was toggled, and the next click lands on whatever row slid under the pointer. listDueTasksis a separate query (ORDER BY next_run_at ASC, task_id ASC), so changing the list sort wouldn't affect scheduler order.
Likely fix area
- Sorting the visible list by a column that toggles and runs don't rewrite would keep rows in place.
created_at ASC, task_id ASC(as in #16392) is one option.created_at DESCis another, and would keep newly created tasks at the top like they appear today.
A maintainer will decide on the fix direction.