SIGN IN SIGN UP

feat(desktop): group scheduled runs under their schedule in the sidebar (#13752)

* feat(core): stamp schedule id, name, and run number onto scheduled sessions

Sessions started by the cron runner only carried a generic
sessionHistoryOrigin.trigger = "hub-schedule", so clients could tell a
session was scheduled but not which schedule it belonged to or which run
it was. The runner now passes schedule provenance to the runtime handlers,
which merge it into the session metadata alongside the origin trigger:

  scheduleId          the hub schedule's external id
  scheduleName        the schedule title
  scheduleExecutionId the cron run id
  scheduleRunNumber   1-based position among every run created for the spec

The run number comes from a new SqliteCronStore.getRunOrdinal, which counts
runs of every status in creation order so a later cancellation never shifts
numbers already stamped onto earlier sessions. A reclaimed run keeps its
number, so two sessions with the same number make a duplicate visible.

HubScheduleRuntimeHandlers.startSession gains an optional second argument
carrying the metadata; existing implementations that ignore it keep working.

* feat(desktop): group scheduled runs under their schedule in the sidebar

A schedule that fires daily filled the sidebar's Scheduled section with a
row per run, each titled with the same prompt text, which read as if the
task had been duplicated. Runs of one schedule now fold into a single
collapsible row named after the schedule, with the run count on the right;
expanding it lists the runs as "Run N" sub-items (newest first) with their
usual status dot, time, hover card, context menu, and delete button. The
group holding the active session expands on its own so a run opened from
the Schedules page is visible. Grouping also applies inside project groups
when sorting by project. The Scheduled header now counts schedules rather
than runs.

Threads learn the schedule identity from the metadata the runner now
stamps (scheduleId, scheduleName, scheduleRunNumber). Runs recorded before
that fall back to the schedule executions list the hook already polls,
which now yields the schedule id and name instead of a bare session id set,
and finally to grouping by shared title. Runs without a number are labelled
with their start time instead of "Run N".

* fix(desktop): reopen a collapsed schedule group when one of its runs is opened

A stored collapse used to win over the active-session default for the
sidebar's lifetime, so a run opened from the Schedules settings page
could stay hidden inside its collapsed group. Opening a session now
clears the stored choice for the group that holds it; the group can
still be collapsed afterwards.

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

---------

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>
S
Saoud Rizwan committed
b427fae9f9be4f4659746397ffee0d58848884f9
Parent: b9977a1
Committed by GitHub <noreply@github.com> on 9/2/2026, 2:51:57 AM