Control Plane — workers, grains and sagas¶
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.
Workers¶
| Worker | Service | Trigger | Output events | Retry | Idempotency key | Concurrency |
|---|---|---|---|---|---|---|
| ClosureResolver | AgentRegistryService | event AgentRegistryService.AssetReleaseSubmitted | — | exponential ×5 | releaseId + sourceCommit |
4 by TenantId |
| ReconciliationWorker | CostUsageService | schedule 0 * * * * |
UsageReconciled | exponential ×5 | usageId + statementRef |
2 by TenantId |
| ReservationExpiryWorker | CostUsageService | schedule */15 * * * * |
ReservationSettled | fixed ×3 | reservationId + expiresAt |
2 by TenantId |
| InvoicingWorker | FactoryCommercialService | schedule 0 2 1 * * |
InvoiceIssued | exponential ×5 | subscriptionId + periodEnd |
2 by TenantId |
| DelegationExpiryReconciler | ProjectService | schedule */10 * * * * |
DelegationChanged | fixed ×3 | delegationId + expiresAt |
2 by TenantId |
| ProjectOffboardingWorker | ProjectService | event ProjectService.ProjectStateChanged | ProjectStateChanged | exponential ×10 | projectId + Closing |
1 by TenantId |
| LeaseExpiryReconciler | RunControlService | schedule */1 * * * * |
LeaseExpired, AttemptOutcomeRecorded, AttemptDispatched | exponential ×5 | leaseId + fencingToken |
4 by TenantId |
| ApprovalExpiryReconciler | RunControlService | schedule */5 * * * * |
ApprovalDecided, RunStateChanged | fixed ×3 | approvalId + version |
2 by TenantId |
| RunDispatcher | RunControlService | event CostUsageService.BudgetReserved, RunControlService.AttemptOutcomeRecorded | AttemptDispatched, RunStateChanged | exponential ×10 | stepId + attempt number |
8 by TenantId |
- ClosureResolver (AgentRegistryService): Resolves a candidate's dependency closure from Git and the registry, computes hashes and stores the manifest.
- ReconciliationWorker (CostUsageService): Confirms estimated and uncertain usage from provider statements and late receipts; emits UsageReconciled.
- ReservationExpiryWorker (CostUsageService): Expires reservations whose run never dispatched and releases committed amounts.
- InvoicingWorker (FactoryCommercialService): Closes a period, snapshots reconciled usage and seat counts, issues the invoice through the SaaS Billing template.
- DelegationExpiryReconciler (ProjectService): Expires delegations past expiresAt and emits DelegationChanged.
- ProjectOffboardingWorker (ProjectService): Runs the Closing procedure: cancels open runs through Run Control, revokes delegations, triggers export or deletion (XL-13, XL-14) and completes to Closed.
- LeaseExpiryReconciler (RunControlService): Expires overdue leases, marks attempts TimedOut (or Uncertain when a side effect may have happened) and schedules the retry or terminal failure.
- ApprovalExpiryReconciler (RunControlService): Moves pending approvals past expiresAt to Expired and fails or re-requests per policy.
- RunDispatcher (RunControlService): Selects the next Pending step of Running runs and dispatches an attempt with a new lease when capacity (BC-26) allows.
Grains (actors)¶
| Grain | Service | Key | Reminders / timers | Reentrant | Summary |
|---|---|---|---|---|---|
| RunGrain | RunControlService | guid = runId | approval-expiry, lease-expiry | no | Serialises all transitions of one run; holds the in-memory copy of state and version and enlists the outbox writer in the same NHibernate transaction. |
Sagas¶
None modelled
No sagas are modelled for this item yet.