Skip to content

automations: add one-time triggers - #603

Merged
Megan Rogge (meganrogge) merged 6 commits into
mainfrom
agents/scheduled-chat-protocol-347963
Nov 13, 2026
Merged

Megan Rogge (meganrogge) merged 6 commits into
mainfrom
agents/scheduled-chat-protocol-347963

Conversation

@meganrogge

@meganrogge Megan Rogge (meganrogge) commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Upstreams the protocol piece of microsoft/vscode#347963 (Send Later) and microsoft/vscode#348175 (agent-authored scheduling) so it no longer lives as a one-off edit to VS Code's generated protocol definitions.

  • Adds AutomationTriggerKind.OneTime and AutomationOneTimeTrigger { id, kind: 'oneTime', runAt, misfirePolicy? }.
  • The trigger fires at most once for a given runAt. Updating runAt schedules a new occurrence. Missed times follow the existing misfirePolicy (default runOnce), and the run records runAt as origin.scheduledFor.
  • Hosts advertise support with the presence capability AutomationCapabilities.oneTime.
  • Updates the guide, specification, schemas, all six generated clients, and adds round-trip fixtures 097 (catalogue snapshot) and 098 (capability).

Per review, this no longer includes a scheduled-chat purpose, existing-conversation targets (to be proposed separately; see #572), dispatch receipts, expectedModifiedAt, manual-run restrictions, or client/reconnect capabilities.

Discussion / compatibility

  • AutomationTriggerKind is @exhaustive, so older native clients will reject catalogues that contain a oneTime trigger. Support is advertised only through the host capability.
  • When VS Code syncs this, it needs code changes, because its copy of the protocol has fields this PR no longer adds:

Validation

  • npm run generate — passed.
  • npm test — passed, 667 tests.
  • cd clients/typescript && npm test && npm run build — passed, 79 tests.
  • cd clients/go && go test ./... — passed, including the shared round-trip corpus.
  • cargo test --manifest-path clients/rust/Cargo.toml --workspace and cargo fmt --all -- --check — passed.
  • Swift AgentHostProtocol target build — passed. XCTest is unavailable on this machine.
  • Kotlin and .NET were not run locally because no JDK or .NET SDK is installed.

Define the capability-gated contract consumed by VS Code Send Later and agent-authored scheduling, including durable admission and dispatch receipts, exact conversation targets, and guarded updates. Regenerate native models and add shared wire fixtures and compatibility documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep essential field constraints and cross-references in source comments while leaving detailed lifecycle rules in the guide and specification. Regenerate client documentation and schema descriptions without changing protocol or code tokens.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new oneTime variant can cause older native clients to reject entire automation snapshots or updates because publication is not gated by a client-declared capability.

4 open issues
What changed in this PR

This draft brings VS Code’s one-time scheduled-chat additions into the canonical AHP protocol, covering new-session execution and queued delivery to existing chats. It includes no host scheduler implementation or protocol-version change.

Changes:

  • Adds one-time trigger capabilities, scheduled-chat provenance, and exact existing-chat targets.
  • Defines atomic admission, stable retries, durable dispatch receipts, and conditional updates.
  • Updates generators, native models, schemas, documentation, and shared round-trip fixtures.
File Description
types/​test-cases/​round-trips/​100-scheduled-chat-cancellation.json Covers guarded cancellation.
types/​test-cases/​round-trips/​099-scheduled-chat-new-session.json Covers captured new-session configuration.
types/​test-cases/​round-trips/​098-scheduled-chat-session-provenance.json Covers durable session provenance.
types/​test-cases/​round-trips/​097-scheduled-chat-run-provenance.json Covers catch-up run provenance.
types/​test-cases/​round-trips/​096-scheduled-chat-conditional-update.json Covers guarded rescheduling.
types/​test-cases/​round-trips/​095-one-time-dispatch-receipts.json Covers dispatched, rejected, and uncertain outcomes.
types/​test-cases/​round-trips/​094-scheduled-chat-create.json Covers exact existing-chat targets.
types/​test-cases/​round-trips/​043-automation-capabilities.json Adds capability round-trip coverage.
types/​common/​commands.ts Defines the new host capabilities.
types/​channels-session/​state.ts Adds scheduled-chat session provenance.
types/​channels-automation/​state.ts Defines triggers, targets, purpose, and receipts.
types/​channels-automation/​commands.ts Specifies shared manual admission semantics.
types/​channels-automation/​actions.ts Adds guarded updates and create-retry rules.
types/​channels-automation-run/​state.ts Adds run purpose and one-time provenance.
scripts/​generate-swift.ts Registers new Swift models and variants.
scripts/​generate-rust.ts Registers new Rust models and variants.
scripts/​generate-kotlin.ts Registers new Kotlin models and variants.
scripts/​generate-go.ts Registers new Go models and variants.
scripts/​generate-csharp.ts Registers new .NET models and variants.
schema/​state.schema.json Regenerates automation state schemas.
schema/​notifications.schema.json Updates embedded automation schemas.
schema/​errors.schema.json Updates embedded protocol schemas.
schema/​commands.schema.json Updates capability and command schemas.
schema/​actions.schema.json Updates action and embedded state schemas.
docs/​specification/​automation-run-channel.md Documents provenance and delivery-only completion.
docs/​specification/​automation-channel.md Specifies scheduling and delivery contracts.
docs/​guide/​automations.md Explains capabilities, recovery, and compatibility.
docs/​.changes/​20261113-one-time-scheduled-chats.json Records the protocol feature addition.
clients/​swift/​AgentHostProtocol/​Sources/​AgentHostProtocol/​Generated/​State.generated.swift Generates Swift automation state models.
clients/​swift/​AgentHostProtocol/​Sources/​AgentHostProtocol/​Generated/​Commands.generated.swift Generates Swift capability models.
clients/​swift/​AgentHostProtocol/​Sources/​AgentHostProtocol/​Generated/​Actions.generated.swift Adds the Swift update guard.
clients/​rust/​crates/​ahp/​tests/​hosts.rs Updates capability test construction.
clients/​rust/​crates/​ahp-types/​src/​state.rs Generates Rust automation state models.
clients/​rust/​crates/​ahp-types/​src/​commands.rs Generates Rust capabilities and command documentation.
clients/​rust/​crates/​ahp-types/​src/​actions.rs Adds the Rust update guard.
clients/​kotlin/​src/​main/​kotlin/​com/​microsoft/​agenthostprotocol/​generated/​State.generated.kt Generates Kotlin automation state models.
clients/​kotlin/​src/​main/​kotlin/​com/​microsoft/​agenthostprotocol/​generated/​Commands.generated.kt Generates Kotlin capability models.
clients/​kotlin/​src/​main/​kotlin/​com/​microsoft/​agenthostprotocol/​generated/​Actions.generated.kt Adds the Kotlin update guard.
clients/​go/​ahptypes/​state.generated.go Generates Go automation state models.
clients/​go/​ahptypes/​commands.generated.go Generates Go capabilities and command documentation.
clients/​go/​ahptypes/​actions.generated.go Adds the Go update guard.
clients/​dotnet/​src/​AgentHostProtocol.Abstractions/​Generated/​State.generated.cs Generates .NET automation state models.
clients/​dotnet/​src/​AgentHostProtocol.Abstractions/​Generated/​JsonSerializerContext.generated.cs Registers new models for serialization.
clients/​dotnet/​src/​AgentHostProtocol.Abstractions/​Generated/​Commands.generated.cs Generates .NET capabilities and command documentation.
clients/​dotnet/​src/​AgentHostProtocol.Abstractions/​Generated/​Actions.generated.cs Adds the .NET update guard.

Review effort: Max

Comment thread types/channels-automation/state.ts Resolved
Comment thread types/channels-automation/actions.ts Resolved
Comment thread types/channels-automation/state.ts Resolved
Comment thread types/common/commands.ts Resolved
Require explicit client acknowledgement on initialize and reconnect. Project capabilities, snapshots, live actions, and replay for legacy readers; require fresh initialization when the catalogue view changes. Add mixed-client regression coverage and shared acknowledgement fixtures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make purpose creation-only, preserve unknown conversation-target members, and nest existing-conversation support under the one-time capability. Regenerate native models and align the shared fixtures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread types/channels-automation-run/state.ts Resolved
Comment thread types/channels-automation/actions.ts Resolved
Comment thread types/channels-automation/commands.ts Resolved
Comment thread types/channels-automation/state.ts Resolved
Comment thread types/channels-automation/state.ts Resolved
Comment thread types/channels-automation/state.ts Resolved
Comment thread types/channels-session/state.ts Resolved
Comment thread types/common/commands.ts Resolved
Comment thread types/common/commands.ts Resolved
Comment thread types/common/commands.ts Resolved
@jackfreemanceo-dotcom

This comment was marked as spam.

Per review, keep only the oneTime trigger kind and its host capability. Drop purpose/provenance fields, existing-conversation targets (covered by #604), dispatch receipts, conditional updates, manual-run restrictions, and client/reconnect capabilities with their projection helpers. One-time triggers reuse misfirePolicy for missed times.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meganrogge Megan Rogge (meganrogge) changed the title automations: upstream one-time scheduled chat protocol automations: add one-time triggers Nov 13, 2026
@jackfreemanceo-dotcom

This comment was marked as spam.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meganrogge
Megan Rogge (meganrogge) merged commit f1f4d4a into main Nov 13, 2026
9 checks passed
@meganrogge
Megan Rogge (meganrogge) deleted the agents/scheduled-chat-protocol-347963 branch November 13, 2026 19:37
Megan Rogge (meganrogge) added a commit to microsoft/vscode that referenced this pull request Nov 13, 2026
Adopts the upstreamed one-time trigger
(microsoft/agent-host-protocol#603) on top of #348236, replacing the
local protocol patch that preserved the Send Later edits from #347963.

### What changed
- Ran `scripts/sync-agent-host-protocol.ts` against AHP `main`
(`f1f4d4ac`) and deleted `scripts/agent-host-protocol.patch`. The sync
script now applies that patch only when it exists.
- AHP now defines only `oneTime` triggers and `automations.oneTime`.
Generic "run once" automations also use `oneTime` triggers, so a
scheduled chat can't be inferred from the trigger. The VS Code-only
state moves into namespaced `_meta` through helpers in
`agentHostAutomationsMeta.ts`:
- Scheduled-chat purpose: `vscode.scheduledChat` on definition and run
`_meta`.
- Existing-chat target: `vscode.scheduledChatConversation` on definition
`_meta`.
- Admission and dispatch receipts: `vscode.oneTimeReceipts` on entry
`_meta`.
- Existing-chat support: the `vscode.scheduledChatExistingConversation`
initialize `_meta` flag.
- `AutomationSessionOrigin` has no `_meta`, so `purpose` stays on the
session origin as a typed VS Code extension member
(`IAgentHostAutomationSessionOrigin`).
- `expectedModifiedAt` is removed, per AHP review. The host still
rejects edits once a one-time run has been admitted, and it now rejects
updates that change scheduled-chat purpose or target through `_meta`.
- Hosts migrate stored Automations and runs from the earlier top-level
fields into `_meta` on load, so already-scheduled chats keep working.

### Testing
- `pnpm run typecheck-client`: passed.
- `pnpm run oxlint <changed files>`: passed.
- `./scripts/test.sh --reporter dot` with `agentHostAutomationService`,
`agentHostAutomationStore`, `localAgentHostSessionsProvider`,
`automationTools`, `scheduledChatsService`, `automationRunner`,
`cloudAutomationStore`, `protocolServerHandler`,
`agentHostAutomationsMeta`, `agentHostCatalogProjection`, and
`automationsView`: **1879 passing, 12 pending**.
- Added tests for migrating legacy stored fields and for scheduled-chat
purpose and target immutability.

No manual UI validation was done.
Connor Peet (connor4312) added a commit that referenced this pull request Nov 13, 2026
Resolve generator capability-list conflicts with the one-time trigger work (#603), renumber the chat target fixture to 099, and regenerate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
manabu-nakamura pushed a commit to manabu-nakamura/vscode that referenced this pull request Nov 13, 2026
…8236)

* Adopt released AHP 1.1.0 protocol

Sync the published protocol definitions, adopt renamed wire fields and dedicated annotation channels, and preserve existing automation extensions during regeneration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: adopt AHP 1.1 with transition compatibility

Keep connections to pre-sync agent hosts working during the AHP 1.1 transition.

- Send both frame-limit field names and accept either name in channel negotiation.
- Read legacy canvas sources and editing flags. Publish aliases for older clients.
- Use advertised annotation resources, with a fallback for older native hosts.
- Keep transition helpers in one module with a note to remove them after migration.
- Add mixed-version tests for subscriptions, reconnects, TCP, canvases, and edit review.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: fix feedback ownership assertion

Check stored annotation state instead of the lazy channel snapshot.

- Keep the peer-chat ownership regression check with dedicated annotation channels.
- Preserve empty snapshots for unwritten annotation resources.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: adopt AHP one-time triggers for scheduled chats

Sync AHP with the upstreamed one-time trigger (microsoft/agent-host-protocol#603) and drop the local protocol patch. VS Code-only scheduled-chat state (purpose, existing-chat target, admission and dispatch receipts, existing-chat support) moves into namespaced _meta, the session origin keeps purpose as a VS Code extension member, and conditional updates are removed. Hosts migrate previously stored top-level fields on load.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: keep sync script comment on one line

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: honor one-time skip misfires and offset run times

AHP one-time triggers reuse misfirePolicy and allow any ISO 8601 runAt. Skip occurrences missed while unavailable, accept explicit UTC offsets, and normalize run times to UTC.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: reject malformed scheduled-chat targets

A malformed existing-chat target in _meta must not silently fall back to creating a new session.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: derive scheduled-chat delivery from run state

Drop the dispatched/rejected receipts: run lifecycle and session linkage already show whether a one-time message was sent. Merge the scheduled-chat marker and existing-chat target into one _meta entry and keep only the admitted-run id.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: fix annotations channel discovery and rebinding

Keep dedicated annotations channels usable through discovery and metadata changes.

- Include the channel summary in discovered-session notifications without database reads.
- Notify catalogue observers after annotations change on an evicted session.
- Rebind feedback subscriptions when the advertised resource changes.
- Add focused regression coverage without changing annotation persistence.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent host: fix negotiated protocol version assertion

Use the negotiated protocol constant instead of a stale version literal in the multiple-provider capability test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: meganrogge <merogge@microsoft.com>
Co-authored-by: Megan Rogge <megan.rogge@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants