Repository navigation
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/updateRequestedpatches apply in server order. When two accepted patches replace the same field, the later one wins. There's no precondition.AutomationEntryhasmodifiedAtbut 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
- Revision token.
AutomationEntry.revisionis an opaque, host-issued token that changes whenever the definition changes, including changes the host makes itself (for example, when a disable condition setsenabledtofalse). Clients MUST NOT interpret it, and it isn't a timestamp. - Optional precondition.
automation/updateRequestedandrunAutomationaccept an optionalexpectedRevision. If it's present and differs from the current revision, the host rejects the request without changing anything: the action is rejected withrejectionReason, and the command fails withConflict(-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 inautomation/set. - 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'sorigin.triggerIdrefers 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 anErrorInfo. - History. When the host advertises it,
listAutomationRevisionsreturns past revisions newest first, paginated likelistSessions. 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. - Restore. Restoring is an ordinary
automation/updateRequestedthat submits the older definition's fields, optionally withexpectedRevisionso 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. - Idempotency comes first.
runAutomationchecksrequestIdbeforeexpectedRevision. A retry of a request that was already admitted returns the original run even if the definition has changed since.expectedRevisionapplies 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.nonceandChangesetOperationTarget.noncesay "If both nonces are present, a mismatch MUST fail withConflict; omission on either side adds no precondition," andresourceWrite.ifMatchworks the same way withetag. 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
revisionbehave exactly as they do today. - No
@exhaustiveenum changes and no new actions.
Open questions
- Name:
revision, ornonceto match AHP's other opaque version tokens, oretag? - Pin at admission (proposed) or at start?
- Should precondition failures on actions carry a machine-readable reason? Today
rejectionReasonis free text everywhere in the protocol. - Should history items say who made each change?
- Should toggling
enabledcreate a revision, given that it's a definition field that can change often?
Related proposals (none required)
- Review-gated changes (Proposal: Review-gated automation definition changes #578) can record the revision a proposed change was based on.
- Run results and read state (Proposal: Automation run results and read state #575): together with a run's revision, a run's results answer "which definition produced this output?"
Activity
connor4312 commentedon Nov 9, 2026
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.
connor4312 commentedon Nov 13, 2026
Xref #578 (comment)
benvillalobos commentedon Nov 18, 2026
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.
timrogers commentedon Nov 18, 2026
Cloud automations does already have a notion of revision history, versioning the prompt, triggers and tools, and many of the other settings 👍🏻