Skip to content

Proposal: Explain why an automation run is waiting or didn't happen #570

Open

Description

Tracked in #568. This proposal stands on its own and doesn't depend on the others tracked there.

Summary

The first questions people ask about automations are "why hasn't it started?" and "why didn't it run?" AHP 1.0 can't answer either one. A pending run carries only its creation time, a trigger occurrence that doesn't become a run leaves no trace, and a catalogue entry has no health signal.

This proposal adds an optional wait reason to pending runs, a health summary to each automation, and an aggregated record of trigger occurrences that didn't produce runs, grouped by reason. Every addition is optional state filled in by the host. Clients show it when it's present, and nothing changes for clients that ignore it.

Scenarios

  • Waiting for credentials. A host can start runs only while a client with valid credentials is connected. A manual run sits in pending, and the user sees no reason.
  • Silent skips. A 3 AM occurrence is skipped because its misfire policy is skip. The next morning, nothing explains why the report is missing.
  • Deferred work. A host defers a run because of capacity, a quota, or a concurrency limit, and it knows when it will try again.
  • A busy target. A run waits for an earlier run of the same automation to finish, or for an active turn in the conversation it delivers into.
  • Overdue schedules. nextRunAt is 20 minutes in the past, and nothing says why.
  • "The pull request was labeled, but nothing ran." Did the event arrive? Was it filtered out because the pull request was a draft?

AHP today

  • AutomationPendingRunLifecycle is { status, createdAt }.
  • Skipped and misfired occurrences produce no state.
  • AutomationEntry has nextRunAt but no health signal.
  • A run that ends unsuccessfully is failed with an ErrorInfo. That part already works.

Proposal

  1. Why a run is waiting. AutomationPendingRunLifecycle gains optional waiting: { reason, message?, retryAt? }. reason is @nonexhaustive:

    • capacity: the host has no capacity right now.
    • concurrency: waiting for earlier runs of this automation.
    • quota: a budget or rate limit was reached.
    • authentication: waiting for credentials, for example a connected, authenticated client.
    • targetBusy: the conversation the run delivers into is busy.
    • retry: backing off after a transient failure.
    • unavailable: the host is paused, draining, or otherwise not running automations.

    The host updates the reason with the existing automationRun/lifecycleChanged action (from pending to pending with new detail). AutomationRunSummary.lifecycle mirrors the run's lifecycle, so run history shows the reason without subscribing to each run. A run that can't proceed and won't retry still fails with an ErrorInfo, as it does today.

  2. Automation health. AutomationEntry gains optional health: { status, reason, since }. status is @nonexhaustive, with values degraded and blocked. reason is an ErrorInfo. When health is absent, there's no known problem. For example:

    • blocked: automatic runs can't start because no authenticated client is connected; or the delivery target no longer exists; or the quota is exhausted until a given date.
    • degraded: the schedule is overdue; the last several runs failed; or the event source is unreachable.
  3. Occurrences that didn't produce runs. AutomationEntry gains skipped: an aggregated summary of trigger occurrences that didn't become runs, grouped by trigger and reason. Each group has a count, the time of the most recent occurrence, and that occurrence's scheduledFor or event provenance. reason is @nonexhaustive:

    • misfire: dropped by the trigger's misfire policy.
    • overlap: dropped by an overlap or concurrency policy.
    • filtered: the event matched the trigger type but was excluded by its configuration (for example, a draft pull request).
    • quota: dropped because a limit was exhausted.

    Counts cover the period since skipped.since, so an empty or absent group means "none recorded since then," not "nothing arrived." Grouping keeps the summary small (one group per trigger and reason) no matter how many events arrive. Because every change republishes the whole entry with automation/set, hosts SHOULD batch updates to skipped rather than publish one per occurrence. Hosts SHOULD record misfire and overlap, and MAY record filtered. The most recent event provenance follows the existing rule: no secrets, for display and audit only.

  4. No new run statuses. AutomationRunStatus stays @exhaustive and unchanged. Waiting detail lives inside pending, the same way failed already carries error. Occurrences that didn't produce runs are recorded on the entry, not as runs.

Sketch

Names and shapes are illustrative. The implementation PR settles them.

interface AutomationPendingRunLifecycle {
  status: AutomationRunStatus.Pending;
  createdAt: string;
  /** Why the run hasn't started yet, when the host knows. */
  waiting?: AutomationRunWaiting;
}

interface AutomationRunWaiting {
  reason: AutomationWaitReason;
  /** Human-readable detail. */
  message?: string;
  /** When the host expects to try again, as an ISO 8601 timestamp. */
  retryAt?: string;
}

/** @nonexhaustive */
const enum AutomationWaitReason {
  Capacity = 'capacity',
  Concurrency = 'concurrency',
  Quota = 'quota',
  Authentication = 'authentication',
  TargetBusy = 'targetBusy',
  Retry = 'retry',
  Unavailable = 'unavailable',
}

interface AutomationEntry {
  // ...existing fields
  health?: { status: AutomationHealthStatus; reason: ErrorInfo; since: string };
  skipped?: {
    /** Start of the period the counts cover. */
    since: string;
    /** One group per trigger and reason. */
    items: AutomationSkippedGroup[];
  };
}

/** @nonexhaustive */
const enum AutomationHealthStatus {
  Degraded = 'degraded',
  Blocked = 'blocked',
}

interface AutomationSkippedGroup {
  triggerId: string;
  reason: AutomationSkipReason;
  count: number;
  /** The most recent skipped occurrence in this group. */
  lastAt: string;
  lastScheduledFor?: string;
  /** Non-secret provenance, as on AutomationTriggeredRunOrigin.event. */
  lastEvent?: Record<string, unknown>;
}

/** @nonexhaustive */
const enum AutomationSkipReason {
  Misfire = 'misfire',
  Overlap = 'overlap',
  Filtered = 'filtered',
  Quota = 'quota',
}

Why this shape

  • Detail goes inside existing states. pending gains detail just as failed already carries error. The @exhaustive status enum stays closed, and clients that don't know waiting keep rendering pending.
  • Existing actions carry it. Wait reasons travel with automationRun/lifecycleChanged, and health and skipped occurrences with automation/set. No new actions are needed.
  • Open reason sets. New causes can be added without breaking clients, and hosts can explain causes that are specific to them with message and ErrorInfo.
  • Counts and reasons, not an event feed. Grouped counts with a coverage period answer "did it arrive, and why didn't it run?" with state whose size doesn't grow with event volume.
  • Session state stays authoritative. Waiting for user input or a tool confirmation is still reported by the linked session (SessionState.inputNeeded), not duplicated on the run.

Compatibility

  • Additive, optional state filled in by the host. No capability is needed: clients show the information when it's present.

Out of scope

  • Duplicating a session's input-needed state on the run.
  • Activity feeds that span automations, and dashboards of every received event.

Open questions

  1. Is a per-occurrence history also needed (for example, "show me the last 20 filtered events")? If so, should it be a separate, subscribable activity channel referenced from the entry, so only clients that open diagnostics pay for it, or a paginated command?
  2. Should "overdue" be reported by the host as health, or derived by clients from nextRunAt?
  3. Should health also allow an explicit healthy status, or is absence enough?
  4. When should skipped.since reset: never, on host restart, or when the definition changes?

Related proposals (none required)

Activity

  1. added
    feature-request
    on Nov 6, 2026
  2. connor4312 commented on Nov 9, 2026

    @connor4312
    Member

    Why would you have this on the AutomationEntry vs AutomationRunSummary? We already have AutomationRunLifecycle there which is a good place to indicate things like capacity constraints and such.

  3. benvillalobos commented on Nov 18, 2026

    @benvillalobos
    Member

    This seems like something that should come later down the line, or maybe I'm not just the target audience for this. I've never questioned why an automation run didn't happen, but I could see questioning it if I set up concurrency limits. I almost wonder if data like health is something that should explicitly be set in the protocol itself, or inferred by the implementation whether an automation is healthy or not. Which makes me thinks this is something we should bring in when the need actually arises.

    It seems like #573 and #574 are prerequisites for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions