Skip to content

fix(actors): preserve Proto.Actor remote config descriptor registration - #171

Merged
sfmskywalker merged 3 commits into
elsa-workflows:mainfrom
DenDeline:bugfix/170-remote-config-descriptors
Sep 6, 2026
Merged

sfmskywalker merged 3 commits into
elsa-workflows:mainfrom
DenDeline:bugfix/170-remote-config-descriptors

Conversation

@DenDeline

@DenDeline DenDeline commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Ensure virtual-actor protobuf descriptors are registered on the same RemoteConfig instance that is attached to the ActorSystem.

Fixes #170.

Changes

  • Create the remote configuration once during actor-system construction.
  • Pass that configuration into AddVirtualActors.
  • Return the configured RemoteConfig together with ClusterConfig.
  • Attach the returned configuration through WithRemote.
  • Preserve the merged Proto.Actor cluster starts after tenant activation and cluster-dependent hosted services #167 startup guarantee while addressing review feedback: start the cluster at priority -5, after MongoDB serializer initialization at -10 and before tenant/cluster-dependent services at -1.
  • Add regression coverage for factory invocation count, descriptor availability on the attached configuration, and the -10 < cluster < -1 lifecycle order.

Reproduction and verification

Before the fix, resolving ActorSystem with a factory returning a fresh RemoteConfig creates two configurations: the first is attached, while the second receives the protobuf descriptors. Serialization through the attached configuration then fails because its registry lacks the descriptor.

The focused regression tests were confirmed to fail against the previous implementation through the duplicate invocation count and missing attached serializer.

Current-head validation:

  • Focused ProtoActorRemoteConfigTests: 2 passed.
  • Complete Elsa.Actors.ProtoActor.UnitTests project: 6 passed, 0 failed.
  • Elsa.Actors.ProtoActor Release builds for .NET 8, 9, and 10: succeeded with zero errors and two existing XML-documentation warnings.
  • git diff --check origin/main...HEAD: passed.
  • Fresh GitHub CI is running for the updated head.

Review finding addressed

Greptile correctly identified that the inherited -100 cluster priority preceded MongoDB serializer initialization at -10. The updated -5 priority preserves #167's required order before tenant activation and ordinary dependent services while removing that startup window. The review thread has been answered directly and resolved after the fix.

Scope

This PR remains focused on RemoteConfig construction, virtual-actor descriptor registration, the required hosted-service ordering correction, and regression coverage. It does not change public APIs, add dependencies, or change the documented sequential-host lifecycle assumption.

Register StartClusterMember with priority -100 and add regression coverage for hosted-service ordering.

Fixes elsa-workflows#167
Reuse the RemoteConfig attached to the ActorSystem when registering virtual actor protobuf descriptors. Add regression coverage for factory invocation count and descriptor registration.
@DenDeline

Copy link
Copy Markdown
Contributor Author

Review note: This PR is stacked on #168. View only the changes introduced for #170. The focused diff contains one production file and one regression-test file.

@DenDeline DenDeline changed the title Fix Proto.Actor remote config descriptor registration fix(actor): preserve Proto.Actor remote config descriptor registration Aug 19, 2026
@DenDeline DenDeline changed the title fix(actor): preserve Proto.Actor remote config descriptor registration fix(actors): preserve Proto.Actor remote config descriptor registration Aug 19, 2026
@sfmskywalker

Copy link
Copy Markdown
Member

@greptileai

@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

This change builds the Proto.Actor remote configuration once, registers virtual-actor protobuf descriptors on that configuration, and attaches it to the actor system. It also adds focused regression tests and includes the test project in the solution.

Cluster startup is now registered before MongoDB serializer initialization. Because the actor cluster can begin accepting work before the serializers are installed, persistence operations arriving during application startup can fail or serialize actor values incorrectly.

T-Rex validation blocked

The focused runtime validation could not execute because the required dotnet tool is not installed in the environment. The attempted test command exited before restore or test execution.

Confidence Score: 4/5

Do not merge until cluster availability is ordered after persistence serializer initialization.

The checked source paths show that cluster startup is registered at -100 while MongoDB serializer setup remains at -10, placing cluster availability first. A runtime persistence-operation reproduction could not run because the .NET SDK is unavailable.

Files Needing Attention: src/modules/actors/Elsa.Actors.ProtoActor/Features/ProtoActorFeature.cs needs its hosted-service ordering corrected; the MongoDB feature establishes the ordering dependency.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex attempted the focused .NET validation command but it could not start because the dotnet tool was missing in the environment.
  • T-Rex ran the host service ordering check, reviewed the authored checker script, and inspected the before PR registration and runtime blocker logs to validate the ordering flow and its blockers.

View all artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
src/modules/actors/Elsa.Actors.ProtoActor/Features/ProtoActorFeature.cs:94
**Cluster starts before persistence initialization**

Registering `StartClusterMember` at `-100` starts and exposes the actor cluster before MongoDB's `ConfigureMongoDbSerializers` hosted service, which remains at `-10`. Actor work received in that window can reach persistence before its serializers are registered, causing startup-time persistence failures or incorrect serialization. Keep the cluster at the default hosted-service priority, or otherwise ensure it starts after persistence initialization.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Fix Proto.Actor remote config descriptor..." | Re-trigger Greptile

Comment thread src/modules/actors/Elsa.Actors.ProtoActor/Features/ProtoActorFeature.cs Outdated
@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

@sfmskywalker sfmskywalker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review of ae9e2388324fc743f38f6db7459aa430645b7f42: approved. I reviewed the focused diff against current main across correctness, readability, architecture, security, and performance. The RemoteConfig instance is now created once, receives descriptors, and is attached to the ActorSystem; the lifecycle-ordering review finding is corrected with -10 < -5 < -1 regression coverage. Local validation passes 6/6 tests, multi-target module builds, and diff checks. No actionable findings remain.

@sfmskywalker
sfmskywalker merged commit 00634f9 into elsa-workflows:main Sep 6, 2026
4 checks passed
@sfmskywalker sfmskywalker added this to the 3.9 milestone Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProtoActor: virtual-actor protobuf descriptors are registered on a discarded RemoteConfig

2 participants