Skip to content

Proactive reminders 2/3: scheduled tasks and recurring summaries #354

Closed

Description

@hsliuustc0106

Why

After phase 1 (event reminders), users want Bots to act on a schedule: a morning summary, a weekly report, a daily check. This phase adds time-based triggers.

Part of the 3-phase proactive-reminders track. Depends on phase 1 (event reminders). Related: #349, #352.

Scope

Acceptance

  • A daily schedule fires on time in the chosen timezone and survives restart.
  • Missed-run behavior is documented and tested; no duplicate run for one slot.
  • A failed run appears in "Needs you" with a reason.
  • Pausing or deleting stops future runs immediately.

Out of scope

Running while the app is closed (phase 3), external delivery channels (phase 3).

Process

Implementation via cloud OpenCode, review via Codex; bots do not hand-write code.

Activity

  1. added
    enhancementNew feature or request
    area:automationScheduled tasks and automation
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 19, 2026
  2. Birfy commented on Oct 19, 2026

    @Birfy
    Collaborator

    Triage on main 7b9e90b, 2026-10-19 ~12:10 Asia/Shanghai: needs-human, not agent-ready. Depends on #353 (phase 1) and needs an owner go-ahead and scope (where scheduled tasks live, who may create them).

  3. Birfy commented on Oct 20, 2026

    @Birfy
    Collaborator

    Triage (maintenance, 2026-10-20 08:04 Asia/Shanghai)

    Checked on main a45fc8c.

    Already on main (most of the core)

    • Scheduled tasks via DSH's schedule service (core/src/host/schedules.js, core/src/client/schedules.js): Settings → Scheduled tasks, a Bot's card and its details line. Once / every day / every week / repeat every N minutes, cron shown when present, timezone shown when it differs from local, Next: time, delete with a click-again confirm. Targets a Bot's chat or a group chat. Tasks follow a Bot to a fresh part of its chat. Automation tasks are on by default (Switch on DSH Automation tasks by default, once per profile; the hint opens Plugins #381).
    • A due task counts as the owner's turn only while the Bot is not shared (turn-origin.js, scheduled verdict), and it goes through the normal approvals.
    • Missing from this issue: edit, pause/resume, last run result / failure + retry, documented missed-run behavior, and limits ([Team] Bound agent loops and resource consumption #56).

    Expected behavior
    From Settings → Scheduled tasks I can edit or pause a task without deleting it. Each task shows its last run and whether it failed. The docs say what happens to a run missed while the app was closed (at most one catch-up run, never many).

    First slice (smallest shippable step)

    • Edit: the row opens the existing TaskForm already filled in. Saving creates the new task first and then deletes the old one, the same create-then-delete pattern as moveSchedules, so a failure keeps the old task.
    • Pause / Resume: if DSH's service has no pause, Pause keeps the task's request in FlyBot's store and removes it from DSH, and Resume creates it again. The row reads Paused.
    • Missed runs: check what DSH does and write it in docs/subsystems/core-host.md with a test.
    • Tests in core/test/schedules*.test.js.

    Details I decided (say if you disagree)

    Question for the owner
    Which gap first: (a) Edit + Pause/Resume + documented missed runs; (b) last run and failed runs shown (needs #353/#349 first); or (c) treat #354 as done by the current Scheduled tasks, close it, and file the gaps as small issues?
    Recommendation: (a).

  4. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    and removed
    needs-humanThe agent loop stopped; a person must decide (reason in the last comment)
    on Oct 20, 2026
  5. Birfy commented on Oct 20, 2026

    @Birfy
    Collaborator

    Owner decision (2026-10-20): Confirmed option (a): next, add edit and pause/resume for scheduled tasks, then document what happens to a missed run while the app is closed (at most one catch-up run).

  6. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 20, 2026
  7. self-assigned this
    on Oct 20, 2026
  8. Birfy commented on Oct 20, 2026

    @Birfy
    Collaborator

    Claimed by maintenance run (2026-10-20 08:55 Asia/Shanghai), branch feat/354-schedule-edit-pause on Birfy/FlyBot, following the Owner decision above.

  9. Birfy commented on Oct 20, 2026

    @Birfy
    Collaborator

    Minor decisions made while implementing the first slice (PR #474, 2026-10-20 09:07 Asia/Shanghai):

    • Edit in place when possible. DSH's schedule service has a compare-and-update (update with the exact listed record). When the task stays on the same chat, Edit uses it, so the task keeps its id, next run and delivery records (useful for the later "last run" slice, Scheduled tasks: last run result, failed runs with retry, and limits (#354 follow-up) #473); the timing is sent only when it changed, so a rename does not move the next run. Create-then-delete (as in the triage) is used when the task moves to another Bot or group chat, or for a finished one-time task DSH cannot update. Either way a failure keeps the old task.
    • Edit UI. A pencil Edit on each row (Settings → Scheduled tasks and the Bot's card) turns that row into the existing form, filled in, with Save changes. An edited daily/weekly task keeps its own time zone; a cron rule (no control in the form) is kept unless another kind is picked.
    • Pause stores the task record in FlyBot's state (pausedSchedules) before DSH deletes it; a failed delete rolls back. Resume recreates it on the Bot's current part; a failed create keeps it paused. A recurring task's next run is computed afresh on Resume (no catch-up for the paused time). A paused task can be edited (stays paused) or deleted. A one-time task whose time passed while paused is not resumed; the row asks for an edit.
    • Copy: Edit / Pause / Resume / Paused, with zh strings (Resume = 继续).
    • Missed runs documented in docs/subsystems/core-host.md from DSH's own behavior (one run for the latest missed time per recurring task; a passed one-time task runs once on start), with a test against the pinned dsh-schedule.
    • Deferred scope (last run result, failed runs + retry, limits [Team] Bound agent loops and resource consumption #56) filed as Scheduled tasks: last run result, failed runs with retry, and limits (#354 follow-up) #473 (needs-human).
  10. added a commit that references this issue on Oct 20, 2026
    465357e
  11. Birfy commented on Oct 20, 2026

    @Birfy
    Collaborator

    Cleanup: issue closed. Removing stale agent-working and assignee.

  12. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 20, 2026
  13. removed their assignment
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a templatearea:automationScheduled tasks and automationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions