Skip to content

Scheduled (recurring) tasks with an unattended-work admission policy #2744

Closed as not planned

Description

@integry

Scheduled (recurring) tasks with an unattended-work admission policy

Context

Every ProPR run starts from a GitHub event (label, slash command, check run), the UI, the CLI, a REST task submission or MCP. There is no way to say "every night, run this instruction against this repository" (e.g. a dependency/upgrade patrol, a flaky-test hunt, a docs drift check, or a nightly /review of open PRs). A grep for cron/recurring in packages/ and src/ finds nothing.

Requirements

  1. Schedule definitions stored in the DB and managed via Settings UI, propr schedule add|list|remove|run-now, and MCP (create_schedule, list_schedules, run_schedule_now). Fields: repository, cron expression + IANA timezone, instruction (same shape as a REST task submission: text, agent/model override, runUltrafix, autoMerge, maxCostUsd when the spend-cap issue lands), enabled, owner (the user who created it), last_run_at, next_run_at.
  2. Dispatch: a daemon tick (follow the existing daemon loops in src/daemon/) that acquires a Redis lease, finds due schedules, and creates a task through the same code path as a REST task submission (packages/api/routes/taskSubmissionRoutes.ts logic refactored into a shared service if needed) with an idempotency key schedule:<id>:<slot> so a tick that runs twice cannot dispatch twice. Missed slots during downtime are not replayed; a newly created schedule never fires for a slot in the past.
  3. Unattended-work admission: instance settings unattended_max_concurrent (default 1) and optional unattended_window (e.g. 02:00-07:00@Europe/Riga). Scheduled runs (and, when they exist, CI-failure follow-ups and replacement runs flagged as automatic) are admitted only when the number of running unattended tasks is below the cap and the current local time is inside the window; otherwise the slot is skipped with a timeline/notification entry. Manual runs are exempt. A malformed window blocks unattended work rather than allowing it, with a visible warning in Settings.
  4. Provenance: tasks created by a schedule carry schedule_id and show "Scheduled: " in task lists, task detail, the Inbox notification and the GitHub issue body (the issue is created the same way create_task creates one today).
  5. Safety: a schedule whose last 3 consecutive runs failed is paused automatically with a notification; run-now re-enables it.

Documentation

  • New page docs/docs/features/scheduled-tasks.md; links from the features overview and the CLI reference; docs/docs/operations/settings-locations.md for the admission settings.
  • CHANGELOG.md Unreleased entry.

Tests

  • Cron/next-run computation with timezones and DST; no replay of missed slots; no first-fire in the past.
  • Idempotent dispatch across two ticks.
  • Admission: cap and window honoured; malformed window blocks; manual runs unaffected.
  • Auto-pause after 3 failures and re-enable via run-now.
  • Run npm run lint, npm run typecheck and the affected suites.

From the Warren comparison (2026-10-06); planned for batch 4. Batch 1 is #2734, #2735, #2736.

Activity

  1. added
    enhancement
    on Oct 5, 2026
  2. propr-dev commented on Oct 6, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 2744/claude-opus-5-5-scheduled-recurring-tasks-20261006-2103-b7x
    • Base Branch: main
    • Worktree: issue-2744-20261006-2103-claude-opus-5-5-b7x

    🔍 Track Task Execution

  3. integry commented on Oct 6, 2026

    @integry
    OwnerAuthor

    Superseded by the Agents v1 epic (#2800–#2816): cron schedules (#2811), unattended cost gate (#2810) and a single trigger primitive (#2803). The two pieces the epic lacks — an unattended concurrency cap and a local-time window — are tracked in a follow-up issue.

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

    AIAI-doneenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions