Repository navigation
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.
nextRunAtis 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
AutomationPendingRunLifecycleis{ status, createdAt }.- Skipped and misfired occurrences produce no state.
AutomationEntryhasnextRunAtbut no health signal.- A run that ends unsuccessfully is
failedwith anErrorInfo. That part already works.
Proposal
-
Why a run is waiting.
AutomationPendingRunLifecyclegains optionalwaiting: { reason, message?, retryAt? }.reasonis@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/lifecycleChangedaction (frompendingtopendingwith new detail).AutomationRunSummary.lifecyclemirrors 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 anErrorInfo, as it does today. -
Automation health.
AutomationEntrygains optionalhealth: { status, reason, since }.statusis@nonexhaustive, with valuesdegradedandblocked.reasonis anErrorInfo. Whenhealthis 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.
-
Occurrences that didn't produce runs.
AutomationEntrygainsskipped: an aggregated summary of trigger occurrences that didn't become runs, grouped by trigger and reason. Each group has acount, the time of the most recent occurrence, and that occurrence'sscheduledForor event provenance.reasonis@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 withautomation/set, hosts SHOULD batch updates toskippedrather than publish one per occurrence. Hosts SHOULD recordmisfireandoverlap, and MAY recordfiltered. The most recent event provenance follows the existing rule: no secrets, for display and audit only. -
No new run statuses.
AutomationRunStatusstays@exhaustiveand unchanged. Waiting detail lives insidepending, the same wayfailedalready carrieserror. 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.
pendinggains detail just asfailedalready carrieserror. The@exhaustivestatus enum stays closed, and clients that don't knowwaitingkeep renderingpending. - Existing actions carry it. Wait reasons travel with
automationRun/lifecycleChanged, and health and skipped occurrences withautomation/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
messageandErrorInfo. - 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
- 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?
- Should "overdue" be reported by the host as health, or derived by clients from
nextRunAt? - Should
healthalso allow an explicithealthystatus, or is absence enough? - When should
skipped.sincereset: never, on host restart, or when the definition changes?
Related proposals (none required)
- Concurrency and coalescing (Proposal: Automation concurrency limits, overlap policy, and coalesced runs #573) produces runs that wait for
concurrencyand occurrences dropped foroverlap. - Continue an existing session (Proposal: Let automation runs continue an existing session #572) produces runs that wait for
targetBusy. - Unattended runs (Proposal: Predictable unattended automation runs #574) describes hosts that can start runs only while an authenticated client is connected. Those runs wait for
authentication.
Activity
connor4312 commentedon Nov 9, 2026
Why would you have this on the AutomationEntry vs AutomationRunSummary? We already have
AutomationRunLifecyclethere which is a good place to indicate things like capacity constraints and such.benvillalobos commentedon Nov 18, 2026
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
healthis 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