Skip to content

AIFACTORY-FEAT-171: Worker template: the Factory worker profile on the Orleans messaging profile

Generated from the architecture model

This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.

A design artefact, not a tracker

This backlog is generated from model/backlog/ and validated against the architecture model. No work item exists in any tracker, and no item carries a date, an estimate or an assignee (ADR-0029).

Epic Ecosystem component extensions · Increment I0 Readiness · State elaborated · Route backend-developer · Phase before development · Build order 18 of 185 (Templates and libraries)

Before development

Template or library work: every task of this feature changes a template or a shared library the Factory builds on, and it lands before the Factory's own repositories of I0 are developed. The mark travels with every task (tag phase:before-development).

The runtime worker, the reconcilers and the dispatchers of the Factory are scaffolded from the worker template (AgentRuntimeService names it). The template's own control-plane backlog (docs/Control Plane) has landed drain and work-aware readiness, the idempotency store, the worker-owned failed-work record, the job catalog with Hangfire and PeriodicTimer adapters, the singleton lease, the shard filter, the ops surface and the MCP tools, so the Factory inherits a real worker. What it does not have is the Factory's shape: its trigger adapters are MassTransit, NServiceBus, Hangfire, PeriodicTimer and config-only Azure queues, while Factory messages travel on the Orleans messaging profile under the accepted envelope (ADR-0012, ADR-0014, ADR-0024); failed work and processed messages carry no tenant or project; the WorkerOps policy is the template's own rather than the Factory operator role of the token contract; and three of its own gaps stay open (the Jobs table is not the runtime catalog, the bound Scale options are missing from the generated settings, Hangfire recurring execution skips the lease). Component: WorkerTemplate (extend).

Delivers —
Stubs —
Realizes components: cmp-worker-template
adrs: ADR-0012, ADR-0014, ADR-0024, ADR-0028
Requirements —
Depends on AIFACTORY-FEAT-172 Workers.Runtime library: the worker engine published and shaped for Factory services
AIFACTORY-FEAT-157 Base template: the Factory service profile
AIFACTORY-FEAT-162 Authorization server template: the Factory token contract, workload identity and delegation
Sources model/components.yaml, ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md, ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md, ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md

AIFACTORY-US-209: Worker template: a work trigger over the Orleans messaging profile reads the envelope identity into the dispatch and honours pause, drain and replay

enabling · persona asset-maintainer As an asset maintainer, I want the worker template to take its message-shaped work from the Orleans messaging profile through the same trigger contract as its other adapters, so that a Factory worker consumes Factory messages under the accepted envelope without a broker and without a second dispatch path.

The worker-core page of the worker template describes the trigger contract of the worker: a trigger has a name that is stored as the source of failed work, an enabled flag, a flag that says whether it accepts new work, a dispatch operation and a replay operation, and the adapters of the first version are MassTransit, NServiceBus, Hangfire, the periodic timer and two Azure queue listeners. The messaging choice of the template offers None, NServiceBus and MassTransit. Factory messages travel on the Orleans messaging profile, which ADR-0012 and ADR-0024 make the default of Factory hosts, under the run event envelope of the contracts package that a Factory service writes for its integration events (ADR-0014 and its amendment on envelopes per event family), so a Factory worker has no trigger for them. The Orleans value of the messaging choice, with the outbox dispatcher, the inbox grains and the envelope on every record, is delivered to the base template by the feature component-base-template-factory-profile; the worker template composes on the base template through its submodule and receives the choice by moving the submodule pointer. This PBI adds the host adapter: a trigger over the inbox of the Orleans profile that joins the existing adapters, is selected by the existing messaging and trigger symbols, and dispatches a message to the message use case after the idempotency check. It reads the tenant, project, run, step and attempt identity, the event id and the correlation id of the envelope into the scoped work item of the engine, which the feature component-workers-runtime-library delivers. While the trigger is paused or the process drains, it accepts no new work and an undelivered message stays in the inbox for redelivery. Replay of a failed work record enqueues the message again through the outbox to its original destination. The replay operation of a trigger does not write the failed work record itself, as the worker-core page states: the replay use case of the worker opens one transaction in which the trigger writes the outbox record of the replayed message and the use case changes the record to Replayed, so the two writes commit together or not at all; a replay that fails leaves the record Open. A message without the required scope never reaches the trigger, because the inbox validation of the base profile dead-letters it.

Acceptance criteria

AC1 Given a worker generated with the Orleans messaging choice, when a message is delivered by the inbox of the profile, then the Orleans trigger dispatches it to the message use case after the idempotency check with the tenant, project, run, step and attempt identity of the envelope in the scoped work item, and the sample message flow of the template runs on it in the acceptance tests (ADR-0012, ADR-0014 decision 1, ADR-0024).
AC2 Given the trigger is paused or the process is draining, when a message is ready for delivery, then the trigger accepts no new work, the message stays in the inbox for redelivery and in-flight work finishes within the drain timeout; after resume the message is dispatched once (ADR-0012 decision 2 asks the profile to state acknowledgement and retry ownership, model/components.yaml).
AC3 Given an Open failed work record whose source is the Orleans trigger, when an operator replays it, then the message is enqueued again through the outbox to its original destination and the record becomes Replayed: the outbox record of the replayed message and the change of the failed work record to Replayed commit in one transaction, which is the transaction rule of ADR-0012 decision 4; when they cannot commit together, or the adapter cannot enqueue, the record stays Open and the answer is 502.
Traces: adrs ADR-0012, ADR-0014, ADR-0024
Depends on feature:component-workers-runtime-library, feature:component-base-template-factory-profile
Sources model/components.yaml, model/template-parameters/connectsoft-worker.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-619 Trigger adapter for the Orleans messaging profile implementation An IWorkTrigger adapter over the outbox and inbox grains of the Orleans messaging profile joins the adapters of the first version and is selected by the existing messaging symbols; the identifiers of the accepted envelope (run, step, attempt, tenant, project) are read into the scoped work item of the pinned engine, and the sample message flow runs on it in the acceptance tests. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1019 Base-template submodule moved to the Orleans messaging choice and the worker symbols derived from it operations The base-template submodule of the worker template points at the base template commit that carries the Orleans value of the messaging choice and the symbol UseFactoryProfile; the messaging and trigger symbols of the worker template accept that value and the trigger settings section gains the Orleans adapter; the template pins the engine version that carries the scoped work item. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1020 Pause, drain and replay through the Orleans trigger implementation The Orleans trigger reports that it accepts no new work while it is paused or the process drains and leaves undelivered messages in the inbox; its replay operation writes the outbox record of the original message inside the transaction of the replay use case, which changes the failed work record to Replayed in the same transaction, and on a failure nothing commits, the record stays Open and the route answers 502; the admin routes for trigger pause and failure replay resolve the adapter by its name. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1021 Verify the sample message flow, pause and replay on the Orleans profile verification Run the unit and acceptance tests of a worker generated with the Orleans messaging choice; the scenarios of the sample message flow, the paused trigger and the replayed failure pass and prove AC1 to AC3 of AIFACTORY-US-209 (ADR-0012, ADR-0014). ConnectSoft.WorkerTemplate

AIFACTORY-US-210: Worker template: under the Factory profile failed work and processed messages carry tenant and project, an Operator acts only on rows of their own projects and Platform admin on the worker level

enabling · persona asset-maintainer As an asset maintainer, I want the records and the admin surface of a Factory worker to be bound to the scope of the work and of the token, so that an operator of one project sees and replays only the failed work of that project and only a platform admin changes what belongs to the whole worker.

The worker owns its failed work: the worker-core page of the template makes the failed-work table the system of record, with processed messages beside it for idempotency, and exposes list, acknowledge, replay and discard under the admin routes, the operations page and the MCP tools. A locked decision of the template backlog keeps that surface an operations tool for one tenant under a policy of its own named WorkerOps, and the stored rows name no tenant and no project. A Factory worker processes messages of many tenants and projects, and ADR-0015 assigns the Operator role per project, issued as a claim by the authorization server and enforced by every backend. This PBI gives the Factory profile of the template, the boolean UseFactoryProfile, that shape and leaves the default worker as it is, as decision D114 and the amendment of ADR-0028 on the Factory profile switch settle: the default worker keeps the processed-message key of today, message id and payload hash, its tables, its WorkerOps policy and its behaviour, and nothing of this PBI is generated without the profile. Under the profile a migration adds tenant and project, and the run, step and attempt identity, to the failed-work and processed-message tables, filled from the scoped work item of the engine. The same migration replaces the primary key of the processed-message table with tenant, project and message id and keeps the payload hash as a column, and the profile selects the scoped key option of the engine, which needs that key: without it the generated worker would reject the same message id of a second tenant with a key violation. The worker operations are settled by the amendment of ADR-0015 on worker operations. An Operator sees and replays only the rows of their own projects: the list operations return only rows inside the scope of the token; acknowledge, replay and discard of a row of another tenant are answered 404, as the amendment of ADR-0015 on foreign tenants decides for every Factory service, and of a row of another project of the same tenant 403. The worker-level operations need the Platform admin role: the job catalog with its upsert, pause and resume, the pause and resume of a trigger, and the list, acknowledge, replay and discard of failed work without a scope, which is the failed work of job-shaped work. An Operator who calls a worker-level operation is refused with 403, and a list an Operator requests never returns a row without a scope. The role names are the constants of the Factory token contract that the base template profile pins, the roles are issued by the authorization server of the feature component-auth-server-template-factory-tokens, and the worker types no role name. The MCP tools apply the same checks as the routes.

Acceptance criteria

AC1 Given a worker generated with UseFactoryProfile, when a scoped message is processed or fails after its retries, then the processed-message row and the failed work record carry the tenant, project, run, step and attempt identity of the envelope, added by a migration that is generated only under the profile and that also makes tenant, project and message id the key of the processed-message table, so that the same message id of a second tenant is stored and not rejected; a worker generated without the profile contains no such migration, keeps the key of message id and payload hash and behaves as today (ADR-0014 decision 1 and decision 3, ADR-0028 amendment on the Factory profile switch).
AC2 Given a worker generated with UseFactoryProfile and a token with the Operator role for one project, when its holder lists failed work through the admin routes, the operations page or the MCP tools, then only rows of that tenant and project are returned and no row without a scope; acknowledge, replay or discard of a row of another tenant is answered 404 and of a row of another project of the same tenant 403, as ADR-0015 decision 5 and its amendments on foreign tenants and on worker operations require.
AC3 Given a token without the Operator and without the Platform admin role, when it calls an admin route or an MCP write tool of a worker generated with UseFactoryProfile, then it is refused with 401 or 403 while the health route stays public; a worker generated without the profile keeps the WorkerOps policy and the unscoped rows of the template unchanged, and a test covers a token of another project (ADR-0015 decision 6 has the backend enforce the role claim).
AC4 Given a worker generated with UseFactoryProfile, when the job catalog is listed or changed, a trigger is paused or resumed, or failed work without a scope is listed, acknowledged, replayed or discarded, through a route, the operations page or an MCP tool, then the call succeeds only for a token with the Platform admin role, and a token that holds only the Operator role is refused with 403, as the amendment of ADR-0015 on worker operations decides.
Traces: adrs ADR-0014, ADR-0015, ADR-0028
Depends on AIFACTORY-US-209, feature:component-workers-runtime-library, feature:component-auth-server-template-factory-tokens
Sources model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-620 Factory scope on failed work, idempotency and the admin surface implementation Under UseFactoryProfile FailedWork and ProcessedMessages rows carry the tenant and project of the envelope, and the host registration selects the scoped key option and the scope requirement of the pinned engine; the admin routes, the operations page and the MCP tools read the scope from the Factory token and refuse a row outside it; the scoped failed-work operations require the Operator role and the worker-level operations the Platform admin role of the token contract, with a test for a token of another project; without the profile none of this is generated and the worker keeps its key, its tables and its WorkerOps policy. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1022 Migration that adds the scope columns and the scoped key to FailedWork and ProcessedMessages under the Factory profile migration A migration that the template generates only with UseFactoryProfile adds tenant, project, run, step and attempt columns to the FailedWork and ProcessedMessages tables, with an index on tenant and project for the list operations, and replaces the primary key of ProcessedMessages, message id and payload hash, with tenant, project and message id, keeping the payload hash as a column; it runs on the database of a worker scaffolded with the profile and is reversible on an empty database; a worker generated without the profile contains no such migration and its key is unchanged; a test of the template compares the tables its migrations create with the schema script of the pinned engine, the default generation against the default shape and the profile generation against the scoped shape, and fails on a difference. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1023 Operator scope filter and Platform admin requirement on the routes, the operations page and the MCP tools implementation With UseFactoryProfile on, the scoped failed-work operations require the Operator role claim of the Factory token: list operations filter by the tenant and project of the token and never return a row without a scope; acknowledge, replay and discard answer 404 for a row of another tenant and 403 for a row of another project. The job catalog routes, the trigger pause and resume and the operations on failed work without a scope require the Platform admin role and answer 403 to a token that holds only the Operator role. The role names come from the token contract constants the base template profile pins, and the MCP tools call the same checks. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1024 Verify the scope on the records and the refusals of the admin surface verification Run the unit and acceptance tests of a worker generated with UseFactoryProfile with tokens of two tenants, of two projects of one tenant and of a Platform admin, and with one message id and one payload hash processed for two tenants on the SQL store without a key violation; the scoped rows, the filtered lists, the 404 and 403 refusals and the worker-level operations that only the Platform admin token passes, together with the tests of a worker generated without the profile, which has no scope migration and keeps the key of message id and payload hash, prove AC1 to AC4 of AIFACTORY-US-210 (ADR-0015). ConnectSoft.WorkerTemplate

AIFACTORY-US-211: Worker template: the Jobs table is the runtime catalog, the Scale section is in the generated settings and Hangfire recurring jobs take the singleton lease

enabling · persona asset-maintainer As an asset maintainer, I want the three gaps the worker template records against its own backlog to be closed before the Factory scaffolds a worker from it, so that a Factory worker keeps its operator changes across a restart, is shardable from its settings and never runs a singleton job twice.

The pages of the worker template record three gaps that stay open after its control-plane backlog. First, the worker-core page states that the runtime catalog is an in-memory overlay seeded from configuration and that the Jobs table is not read at run time, although its design asks that a change made by an operator persists in the worker store; a pause or a schedule change is therefore lost when the process restarts. Second, the worker-ops page states that the shard queues and shard tags are bound on the Scale section while the application settings of the template are unchanged, so a generated worker has no place where the section is visible and documented. Third, both pages state that Hangfire recurring execution does not take the singleton lease that every other singleton source takes, and that the storage election of Hangfire is not to be reimplemented. This PBI closes them. The overlay is the engine type InMemoryJobCatalog of ConnectSoft.Workers.Runtime, which already seeds from configuration, lets the operator win and logs the override. The durable catalog is therefore delivered in the engine, as the SQL IJobCatalog of the feature component-workers-runtime-library, beside the other SQL stores of the engine, and the template neither re-implements nor wraps it. The template owns the Jobs table, which its migration WorkerControlPlaneMigration creates, and the wiring: the columns the SQL catalog reads, the catalog provider option in the generated settings, the registration and a restart test on the pinned engine. With that, the Jobs table is the runtime catalog and the in-memory catalog its cache: the catalog is loaded from the table at start, the configuration seeds a job the table does not have, and a change made by an operator wins over the seed and is logged. Here an operator is whoever the admin policy of the worker admits; under the Factory profile that caller holds the Platform admin role, because the job catalog is a worker-level operation, as AIFACTORY-US-210 states. The Scale section appears in the generated settings with empty arrays, which own every queue and tag, and in the two-replica runbook. Hangfire recurring execution takes the lease before it runs a singleton job and skips the run when it does not hold it; if that proves incompatible with the Hangfire server, the reason is recorded in the worker-core page together with a test that proves a single run across two replicas.

Acceptance criteria

AC1 Given a worker with a SQL store whose generated settings select the SQL catalog provider of the pinned engine, when an operator pauses a job or changes its schedule and the process restarts, then the SQL IJobCatalog of ConnectSoft.Workers.Runtime, with InMemoryJobCatalog as its cache, loads the catalog from the Jobs table of the template with the change in place, a job that exists only in the configuration is seeded, and the change of the operator wins over the seed and is logged (docs/architecture/ecosystem-composition.md lists the catalog gap; ADR-0028).
AC2 Given a generated worker, when its application settings are read, then the Scale section is present with empty shard queues and shard tags, which own every queue and tag, and two replicas configured with disjoint shards each dispatch only their own jobs, as the two-replica runbook of the template states (docs/architecture/ecosystem-composition.md lists the scale gap; ADR-0028).
AC3 Given two replicas with a SQL or Redis lease provider and a Hangfire recurring job marked singleton, when its schedule fires, then the job runs once because the execution takes the singleton lease and the replica without the lease skips the run; if the lease cannot be taken on that path, the reason is recorded in the worker-core page with a test that proves the single run (ADR-0028, docs/architecture/ecosystem-composition.md lists the lease gap).
Traces: adrs ADR-0028
Depends on feature:component-workers-runtime-library
Sources model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-621 Jobs table as the runtime catalog with the in-memory overlay as its cache implementation The template side of the durable catalog, on the pinned engine that carries the SQL IJobCatalog: the Jobs table of WorkerControlPlaneMigration has the columns that catalog reads, the generated settings carry the catalog provider option with the SQL value when the worker has a SQL store, the host registration passes the option to the engine, and a restart test of the template proves that an operator mutation survives a restart. With that the Jobs table is the runtime catalog and the in-memory catalog of the engine its cache; the template defines no catalog type of its own. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1025 Scale section in the generated settings and in the two-replica runbook implementation The generated application settings carry the Scale section with empty shard queues and shard tags; the compose file of the two-replica runbook sets disjoint shards for the two workers; the scale runbook page of the template describes the section. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1026 Singleton lease on Hangfire recurring execution or the recorded reason implementation Hangfire recurring execution of a singleton job takes the singleton lease like the other singleton sources and skips the run without it; if the lease cannot be taken on that path, the worker-core page records the reason and a test proves a single run across two replicas. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1027 Verify the persisted catalog, the shards and the single run on two replicas verification Run the tests of the template with two worker processes on one SQL store and the pinned engine: an operator change survives a restart through the SQL catalog of the engine, disjoint shards split the jobs and a singleton recurring job runs once; the run proves AC1 to AC3 of AIFACTORY-US-211 (ADR-0028). ConnectSoft.WorkerTemplate

AIFACTORY-US-212: Worker template: the boolean UseFactoryProfile turns on the Orleans trigger, the scope, the role requirements and the readiness tags together

enabling · persona asset-maintainer As an asset maintainer, I want one template symbol that generates a worker in the shape of the Factory, so that the runtime worker, the reconcilers and the dispatchers are scaffolded with one option instead of a list of options that can be combined wrongly.

The worker template has a parameter for the trigger with the values Bus, Hangfire, Timer, Queue and All, one for the idempotency provider with None, Sql and Redis, one for the failure sinks, the switch EnableAdmin, false by default, without which the admin routes, the operations page and the WorkerOps policy are not generated, and the messaging and actor model choices it inherits from the base template, where UseOrleans is computed from ActorModelType (model/template-parameters/connectsoft-worker.yaml). The pieces of the earlier PBIs each hang on one of them, and a Factory worker needs all of them at once: the Orleans messaging choice with its trigger, the Orleans actor model that choice needs, a durable idempotency and failed-work store, the required scope on message-shaped work, and the admin surface with the Operator and Platform admin requirements on it. The profile symbol is settled by decision D114 and the amendment of ADR-0028 on the Factory profile switch: the boolean UseFactoryProfile, off by default, with the same name in the base, worker, gateway and library templates, passed by the Factory scaffold command. The worker template composes on the base template through its submodule, so UseFactoryProfile is one symbol of the composed configuration: the base template declares it and derives its own shape from it, and this PBI adds the computed symbols of the worker in template/worker.template.extend.json and declares no second profile symbol. With the symbol on, computed symbols derive the Orleans actor model, the Orleans messaging choice, the bus trigger on the Orleans adapter, the SQL idempotency provider with the scoped key and its migration, EnableAdmin true, the scope requirement and the Operator and Platform admin requirements of the admin surface, whatever the single options say, and the broker registrations and the saga scaffolding of the flow model are excluded, as ADR-0024 decision 4 removes broker sagas from the design. The rule for a conflicting single option is stated once: under the profile it is overridden by the computed symbols and is not refused, so the effective actor model is always Orleans and the admin surface always exists. The refusal of the base template, which names both symbols when the Orleans messaging choice meets another actor model, applies to a generation without the profile and is never reached under it. The health checks of the Orleans trigger, the stores and the lease are registered with the readiness tag of the work-aware readiness the worker-core page describes, so that a worker that cannot take work is not ready. With the symbol off, which is its default, the template generates what it generates today, the processed-message key of message id and payload hash included. The parameters page of the template documents the symbol, and the inventory of the documentation repository picks it up.

