Skip to content

Proposal: Scoped automation catalogues, tags, and run history across automations #576

Open

Description

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

Summary

Subscribing to ahp-automations:// returns every automation the client can see, in one snapshot, followed by every change to any of them. That works for a personal host. It doesn't work for a hosted service with thousands of automations across many repositories when the client shows only one repository.

This proposal gives automations a host-owned project, as sessions already have, adds client-editable tags, and adds scoped catalogue channels. A client subscribes to a scoped catalogue by expanding a URI template that the host advertises. A paginated command lists runs across the automations in a catalogue, for dashboards.

Scenarios

  • Scale. A hosted service holds thousands of automations across many repositories and users. The client shows one repository's automations at a time.
  • Grouping. Users organize automations with tags such as "CI triage" or "release", and filter by them.
  • One project view. A client groups a project's sessions and its automations together.
  • Dashboards. A repository dashboard lists every run of that repository's automations, newest first.

AHP today

  • There's one catalogue channel. Its snapshot contains every visible automation, and automation/set for any change goes to every subscriber.
  • SubscribeView has only turns, and it's advisory: servers may ignore it, and clients must accept more state than they asked for.
  • Sessions have a host-owned project (ProjectInfo). Automations have no project and no tags.
  • Run history is per automation (AutomationEntry.runs, fetchAutomationRuns). Merging bounded per-automation windows doesn't give a complete, ordered history across automations.

Proposal

  1. Project. AutomationEntry.project?: ProjectInfo. The host owns it and derives it the same way it derives a session's project, for example from the template's working directories or configuration.
  2. Tags. AutomationDefinition.tags?: string[]. Clients edit them when the host advertises automations.tags, and patches replace the array whole, like other arrays in the definition.
  3. Scoped catalogues. A capability advertises an RFC 6570 URI template for scoped catalogue channels. The protocol defines two variables: {project}, a ProjectInfo.uri, and {tag}, a single tag. Values are encoded by the RFC 6570 rules. Omitting a variable means no filter on it, and setting both means an automation must match both. Clients ignore any other variable, the same rule the OTLP and changeset templates use. Each expanded URI is an ordinary catalogue channel: it has the same AutomationState and the same actions, and its own snapshot and replay, and it contains exactly the automations that match.
  4. Leaving a scope isn't deletion. When an automation starts matching a scoped catalogue (for example, a tag is added), the host adds it with automation/set. When it stops matching, the host removes it with a new server-only action, so clients don't mistake it for automation/removed, which means the automation was permanently deleted.
  5. Routing. Actions and commands that target an existing automation may be sent on any catalogue channel the client is subscribed to that contains it. automation/createRequested and commands that don't target one automation may be sent on any catalogue channel the client is subscribed to. The host echoes an action, or its rejection, on the channel it was dispatched on, and publishes the resulting automation/set on every catalogue channel that contains the automation, including when fetchAutomationRuns loads older runs. Commands still identify automations by their ahp-automation: resource.
  6. The complete catalogue remains. The unscoped ahp-automations:// still contains every visible automation.
  7. Runs across automations. listAutomationRuns, a paginated command on any catalogue channel, returns run summaries across that catalogue's automations, newest first, like listSessions does for sessions. Results are a snapshot. Recent runs stay current through each entry's run window, which automation/set already delivers. For older runs, clients refetch, or subscribe to a run's channel for live state.

Sketch

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

interface AutomationEntry {
  // ...existing fields
  /** Host-owned project, like SessionMetadata.project. */
  project?: ProjectInfo;
}

interface AutomationDefinition {
  // ...existing fields
  tags?: string[];
}

interface AutomationCapabilities {
  // ...existing fields
  /**
   * RFC 6570 template for scoped catalogue channels, for example
   * "ahp-automations://scoped{?project,tag}". Defined variables: {project}, {tag}.
   */
  scopedCatalogue?: string;
  /** Present when definitions may carry tags. */
  tags?: {};
  /** Present when listAutomationRuns is supported. */
  runListing?: {};
}

/** Server-only, on scoped catalogues: the automation no longer matches this scope. */
interface AutomationOutOfScopeAction {
  type: 'automation/outOfScope';
  resource: URI;
}

/** listAutomationRuns, on any catalogue channel */
interface ListAutomationRunsParams extends BaseParams, PaginatedParams {
  channel: URI;
}

interface ListAutomationRunsResult extends PaginatedResult {
  /** Newest first. */
  items: AutomationRunSummary[];
}

Why this shape

  • In AHP, large data is partitioned by channel URI, not filtered per subscriber. SubscribeView is advisory and still leaves the client handling the whole catalogue. Filtering actions for each subscriber would also break the ordered action stream that every subscriber of a channel shares. A separate channel per scope keeps normal snapshot, ordering, and replay semantics.
  • Templated channel URIs already exist. The OTLP logs channel uses a {level} template variable, and changesets advertise a uriTemplate. Both define the variables clients may expand and require clients to ignore the rest.
  • Lists that can be large are paginated commands. listSessions set the pattern for a large, ordered collection that clients fetch on demand and keep current from existing updates.
  • ProjectInfo is already the host's grouping. Reusing it means sessions and automations from the same project group together without a second concept.

Compatibility

  • Additive. A client that ignores the capability keeps using the complete catalogue.
  • Projects and tags are optional fields. Patches leave tags unchanged unless they set it.
  • Client libraries that mirror catalogue state need to keep each catalogue channel's state separately.

Out of scope

  • Saved or arbitrary queries beyond the defined variables.
  • Feeds of received events across automations.

Open questions

  1. Is a separate "left this scope" action worth it, or should automation/removed on a scoped channel mean "no longer in this catalogue"?
  2. Should {tag} be included at first, or only {project}?
  3. At very large scale, may a host make the unscoped catalogue partial, or require scoped subscriptions?
  4. Can an automation belong to more than one project?
  5. Should listAutomationRuns accept filters such as lifecycle status, or rely on scoped channels only?

Related proposals (none required)

Activity

  1. added
    feature-request
    on Nov 6, 2026
  2. benvillalobos commented on Nov 20, 2026

    @benvillalobos
    Member

    How does a client get the {project} value for a folder it has open? Today ProjectInfo exists only on sessions, so a client would have to list sessions or the full catalogue to find it.

    Should this come with a way to resolve project listings?

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

Metadata

Metadata

Labels

feature-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions