Skip to content

Proposal: Automation definition revisions and run pinning #571

Open

Description

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

Summary

Automation definitions in AHP have no version identity. When two clients edit the same field at the same time, the later write silently wins. Runs don't record which definition they executed, and there's no history to audit or restore.

This proposal adds an opaque revision token to each catalogue entry and an optional revision precondition on updates and manual runs, following AHP's changeset nonce precondition. Each run records the revision it executes (the one current when the run was admitted), and hosts can offer a paginated revision history. Restoring an old revision is an ordinary update.

Scenarios

  • Concurrent edits. Two maintainers edit the same prompt at the same time. The second save should fail visibly instead of silently discarding the first.
  • Audit. "Which version of the prompt produced last Tuesday's bad pull request?"
  • Rollback. Restore the configuration from before yesterday's edit.
  • Edits while a run waits. A run is admitted, the author then changes the message, and then the run starts. Which definition does it execute?
  • Run what I reviewed. A user reviews a definition and clicks Run. The run should fail rather than execute a definition someone changed a moment earlier.

AHP today

  • automation/updateRequested patches apply in server order. When two accepted patches replace the same field, the later one wins. There's no precondition.
  • AutomationEntry has modifiedAt but no revision identity.
  • A run records origin.triggerId, but after an edit that trigger can be removed, or its id reused with a different meaning. Nothing records which definition the run executed.
  • The spec says the host revalidates selections when each run starts, but not whether the run uses the definition as of admission or as of start.

Proposal

  1. Revision token. AutomationEntry.revision is an opaque, host-issued token that changes whenever the definition changes, including changes the host makes itself (for example, when a disable condition sets enabled to false). Clients MUST NOT interpret it, and it isn't a timestamp.
  2. Optional precondition. automation/updateRequested and runAutomation accept an optional expectedRevision. If it's present and differs from the current revision, the host rejects the request without changing anything: the action is rejected with rejectionReason, and the command fails with Conflict (-32011). Omitting it adds no precondition, so ordered-patch behavior doesn't change for clients that don't opt in. A client can tell that its update was rejected for staleness by comparing the revision it sent with the current one, which arrives in automation/set.
  3. Run pinning. AutomationRunState.revision (mirrored on the summary) is the revision that was current when the run was admitted, that is, when its durable record was created. Admission pins the run to that revision's definition, including the captured customization copies it uses: the host keeps what it needs to start the run even if the definition changes or the copies are replaced before the run starts. The run's origin.triggerId refers to a trigger in that revision. The host still revalidates provider, model, agent, directories, and configuration at start (the existing rule), and a run whose pinned definition can no longer start fails with an ErrorInfo.
  4. History. When the host advertises it, listAutomationRevisions returns past revisions newest first, paginated like listSessions. Each item is { revision, definition, modifiedAt }. Retention is host-defined, and the capability may advertise it. A run's pinned revision can be looked up for as long as the host retains it. Without history, a run's revision still tells clients whether the run executed the current definition, but not what an older definition contained.
  5. Restore. Restoring is an ordinary automation/updateRequested that submits the older definition's fields, optionally with expectedRevision so it doesn't overwrite a newer edit by accident. No new action is needed. Hosts that offer history SHOULD retain the captured customization copies that retained revisions refer to, so a restore reuses them. If a copy is gone, the existing capture rule applies: the host captures the entry again from the dispatching client, and rejects the restore if that client can't serve it.
  6. Idempotency comes first. runAutomation checks requestId before expectedRevision. A retry of a request that was already admitted returns the original run even if the definition has changed since. expectedRevision applies only when a new run would be created.

Sketch

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

interface AutomationEntry {
  // ...existing fields
  /** Opaque token. Changes whenever the definition changes. */
  revision?: string;
}

interface AutomationUpdateRequestedAction {
  // ...existing fields
  /** Reject unchanged if this isn't the current revision. */
  expectedRevision?: string;
}

interface RunAutomationParams {
  // ...existing fields
  /** Fail with Conflict if this isn't the current revision. */
  expectedRevision?: string;
}

interface AutomationRunState {
  // ...existing fields
  /** Definition revision current when this run was admitted. */
  revision?: string;
}

/** listAutomationRevisions, on ahp-automations:// */
interface ListAutomationRevisionsParams extends BaseParams, PaginatedParams {
  channel: 'ahp-automations://';
  automation: URI;
}

interface ListAutomationRevisionsResult extends PaginatedResult {
  items: { revision: string; definition: AutomationDefinition; modifiedAt: string }[];
}

interface AutomationCapabilities {
  // ...existing fields
  revisionHistory?: { retention?: number };
}

Why this shape

  • AHP already uses opaque version tokens with optional preconditions. ChangesetFile.nonce and ChangesetOperationTarget.nonce say "If both nonces are present, a mismatch MUST fail with Conflict; omission on either side adds no precondition," and resourceWrite.ifMatch works the same way with etag. Definitions follow the same semantics.
  • Opting in keeps today's model intact. Ordered patches still compose edits to different fields. The precondition is for clients that want lost-update protection, such as full-form editors or restores.
  • Pinning at admission is deterministic. A run's provenance (trigger, time, and now definition) is fixed when it's created. Start-time revalidation keeps its current role: checking that the pinned selections are still available and allowed.
  • History is a paginated command, not state. Like the session list, it can be large, and clients need it only on demand.

Compatibility

  • Additive and optional everywhere. Clients that ignore revision behave exactly as they do today.
  • No @exhaustive enum changes and no new actions.

Open questions

  1. Name: revision, or nonce to match AHP's other opaque version tokens, or etag?
  2. Pin at admission (proposed) or at start?
  3. Should precondition failures on actions carry a machine-readable reason? Today rejectionReason is free text everywhere in the protocol.
  4. Should history items say who made each change?
  5. Should toggling enabled create a revision, given that it's a definition field that can change often?

Related proposals (none required)

Activity

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

    @connor4312
    Member

    Is this something we see real demand for? Just looking at a cadre of existing apps -- GH Copilot, ChatGPT/Codex, Claude -- none have automation versioning. Indeed in this direction one could go the direction of saying we should have versioning for lots of things, like settings, draft message revisions, and so on.

    From a agentic product direction, I tend to think of specific text of automations and messages as ephemeral things. If I don't like them, I'm just going to ask my agents to fix them. As a user I'm not going to be going through a rolodex of past automation versions or pinning specific versions -- I'm probably not even going to look at them beyond perhaps my initial setup.

  3. connor4312 commented on Nov 13, 2026

    @connor4312
    Member
  4. added
    info-needed
    under-discussion
    on Nov 13, 2026
  5. benvillalobos commented on Nov 18, 2026

    @benvillalobos
    Member

    I'm not sure if this is implemented already in cloud automations, but I recall Tim Rogers (@timrogers) mentioning this. I can see the use case for something like this, but I think it applies more strongly to something like shared automations.

    In all of my scenarios this seems like a nice to have, but as Connor mentioned I don't see the practical use case without going all-in on showing revision history.

  6. timrogers commented on Nov 18, 2026

    @timrogers

    Cloud automations does already have a notion of revision history, versioning the prompt, triggers and tools, and many of the other settings 👍🏻

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

Metadata

Metadata

Labels

feature-requestinfo-neededunder-discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions