Repository navigation
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/setfor any change goes to every subscriber. SubscribeViewhas onlyturns, 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
- 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. - Tags.
AutomationDefinition.tags?: string[]. Clients edit them when the host advertisesautomations.tags, and patches replace the array whole, like other arrays in the definition. - Scoped catalogues. A capability advertises an RFC 6570 URI template for scoped catalogue channels. The protocol defines two variables:
{project}, aProjectInfo.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 sameAutomationStateand the same actions, and its own snapshot and replay, and it contains exactly the automations that match. - 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 forautomation/removed, which means the automation was permanently deleted. - 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/createRequestedand 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 resultingautomation/seton every catalogue channel that contains the automation, including whenfetchAutomationRunsloads older runs. Commands still identify automations by theirahp-automation:resource. - The complete catalogue remains. The unscoped
ahp-automations://still contains every visible automation. - Runs across automations.
listAutomationRuns, a paginated command on any catalogue channel, returns run summaries across that catalogue's automations, newest first, likelistSessionsdoes for sessions. Results are a snapshot. Recent runs stay current through each entry's run window, whichautomation/setalready 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.
SubscribeViewis 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 auriTemplate. Both define the variables clients may expand and require clients to ignore the rest. - Lists that can be large are paginated commands.
listSessionsset the pattern for a large, ordered collection that clients fetch on demand and keep current from existing updates. ProjectInfois 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
tagsunchanged 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
- Is a separate "left this scope" action worth it, or should
automation/removedon a scoped channel mean "no longer in this catalogue"? - Should
{tag}be included at first, or only{project}? - At very large scale, may a host make the unscoped catalogue partial, or require scoped subscriptions?
- Can an automation belong to more than one project?
- Should
listAutomationRunsaccept filters such as lifecycle status, or rely on scoped channels only?
Related proposals (none required)
- Unattended runs (Proposal: Predictable unattended automation runs #574): a
runAsidentity lets clients filter a catalogue to "my automations" without a new scope variable.
Activity
benvillalobos commentedon Nov 20, 2026
How does a client get the
{project}value for a folder it has open? TodayProjectInfoexists 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?