Skip to content

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

Merged
Megan Rogge (meganrogge) merged 6 commits into
connor4312/ahp-1.1-transitionfrom
agents/adopt-ahp-one-time-triggers
Nov 13, 2026
Merged

Megan Rogge (meganrogge) merged 6 commits into
connor4312/ahp-1.1-transitionfrom
agents/adopt-ahp-one-time-triggers

Conversation

@meganrogge

Copy link
Copy Markdown
Collaborator

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.

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 <[email protected]>
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 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical defects allow manual runs to cancel scheduled occurrences, malformed follow-ups to start new sessions, and concurrent edits to be silently overwritten.

9 open issues
What changed in this PR

Adopts upstream Agent Host Protocol (AHP) one-time triggers for Automations and Send Later, replacing the local protocol patch while retaining VS Code-specific scheduled-chat behavior.

Changes:

  • Syncs AHP 1.2 definitions and makes the sync script’s local patch optional.
  • Moves scheduled-chat purpose, targets, receipts, and capabilities into typed metadata helpers.
  • Migrates stored automations and runs, and updates client projections, documentation, and tests.
File Description
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Uses the typed scheduled-chat origin reader.
src/​vs/​workbench/​contrib/​sessions/​providers/​agentHost/​browser/​agentHostAutomationStore.ts Updates metadata serialization, projection, and capability checks.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Uses the origin helper in cached-session fixtures.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHostAutomationStore.test.ts Updates capability, target, and receipt fixtures.
src/​vs/​sessions/​AUTOMATIONS.md Documents metadata encoding and storage migration.
src/​vs/​platform/​agentHost/​test/​node/​agentHostAutomationService.test.ts Adds migration and metadata-immutability coverage.
src/​vs/​platform/​agentHost/​node/​protocolServerHandler.ts Advertises existing-chat scheduling through initialize metadata.
src/​vs/​platform/​agentHost/​node/​agentService.ts Uses typed automation origins and exposes existing-chat support.
src/​vs/​platform/​agentHost/​node/​agentHostAutomationService.ts Uses metadata-backed scheduling state and migrates legacy records.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​version/​registry.ts Updates the protocol version to 1.2.0.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​common/​commands.ts Adopts upstream one-time capability definitions.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​channels-session/​state.ts Removes the private purpose field from generated origins.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​channels-automation/​state.ts Adopts standard one-time triggers and removes private fields.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​channels-automation/​actions.ts Removes private purpose and conditional-update fields.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​channels-automation-run/​state.ts Updates trigger-origin documentation and removes private run purpose.
src/​vs/​platform/​agentHost/​common/​state/​protocol/​.ahp-version Records the synced upstream revision.
src/​vs/​platform/​agentHost/​common/​meta/​vscode/​agentHostAutomationsMeta.ts Adds scheduled-chat metadata readers, writers, and origin helpers.
src/​vs/​platform/​agentHost/​common/​meta/​agentHostAutomationsMeta.ts Re-exports the new metadata helpers.
src/​vs/​platform/​agentHost/​common/​agentService.ts Adds the existing-conversation support property.
src/​vs/​platform/​agentHost/​common/​agentHostExtensionProtocol.ts Types the new initialize metadata flag.
scripts/​sync-agent-host-protocol.ts Applies the local overlay only when present.
scripts/​agent-host-protocol.patch Deletes the superseded protocol overlay.

Review effort: Max

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

Co-authored-by: Copilot <[email protected]>
@meganrogge
Megan Rogge (meganrogge) marked this pull request as ready for review November 13, 2026 20:23
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ulugbek Abdullaev (@ulugbekna)

Matched files:

  • src/vs/platform/agentHost/common/automationRequest.ts
  • src/vs/platform/agentHost/common/meta/agentHostAutomationsMeta.ts
  • src/vs/platform/agentHost/common/meta/vscode/agentHostAutomationsMeta.ts
  • src/vs/platform/agentHost/common/state/protocol/channels-automation-run/state.ts
  • src/vs/platform/agentHost/common/state/protocol/channels-automation/actions.ts
  • src/vs/platform/agentHost/common/state/protocol/channels-automation/state.ts
  • src/vs/platform/agentHost/node/agentHostAutomationService.ts
  • src/vs/platform/agentHost/test/node/agentHostAutomationService.test.ts

Ben Villalobos (@benvillalobos)

Matched files:

  • src/vs/platform/agentHost/common/automationRequest.ts
  • src/vs/platform/agentHost/common/meta/agentHostAutomationsMeta.ts
  • src/vs/platform/agentHost/common/meta/vscode/agentHostAutomationsMeta.ts
  • src/vs/platform/agentHost/common/state/protocol/channels-automation-run/state.ts
  • src/vs/platform/agentHost/common/state/protocol/channels-automation/actions.ts
  • src/vs/platform/agentHost/common/state/protocol/channels-automation/state.ts
  • src/vs/platform/agentHost/node/agentHostAutomationService.ts
  • src/vs/platform/agentHost/test/node/agentHostAutomationService.test.ts

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 <[email protected]>
@meganrogge
Megan Rogge (meganrogge) merged commit e3d8e29 into connor4312/ahp-1.1-transition Nov 13, 2026
2 of 4 checks passed
@meganrogge
Megan Rogge (meganrogge) deleted the agents/adopt-ahp-one-time-triggers branch November 13, 2026 21:47
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.

2 participants