Acceptance criteria

AC1 Given the worker template, when a worker is generated with UseFactoryProfile true and no other option, then it carries the Orleans actor model, the Orleans messaging choice with its trigger, the SQL idempotency and failed-work stores with the scoped key and its migration, the admin routes, the operations page and the WorkerOps policy that EnableAdmin generates, with the Operator and Platform admin requirements of AIFACTORY-US-210 on them, and the required scope on message-shaped work; it contains no broker registration and no saga type, and it builds and passes its tests (ADR-0012, ADR-0024 decision 4).
AC2 Given UseFactoryProfile is true and a conflicting single option is passed, such as a broker messaging value, the idempotency provider None, --enable-admin false or another actor model, when the worker is generated, then the computed symbols of the profile win and the generated settings and projects show the profile values, the admin surface and the Orleans actor model included; with the symbol off, which is its default, the generated worker is unchanged from the template of today, the processed-message key of message id and payload hash included, which a comparison of the default case proves (ADR-0028 amendment on the Factory profile switch, model/template-parameters/connectsoft-worker.yaml lists UseFactoryProfile after the next inventory).
AC3 Given a worker generated with UseFactoryProfile, when its Orleans trigger, its store or its lease is unavailable, then the readiness of the worker reports not ready through the tagged health checks while the liveness route stays healthy, and the parameters page of the template documents UseFactoryProfile and what it turns on (ADR-0028, docs/architecture/catalogs/templates.md keeps the row of the template).
Traces: adrs ADR-0012, ADR-0024, ADR-0028
Depends on AIFACTORY-US-209, AIFACTORY-US-210, AIFACTORY-US-211
Sources model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-worker.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0024-durable-execution-substrate.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1028 UseFactoryProfile and the computed symbols of the worker in the composed template configuration contract The composed template configuration carries the boolean UseFactoryProfile, off by default, under the name the base template declares and received with the submodule of AIFACTORY-TASK-1019; template/worker.template.extend.json adds the computed symbols of the worker, which derive the Orleans actor model, the Orleans messaging choice, the bus trigger, the SQL idempotency provider with the scoped key and its migration, EnableAdmin true, the scope requirement and the Operator and Platform admin requirements from it, override a conflicting single option and exclude the broker registrations and the saga scaffolding; the worker declares no second profile symbol, and the command line host file exposes the option. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1029 Readiness tags and generated settings of the profile implementation With UseFactoryProfile on, the health checks of the Orleans trigger, the idempotency and failed-work stores and the lease carry the readiness tag, the generated settings hold the trigger, idempotency, lease and scope sections with the profile values, and the parameters page of the template documents the symbol. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1030 Verify the profile on, the profile off and the conflicting option verification Generate a worker with UseFactoryProfile true, one without it, one with the profile on and a broker messaging value, one with the profile on and --enable-admin false and one with the profile on and another actor model; build and test each; every profile case carries the profile values, the Orleans actor model, the admin surface under the Operator and Platform admin requirements and no broker registration, and the case without the symbol equals the default case, the key of message id and payload hash included, which proves AC1 to AC3 of AIFACTORY-US-212 (ADR-0024). ConnectSoft.WorkerTemplate

AIFACTORY-US-213: Worker template: the shared template pipeline gates the default generation and one Factory profile case, and the package publishes only on their complete reports

evidence · persona asset-maintainer As an asset maintainer, I want every change of the worker template to be gated by its generated cases, so that a package that would generate a worker that does not build, start or pass its tests never reaches the feed.

This PBI is the gate of the feature. The amendment of ADR-0028 on the Factory templates scaffolds a Factory repository only from a template package, and the epic is done only when each template publishes a package that passes its generated-solution gate. The estate has one gate mechanism for templates, the shared template pipeline of ConnectSoft.AzurePipelines (template-ci/v1): one packed candidate, the scaffold cases of the manifest build/template-ci.json of the consumer, result validation and publication on the complete reports of every selected case. Its rollout ledger lists the worker template as pending behind the base template, and its Domain profile declares one case per supported artifact kind. Decision D114 and the amendment of ADR-0028 on the Factory profile switch admit one additional gating case per declared profile and keep the default generations gated as today. The worker template declares one profile, UseFactoryProfile, so its manifest holds the default cases and exactly one more gating case: a worker generated with UseFactoryProfile true and no other option. The two further generations the feature exercises, the profile with the Redis lease provider and the generation with every trigger on, are not gating cases: they are cases of the Compatibility profile of the manifest, which runs on request and never decides publication. For each gating case the shared installer jobs install the candidate, generate the solution, restore it with the engine ConnectSoft.Workers.Runtime taken from the ConnectSoft feed at the pinned version, build in Release, run the unit, architecture and acceptance tests with the discovery and completion checks, and run the validator of the case, which scans the output for template placeholders that were not replaced. The scope migration, the two-tenant case of the scoped key and the sample message flow on the Orleans trigger run in the Factory profile case only, since the default generation selects none of them. A case that fails any stage fails the run with the case and the stage named, and no later stage of that case is reported as passed. Publication requires the complete reports of the default cases and of the Factory profile case, pushes the package with a verified version and refuses a version that is already on the feed. A fixture with a planted defect proves that the gate refuses. The logs of every case are kept as artifacts of the run. The gate proves the template; it does not prove a deployed worker, which is the work of the services that are scaffolded from the package.

Acceptance criteria

AC1 Given a change of the worker template, when its pipeline runs the shared installer jobs with build/template-ci.json, then the candidate is packed once and installed, the default generation is gated as today and exactly one additional gating case is generated with UseFactoryProfile true, and each gating case is restored with the engine from the ConnectSoft feed, built in Release, tested with the discovery and completion checks and scanned for placeholders; the scope migration, the two-tenant case of the scoped key and the sample message flow on the Orleans trigger run in the Factory profile case (ADR-0028 amendments on the Factory templates and on the Factory profile switch, model/components.yaml).
AC2 Given a gating case fails any stage, when the pipeline evaluates the run, then the run fails with the case and the stage named, no later stage of that case is reported as passed and publication is not reached; a fixture with a planted defect in the Factory profile case proves the refusal, and the Compatibility cases, the profile with the Redis lease provider and the generation with every trigger on, run on request and never decide publication (ADR-0028).
AC3 Given the complete reports of the default cases and of the Factory profile case, when publication runs, then the package is pushed to the ConnectSoft feed with a verified version, a version that is already on the feed is refused, the logs of every case are kept as artifacts, and an install of the published package followed by a generation with UseFactoryProfile builds unchanged (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic).
Traces: adrs ADR-0028
Depends on AIFACTORY-US-212
Sources model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1031 Template pipeline manifest of the worker template with the default cases and the one Factory profile case operations The worker template adopts the shared template pipeline: build/template-ci.json names its identity, solution, packaging and tests, declares in the Domain profile the default cases and one additional gating case that generates with UseFactoryProfile true, with its test filter and the required services SQL Server and a co-hosted silo, and holds the profile with the Redis lease provider and the generation with every trigger on as cases of the Compatibility profile; azure-pipelines-template.yml runs the shared installer jobs, each gating case restores from the ConnectSoft feed, builds, tests and is scanned for placeholders, and the logs are kept as artifacts. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1032 Planted failing case fixture for the gate fixture A pipeline fixture generates the Factory profile case with a planted defect in its settings and asserts that the run fails at the test stage with the case named and that the publication stage is not reached. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-1033 Publication on the complete reports of the gating cases, with the version guard operations Publication of the template pipeline requires the complete reports of the default cases and of the Factory profile case, bound to the candidate, pushes the package to the ConnectSoft feed with a verified version and refuses a version that is already on the feed with the reason; a failed or incomplete gating case skips publication, and a Compatibility case never decides it. ConnectSoft.WorkerTemplate
AIFACTORY-TASK-622 Factory worker parameters and the generated-solution gate verification One green run and one planted run of the gate: the shared installer jobs generate the default cases and the one Factory profile case, with UseFactoryProfile true, from the packed template, build and test the generated solutions, and the package is published to the feed with a verified version only on the green run, which proves AC1 to AC3 of AIFACTORY-US-213 (ADR-0028). ConnectSoft.WorkerTemplate

AIFACTORY-US-112: Worker template: the Factory worker profile on the Orleans messaging profile is delivered and proven on a generated solution

enabling · persona asset-maintainer As an asset maintainer, I want WorkerTemplate to carry the Factory worker profile on the Orleans messaging profile, so that it serves runtime worker, reconcilers, dispatchers; the Workers.Runtime engine in base-template services with background loops without later rework.

This is the integration PBI of the feature. An asset maintainer packs the worker template with the Orleans trigger, the scope on its records, the Operator and Platform admin requirements on its admin surface, the closed catalog, scale and lease gaps and the symbol UseFactoryProfile of the earlier PBIs, and the shared template pipeline installs the package and gates the default generation and one Factory profile case. Every gating case restores the engine from the ConnectSoft feed, builds and passes its unit, architecture and acceptance tests before the package is allowed to publish with a verified version; a case that fails any stage fails the run and blocks publication. The implementation lives in the earlier PBIs of this file and in the library, base-template and authorization-server features the feature depends on; this PBI proves them together on a worker generated from the published package with UseFactoryProfile. The feature is done when such a worker consumes a scoped message from the Orleans messaging profile, records failed work with its tenant and project, lets an Operator of that project replay it and refuses an Operator of another, leaves the job catalog, the triggers and failed work without a scope to the Platform admin role, keeps a change of the catalog across a restart and runs a singleton job once on two replicas, while a worker generated without the profile keeps the processed-message key and the behaviour of today. Repository of the feature: ConnectSoft.WorkerTemplate. The service that is scaffolded from the package in a later increment is the agent runtime.

Acceptance criteria

AC1 Given the template repository ConnectSoft.WorkerTemplate, when the template is packed, installed and instantiated in its pipeline, then the generated solution of every gating case builds and its tests pass before the package publishes with a verified version (ADR-0028, model/components.yaml).
AC2 Given the work of AIFACTORY-TASK-619 (trigger adapter for the Orleans messaging profile) is done, then a trigger over the outbox and inbox grains of the Orleans messaging profile joins the adapters of the first version and is selected by the existing messaging symbols, the identifiers of the accepted envelope are read into the dispatch, and the sample message flow runs on it in the acceptance tests (ADR-0012, ADR-0014 decision 1).
AC3 Given the work of AIFACTORY-TASK-620 (Factory scope on failed work, idempotency and the admin surface) is done, then under UseFactoryProfile failed work and processed-message rows carry the tenant and project of the envelope, the admin routes, the operations page and the MCP tools read the scope from the Factory token and refuse a row outside it, an Operator acts only on the rows of their own projects and the worker-level operations need the Platform admin role, with a test for a token of another project, while a worker generated without the profile keeps its key and its policy (ADR-0015 decision 5 and its amendment on worker operations).
AC4 Given the work of AIFACTORY-TASK-621 (Jobs table as the runtime catalog) and of the scale and lease tasks of AIFACTORY-US-211 is done, then operator mutations survive a restart, the Scale section is in the generated settings, and Hangfire recurring execution takes the singleton lease or the reason it must not is recorded with a test that proves a single run (ADR-0028, docs/architecture/ecosystem-composition.md).
AC5 Given the work of AIFACTORY-TASK-622 (Factory worker parameters and the generated-solution gate) is done, then the boolean UseFactoryProfile turns the Orleans trigger, the scope and the readiness tags on together, the shared template pipeline gates the default generation and one case generated with the symbol, builds and tests the generated solutions, and the package is published to the feed with a verified version (ADR-0024, ADR-0028).
Traces: adrs ADR-0012, ADR-0014, ADR-0015, ADR-0024, ADR-0028
Depends on AIFACTORY-US-209, AIFACTORY-US-210, AIFACTORY-US-211, AIFACTORY-US-212, AIFACTORY-US-213
Sources model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-worker.yaml, docs/architecture/ecosystem-composition.md

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-1034 Template inventory of the documentation repository lists UseFactoryProfile documentation After the package is published, python -I tools/docs_model inventory-templates is run so that UseFactoryProfile and the Orleans value of the messaging choice appear in model/template-parameters/connectsoft-worker.yaml and in the switches of the worker template in model/templates.yaml without a hand edit. ConnectSoft.AI.SoftwareFactory.Documentation
AIFACTORY-TASK-694 Verify worker-template-factory-profile-delivered by running the declared command verification Run dotnet build -c Release and dotnet test -c Release --no-build on the authoring solution and on a worker generated from the published package with UseFactoryProfile; they pass and prove AC1 to AC5 of AIFACTORY-US-112. ConnectSoft.WorkerTemplate