Skip to content

Bug: scheduler status emits missed-cadence alert immediately on clean startup before first due run #15

Description

@princepspolycap

Bug: scheduler status emits missed-cadence alert immediately on clean startup before first due run

Severity: P2 — MEDIUM

Summary: A freshly seeded scheduler reports missed_cadence before the first hourly run is even due, creating false alarms on healthy startup.

Steps to Reproduce:

  1. Start the scheduler with a fresh seeded state from buildIntentSignalDiscoveryState().
  2. Do not wait for the first hourly recurrence window.
  3. Call GET /api/scheduler/status.
  4. Inspect the returned alerts array.

Expected: No cadence-miss alert until the first due window has actually passed, or until an established cadence exceeds the 90-minute threshold.

Actual: checkMissedCadence() emits missed_cadence immediately whenever last_cycle_completed_at is null, even though task.next_recurrence_date is still in the future and no cycle has been missed.

Root Cause:

  • File: server/scheduler/monitoring.ts L65-L73
  • File: server/scheduler/intent-signal-discovery.ts L88-L91

The seed state intentionally starts with last_cycle_completed_at = null and next_recurrence_date = now + 1h. checkMissedCadence() treats any null last_cycle_completed_at as an alert condition, without checking whether the first run is still pending and on time.

Suggested Fix: Suppress missed_cadence until the first execution is actually overdue. A safe gate is: only alert when last_cycle_completed_at is null AND now > next_recurrence_date + threshold, or add an explicit bootstrap state that distinguishes "never due yet" from "missed first run".

Related: #10, PR #11

Activity

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

    bugSomething isn't workingops

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions