Nexus service lifecycle
The deployment owns the Nexus endpoints and services it provides. A tenant’s module TOML enables a subset. For example:
An empty table opts into the module without enabling any services. To enable a service, list its endpoint and name:
The deployment publishes an inventory containing only the endpoint/service pairs it provides:
Tenant TOML is the sole source of tenant access. Publish tenant configuration through NRO’s normal configuration flow; no new deployment inventory revision is needed to enable or disable a tenant’s access to an existing service. The inventory does not contain tenant identifiers, allowlists, or tenant configuration paths. Business calls require tenant authorization and deployment service admission. Enabling an undeployed service does not make it available.
Nexus follows the ordinary module configuration behavior. Under dynamic tenant configuration, later lookup activities use the tenant’s current active config, including calls from workflows already in progress. Removing a service from the allowlist makes those calls fail with “not enabled for this tenant”; adding it back allows later calls again. Explicitly pinned configurations use the normal configuration-pinning behavior. Config edits do not retire deployment services or terminate existing runs.
Discovery caching is independent of tenant authorization. A cached description cannot authorize an unconfigured service. Conversely, a satellite outage does not remove tenant authorization or discard a successfully discovered description.
Nexus settings use the same module configuration parser and placeholder resolution as other modules. The constructor receives the parsed configuration. Its ordinary activities use those values for tenant access checks; scheduled maintenance passes configured endpoint/service pairs to the shared discovery workflow. Only that workflow probes satellite interfaces. Lookup activity results record each call’s observed access decision and interface in workflow history; Nexus adds no fields to tenant configuration snapshots, workflow initialization, or REPL inputs.
Tenant opt-in and opt-out
Only tenants that apply the Nexus module participate in discovery or gain a
nexus script namespace. Without that module, configuration, module bindings and
workflow execution retain their ordinary behavior. Discovery failures, exhaustion,
and cache invalidation for other tenants do not affect them.
The Nexus module registers its workflow and activity handlers during ordinary module loading. Its tenant maintenance schedule starts the shared discovery workflow on NRO’s main worker, or signals the existing execution with the tenant’s resolved endpoint/service pairs. A fixed deployment-wide workflow ID keeps concurrent maintenance runs from creating duplicate discovery executions. Routes and business lookups do not start or repair discovery. Constructors, documentation, validation, and offline replay perform no external I/O. A deployment that has never enabled Nexus performs no discovery.
Activation follows ordinary schedule reconciliation rather than the first business request. Until maintenance runs and discovery succeeds, calls report pending discovery through normal workflow errors. Maintenance also repairs a stopped discovery execution; no request-path startup coordinator is required.
Removing the module removes its namespace and routes from newly built tenant runtimes. The ordinary schedule loader also removes that tenant’s maintenance schedule. Shared discovery registrations are retained while the execution survives. Its state persists across worker restarts and continue-as-new, but ordinary dynamic dispatch requires the initiating tenant to keep Nexus configured. If that tenant opts out and discovery exits, another enabled tenant’s maintenance can restart it. A fresh execution starts with an empty cache; each enabled tenant’s maintenance registers its current services again. Other tenants’ ordinary operations never depend on discovery or satellite health. Removing a tenant module does not retire a deployment service. Existing workflows retain their recorded results; later activities still require a configured module under the ordinary activity-dispatch rules.
Discover satellite services
A satellite publishes its callable methods from the same registration that installs its handlers:
Here getStock and reserve are Nexus operations with registered names.
The registration helper adds the synchronous __nro_describe operation
automatically. Its reply contains the protocol version, service name, and
registered method names. The method list comes from the handler’s
registered operations and is identical for all tenants. Tenant TOML controls
access to the service; service owners manage interface compatibility.
Participating tenants and configuration revisions share discovery for the same endpoint/service pair. Repeated loads and tenant grant changes do not rediscover an enrolled service or reset its deadline. The workflow does not scan tenant TOML or select tenant configurations. Ordinary module loading supplies the configuration.
Lookup uses an ordinary nexus/lookup activity, including from script workflows
and the REPL. It checks the parsed tenant configuration before reading shared
discovery state. Requests cannot enroll arbitrary endpoint/service pairs.
Each service has a four-hour discovery retry budget, including time waiting for
an attempt slot. The budget caps resources spent trying to discover an unavailable
or misconfigured satellite; it is not a freshness limit on valid descriptions.
A successful result processed at the budget boundary may still be cached, even
if the workflow clock has reached the deadline. Discovery does not reject that
result solely because its processing crossed the deadline.
Attempts retry with exponential backoff capped at thirty seconds,
with at most four concurrent attempts across the deployment. Dispatch rotates
through registered services so repeated failures cannot continually take slots
ahead of services still waiting for an attempt. The discovery
workflow issues bounded __nro_describe Nexus operations on the main worker,
checking endpoint existence through the ordinary Nexus endpoint-check activity
first. These metadata operations create no business dependency. Caller cancellation cannot cancel shared
discovery. Worker replacement resumes it from history, preserving cache state and
retry deadlines. Continue-as-new carries registrations, cache entries,
and retry deadlines into the next execution.
A missing, unreachable, or incorrectly implemented satellite does not prevent NRO startup or unrelated workflow execution. Invalid local configuration still fails validation. While discovery is pending, calls return ordinary workflow errors explaining that the service has not been discovered in the current cache generation and may be unavailable or misconfigured. When the budget expires without an accepted successful result, discovery marks the service exhausted and stops attempting discovery. Repeated reads and calls do not restart an exhausted job.
Successful descriptions remain cached until an explicit flush or recreation of the discovery workflow. Every business call observes shared discovery through an ordinary Nexus lookup activity; caller workflows do not cache service interfaces. After the discovery workflow processes a flush, subsequent lookups require successful rediscovery in the new cache generation, including calls in workflows that previously used the service. Rediscovery is shared per endpoint/service pair, rather than repeated for each caller. Calls whose lookup already completed may finish using that observation. Replay uses the activity results recorded in history, including observations from before and after a flush, without consulting live discovery. Subsequent satellite outages do not erase a successful description; business calls use their normal timeouts.
Calls to methods outside the observed interface fail locally and use the constant
unknown_operation metric label. The original name remains in the error.
Valid methods keep their registered metric labels. Business workflows do not issue
discovery operations. Endpoint validation, dependency admission, and retirement
protection still apply to business calls, including outages after discovery.
Method lists are not maintained in tenant TOML or the deployment catalog.
Refresh the shared discovery cache
Use the authenticated, Site-Admin-authorized administrative command:
Connection, authentication, and Teleport tunnel options match the lifecycle command below. No database credentials are needed by the client.
The command tells the shared workflow to clear its cache and start fresh four-hour budgets for all registered services, including exhausted ones. Registrations retained after tenant configuration changes are included. Old attempts cannot repopulate cleared entries. Subsequent lookups, including those from existing workflows, observe pending discovery until rediscovery succeeds. Replay preserves the observations already recorded in caller histories.
A successful response confirms that Temporal accepted the flush signal for
processing. It does not mean satellite rediscovery has completed. The CLI’s
-timeout bounds the request duration; -timeout 0 uses the caller’s request
context. If the command cannot confirm acceptance, try again later. A lost
response may mean the earlier flush was accepted; another request simply flushes
the cache again and restarts discovery budgets.
Retirement contract
Retirement operates on endpoint/service pairs. Application versions and backward compatibility within a service remain the service owner’s responsibility. A catalog revision identifies an inventory change; a service generation identifies an availability period between introduction and retirement.
An administrator first plans a removal to inspect its recorded dependencies.
Plan and apply reports return affected_count, the exact number of distinct
unsettled workflow runs, and affected, a deterministic sample of at most 100
namespace/workflow/run identifiers. The sample does not limit retirement:
acceptance approves the catalog change, not just the displayed runs. Applying
validates the revision and acceptance token directly without fetching another plan.
To let existing workflows finish naturally, keep the service available and
repeat the plan before applying. Administrators can also accept removal while
dependent runs remain active. Applying retirement blocks new dependency admission
and lets each enabled tenant’s scheduled reconciliation terminate its recorded
dependent runs. The CLI’s -wait option waits for that reconciliation; it does
not let those runs finish naturally.
Dependency records describe admitted runs and can include closed executions until
background reconciliation settles them. They are not an
exhaustive prediction of future calls. The retirement wait counts unsettled
dependencies only for active
tenants whose current configuration applies the nexus module. An empty [modules.nexus] table
counts as enabled, independently of its service allowlist. Opted-out tenants do
not hold up the wait. Opt-out does not itself settle their records or cancel
reconciliation already in progress; that work can still terminate dependent runs
and settle records. Re-enabling Nexus includes any remaining unsettled records
in reconciliation and the wait again. Planning still reports recorded
dependencies, including records belonging to opted-out tenants.
Once an endpoint/service is removed, subsequent calls that need it can fail through the normal Nexus error or timeout paths. This includes historical workflows reset after retirement. A reset can replay a completed admission without registering its new run ID, so that run may not appear in the plan or retirement count and may not receive an explicit retirement termination. Retirement does not intercept resets or restore removed services. Replayed completed calls use their recorded results; a reset run that never calls the removed service again can still finish.
Validate and publish
Run NRO’s migrations before using the lifecycle command. The command accesses live state through NRO’s authenticated API; the deployment runner needs no database credentials. All lifecycle endpoints require deployment-level Site Admin authorization because the inventory spans tenants and can terminate workflows.
Pass the same deployment.yaml connection settings used by script deployment.
The routes belong to the Nexus module. Select a tenant applying that module with
-tenant TENANT_UUID, or omit the flag if the server’s default tenant applies it.
The selected tenant is a routing context; these deployment-wide operations still
require Site Admin authorization.
Bearer and nvproxy deployments use the existing client-credentials environment
variables or MAESTRO_TOKEN. For Teleport, pass -tunnel APP=ADDRESS for the
application configured in deployment.yaml. The identity must have Site Admin
access; tenant script-management permissions alone do not grant lifecycle access.
This read-only plan prints removed services and known dependent workflow/run IDs. Any removal makes planning exit unsuccessfully, even if the current workflow sample is empty. Review it and explicitly accept its exact token when applying:
Additions need no acceptance token. Repeating an identical revision is safe while it remains the latest accepted revision. Every changed inventory must have a higher revision, including rollbacks. Module loading never publishes the deployment catalog, and a stale NRO replica cannot restore an older catalog. The acceptance token binds both the proposed catalog and its predecessor revision; a concurrent deployment invalidates the plan.
For additions, provision the endpoint and handlers before publishing availability.
For removals, publish the accepted retirement before stopping a removed
handler. Confirm retirement completion with -wait or the status endpoint below
before stopping it. Without -wait, a successful apply confirms only that the
catalog was accepted; dependent runs can still be pending reconciliation.
The wait covers the Nexus-enabled tenants described above; it does not prove
that every historical or opted-out run has stopped using a service.
Retiring one service does not authorize deleting its shared endpoint or stopping
a worker that serves other available services. For example, retiring E/A leaves
E/B available. Stop only the retired handler; keep the endpoint and shared
worker running for B. Deregister an endpoint only after all services using it
have been retired and their retirement waits have completed. Check the current
catalog before removal, including any services reintroduced by later revisions.
A wait timeout means the command could not confirm completion within that time.
Keep the handler available; durable reconciliation continues while the caller
is disconnected. Retry the identical apply command only while its revision
remains the latest accepted revision. After a newer revision is accepted, that
retry returns revision_conflict before waiting.
To check a previously accepted retirement after a newer revision, poll
GET /api/v1/nexus/retirements/REVISION with the known accepted retirement
revision. Use the same Site Admin authentication and select a currently
Nexus-enabled routing tenant with the X-Tenant-UUID header. The response
{"outstanding":0} confirms that no unsettled dependencies counted by the
retirement wait remain for retirements through that revision. This query works
independently of the latest catalog revision. Keep the handler available until
that count reaches zero. Do not republish an old inventory under a new revision
just to wait; that would change the current inventory.
The Nexus module declares a tenant-owned maintenance schedule through the
ordinary ScheduleSpecs interface. Each scheduled workflow registers its tenant’s
services with shared discovery and reconciles retirement dependencies only in its
own tenant and Temporal namespace, including closed dependencies on services that
remain available. It runs every five minutes, with the scheduler’s normal jitter and
no overlapping runs for the same tenant. Schedules persist through NRO restarts
and do not require a new Nexus call to resume work. Initial activation triggers
a maintenance run immediately; subsequent discovery restart checks share this
five-minute cadence.
The loader reconciles schedule creation and deletion on its normal three-minute cycle. Removing Nexus eventually removes the tenant’s maintenance schedule. Schedule deletion does not cancel work already running, and reconciliation does not recheck current configuration before each dependency. In-flight reconciliation can therefore still terminate runs and settle records after opt-out; the loader cycle is not a deadline for that work to stop. Later activity dispatch follows the ordinary module configuration rules. Existing workflows may fail or time out when a retired satellite disappears. Re-enabling the module recreates its schedule and resumes processing retained unsettled dependencies. Keep a Nexus-enabled tenant for administrative routing while operating the deployment-wide catalog.
Runtime guarantees
Before its first call to each service, a workflow records its exact namespace, workflow ID and run ID in PostgreSQL when its admission activity executes. Admission and retirement lock the same catalog row. A racing admission either registers a dependency that retirement sees, or is refused. Dependencies remain associated with the admitted run after an operation finishes, since that run may call the service again. A reset that replays completed admission does not execute that activity again; the new run is subject to the reset behavior described above.
Retirements are durable tombstones. Re-enabling a service creates a separate deployment service generation; an unfinished old retirement cannot select new runs. Removing a deployment service retires that generation for every tenant. Tenant identity is stored on dependency records for attribution, without granting tenant permissions. Unrelated services behind the same endpoint continue working.
The reconciler uses Temporal’s external termination API with a reason naming the endpoint/service pair and deployment revision. It does not depend on the caller processing another workflow task, so it can terminate a caller stuck on a rejected Nexus scheduling command. Closed executions are settled without termination.
Each tenant’s five-minute maintenance pass handles both retirements and closed
executions, including dependencies on services that remain available.
Dependencies stay outstanding for the entire Temporal run, including execution
of on_failure and on_cancel handlers. Per-function module cleanup does not
establish that the run has ended and is not used to settle dependencies.
It settles closed or missing runs and leaves running workflows’ dependencies
intact unless their service has been retired. Checks use bounded
batches, prioritize retirements, and rotate through the least recently checked
records so long-running executions do not block cleanup of later records.
Transient Temporal errors leave work pending for retry.
Termination skips workflow cleanup and does not undo external effects or
guarantee that satellite work has stopped. The deployment operator must handle
external cleanup separately. Catalog and dependency records are retained for
audit; storage retention should follow the deployment’s workflow retention
requirements. Lifecycle records have UUID identities and creation/update timestamps.
For settled dependencies, updated_at records when settlement occurred, so retention
can measure age from settlement rather than the start of a long-running workflow.
Unsettled dependencies must remain available to retirement reconciliation.
An unavailable handler, network outage, failed endpoint lookup, or revoked Temporal credentials never creates a retirement. These continue through the normal error/retry/timeout paths. Directly deleting endpoints outside this protocol bypasses the compatibility gate; publish an accepted removal to retire their indexed dependents.