Add automation disable conditions for run limits and end dates - #461
Merged
Ben Villalobos (benvillalobos) merged 8 commits intoSep 24, 2026
Merged
Ben Villalobos (benvillalobos) merged 8 commits into
Ben Villalobos (benvillalobos) merged 8 commits into
Conversation
Adds AutomationDefinition.scheduledRunLimit (optional cap on scheduled runs), AutomationEntry.scheduledRunCount (host-owned usage), an AutomationScheduledRunLimitPatch discriminated union (set/clear/omit) on the definition patch, and an AutomationCapabilities.scheduledRunLimits presence capability. Additive and optional; PROTOCOL_VERSION unchanged. Union registered in all five generators; all six clients + schema regenerated. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d158af7a-b861-4b5a-9f66-a0501b92312a
uvrnv2856-wq
approved these changes
Sep 23, 2026
|
Pull Request #461, opened by Ben Villalobos, implements a new feature to
enforce limits on scheduled automation runs within the
microsoft/agent-host-protocol automation channel.Key Implementation Details
The update introduces several specific changes to the protocol surface:
- *Run Limits:* Added AutomationDefinition.scheduledRunLimit as an
optional, positive-integer cap that applies only to trigger-created runs;
manual runs remain unaffected and do not consume this allowance.
- *Usage Tracking:* Added AutomationEntry.scheduledRunCount as a
host-owned, authoritative counter for current usage. Clients are intended
to calculate remaining allowance as scheduledRunLimit -
scheduledRunCount rather
than maintaining their own count.
- *Design & Compatibility:* The PR uses a discriminated union for
patching to prevent invalid "set-and-clear-at-once" states. The changes are
fully additive, allowing the protocol version to remain at 0.9.0.
- *Capability Gating:* Introduced
AutomationCapabilities.scheduledRunLimits to allow hosts to explicitly
advertise support for this enforcement.
Review Discussion
Reviewer Connor Peet provided feedback regarding the implementation:
- *Naming Conventions:* He suggested renaming scheduledRunLimit and
scheduledRunCount to runLimit and runCount, noting that since
automations are inherently schedule-driven, the "scheduled" prefix is
redundant.
- *Patch Semantics:* He recommended utilizing a 0 semantic for the patch
to keep the event consistent as a mergeable patch.
- *Capability Necessity:* He questioned whether the explicit
scheduledRunLimits capability flag is strictly necessary, noting that
since the automations channel is still experimental, they might not need
granular capability gating.
The pull request has been approved by uvrnv2856-wq.
…On Tue, Sep 22, 2026 at 10:38 PM uvrnv2856-wq ***@***.***> wrote:
***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#461?email_source=notifications&email_token=CHDSE56FHIPW5KUAGN4BSK35QNATNA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMRYGY3DCNZUGE22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#pullrequestreview-5286617415>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CHDSE533WP45ITU3FZNQVVT5QNATNAVCNFSNUABGKJSXA33TNF2G64TZHMYTCOBQGMZTCNJXGE5US43TOVSTWNJVGQ3DMOBUGY4TFILWAI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
Pull Request #461, opened by Ben Villalobos, implements a new feature to
enforce limits on scheduled automation runs within the
microsoft/agent-host-protocol automation channel.Key Implementation Details
The update introduces several specific changes to the protocol surface:
- *Run Limits:* Added AutomationDefinition.scheduledRunLimit as an
optional, positive-integer cap that applies only to trigger-created runs;
manual runs remain unaffected and do not consume this allowance.
- *Usage Tracking:* Added AutomationEntry.scheduledRunCount as a
host-owned, authoritative counter for current usage. Clients are intended
to calculate remaining allowance as scheduledRunLimit -
scheduledRunCount rather
than maintaining their own count.
- *Design & Compatibility:* The PR uses a discriminated union for
patching to prevent invalid "set-and-clear-at-once" states. The changes are
fully additive, allowing the protocol version to remain at 0.9.0.
- *Capability Gating:* Introduced
AutomationCapabilities.scheduledRunLimits to allow hosts to explicitly
advertise support for this enforcement.
Review Discussion
Reviewer Connor Peet provided feedback regarding the implementation:
- *Naming Conventions:* He suggested renaming scheduledRunLimit and
scheduledRunCount to runLimit and runCount, noting that since
automations are inherently schedule-driven, the "scheduled" prefix is
redundant.
- *Patch Semantics:* He recommended utilizing a 0 semantic for the patch
to keep the event consistent as a mergeable patch.
- *Capability Necessity:* He questioned whether the explicit
scheduledRunLimits capability flag is strictly necessary, noting that
since the automations channel is still experimental, they might not need
granular capability gating.
The pull request has been approved by uvrnv2856-wq.
On Wed, Sep 23, 2026 at 12:04 AM jack freeman ***@***.***>
wrote:
… Pull Request #461, opened by Ben Villalobos, implements a new feature to
enforce limits on scheduled automation runs within the
microsoft/agent-host-protocol automation channel.Key Implementation
Details
The update introduces several specific changes to the protocol surface:
- *Run Limits:* Added AutomationDefinition.scheduledRunLimit as an
optional, positive-integer cap that applies only to trigger-created runs;
manual runs remain unaffected and do not consume this allowance.
- *Usage Tracking:* Added AutomationEntry.scheduledRunCount as a
host-owned, authoritative counter for current usage. Clients are intended
to calculate remaining allowance as scheduledRunLimit -
scheduledRunCount rather than maintaining their own count.
- *Design & Compatibility:* The PR uses a discriminated union for
patching to prevent invalid "set-and-clear-at-once" states. The changes are
fully additive, allowing the protocol version to remain at 0.9.0.
- *Capability Gating:* Introduced
AutomationCapabilities.scheduledRunLimits to allow hosts to explicitly
advertise support for this enforcement.
Review Discussion
Reviewer Connor Peet provided feedback regarding the implementation:
- *Naming Conventions:* He suggested renaming scheduledRunLimit and
scheduledRunCount to runLimit and runCount, noting that since
automations are inherently schedule-driven, the "scheduled" prefix is
redundant.
- *Patch Semantics:* He recommended utilizing a 0 semantic for the
patch to keep the event consistent as a mergeable patch.
- *Capability Necessity:* He questioned whether the explicit
scheduledRunLimits capability flag is strictly necessary, noting that
since the automations channel is still experimental, they might not need
granular capability gating.
The pull request has been approved by uvrnv2856-wq.
On Tue, Sep 22, 2026 at 10:38 PM uvrnv2856-wq ***@***.***>
wrote:
> ***@***.**** approved this pull request.
>
> —
> Reply to this email directly, view it on GitHub
> <#461?email_source=notifications&email_token=CHDSE56FHIPW5KUAGN4BSK35QNATNA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTKMRYGY3DCNZUGE22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#pullrequestreview-5286617415>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/CHDSE533WP45ITU3FZNQVVT5QNATNAVCNFSNUABGKJSXA33TNF2G64TZHMYTCOBQGMZTCNJXGE5US43TOVSTWNJVGQ3DMOBUGY4TFILWAI>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
Replace the scheduled-run cap patch union with disableConditions arrays, enforce unique condition kinds in schemas, preserve empty-array clearing across clients, and update documentation and conformance fixtures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d158af7a-b861-4b5a-9f66-a0501b92312a
Use MaxRuns/maxRuns for the enum and wire discriminant, rename AutomationMaxRunsCondition consistently, and refresh generated clients, schemas, documentation, and fixtures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d158af7a-b861-4b5a-9f66-a0501b92312a
Ben Villalobos (benvillalobos)
marked this pull request as ready for review
September 23, 2026 23:32
Ben Villalobos (benvillalobos)
requested a review
from roblourens
as a code owner
September 23, 2026 23:32
Ben Villalobos (benvillalobos)
requested a review
from Connor Peet (connor4312)
September 24, 2026 17:31
Use afterRuns/max, afterDate/date, and runCount consistently across the protocol, generated clients, fixtures, and documentation. Preserve the existing allowance and disable-condition semantics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ben Villalobos (benvillalobos)
requested a review
from Connor Peet (connor4312)
September 24, 2026 19:03
Connor Peet (connor4312)
previously approved these changes
Sep 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ben Villalobos (benvillalobos)
enabled auto-merge
September 24, 2026 20:48
Michael Lively (Yoyokrazy)
approved these changes
Sep 24, 2026
Connor Peet (connor4312)
approved these changes
Sep 24, 2026
Ben Villalobos (benvillalobos)
deleted the
benvillalobos-automation-run-limits-investigation
branch
September 24, 2026 21:08
Sukanth Gunda (sukanth)
added a commit
to sukanth/agent-host-protocol
that referenced
this pull request
Sep 25, 2026
Upstream landed microsoft#461 (scheduled automation run limits), which again touches `scripts/generate-csharp.ts` and adds round-trip fixtures numbered 045-050. The merge itself is clean, and regeneration shows the two generator changes still compose: upstream's new `AutomationAfterRunsCondition` / `AutomationAfterDateCondition` records pick up this branch's pinned discriminator automatically, so types added after that fix do not reintroduce the zero-value defect. Last tick this branch renumbered its fixtures to dodge a collision with microsoft#450. That turns out to be a treadmill worth stepping off: `upstream/main` already carries nine duplicate numeric prefixes (019, 030, 031, 041, and 045-049), several created by microsoft#461 and microsoft#450 colliding with each other. Prefixes are assigned per-branch, so any parallel PR can take a number, and chasing that costs a rename plus a full CI run every time. Rather than renumber again, this makes the references stable: the corpus doc and the fixture cross-references now name fixtures by filename instead of "fixture NNN", with a note recording why. The fixture files themselves are left alone, matching how the repository already tolerates shared prefixes. Verified on the merged tree: root suite 471 pass, .NET 0 failed, plus Rust, Go, TypeScript, Kotlin, and Swift green. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional automation disable conditions for a scheduled-run cap (
afterRuns), a deadline (afterDate), or both, plus a durable host-owned scheduled-run usage counter. Conditions combine with logical OR: the first condition met disables automatic scheduling.Protocol surface
AutomationDisableConditionKinddefinesAfterRuns = 'afterRuns'andAfterDate = 'afterDate'.AutomationDisableConditionis the discriminated union ofAutomationAfterRunsCondition(kind: AutomationDisableConditionKind.AfterRuns,max: number, a positive integer) andAutomationAfterDateCondition(kind: AutomationDisableConditionKind.AfterDate,date: string, an ISO 8601 timestamp).AutomationDefinition.disableConditions?: AutomationDisableCondition[]contains{ kind: "afterRuns", max }and/or{ kind: "afterDate", date }. Each kind may appear at most once. An absent field or[]means no automatic disable conditions.AutomationDefinitionPatch.disableConditions?: AutomationDisableCondition[]uses the existingautomation/updateRequestedaction. Omission leaves conditions unchanged, a supplied array replaces all conditions, and[]clears them. No dedicated set/clear action or sentinel value is needed.AutomationEntry.runCount?: numberis authoritative usage for the currentafterRunsallowance, not a lifetime total. Clients never maintain their own counter or reconstruct it from the bounded run-history window.Behavior
enabledtofalseand retains the definition and its conditions. Manual runs neither consume the allowance nor become blocked by these conditions.afterRunswhen absent, or transitioning from disabled to enabled with anafterRunscondition, starts a fresh allowance. Editing an existing cap, changing only theafterDatecondition, or reordering conditions preserves usage. RemovingafterRunsremoves the count.afterDatecondition remains in the definition, so clients should warn before re-enabling.Implementation
[]reliably clears conditions.Compatibility
The new definition, patch, and entry fields are optional.
PROTOCOL_VERSIONremains 0.9.0. Existing update requests and authoritativeautomation/setbroadcasts carry the change; no newActionTypeor reducer behavior is required. This supersedes the earlier unmergedscheduledRunLimit/ set-or-clear patch design in this draft.Validation
npm run generateregenerated all six client mirrors, schemas, and reference docs.npm test: 466 passing; includes typecheck, lint, schema checks, generated-output verification, changelog-fragment verification, and 100% reducer coverage. Schema tests also reject the superseded condition discriminants and payload names.npx vitepress build docspassed.go test ./ahptypes ./ahp -count=1passed.FixtureDrivenReducerTestandRoundTripCorpusTestpassed with JDK 17.