Skip to content

feat: add metacluster federation - #10971

Draft
ReubenBond wants to merge 17 commits into
dotnet:mainfrom
ReubenBond:merge-file-storage-runtime
Draft

ReubenBond wants to merge 17 commits into
dotnet:mainfrom
ReubenBond:merge-file-storage-runtime

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 2, 2026

Copy link
Copy Markdown
Member

Orleans needs a first-class way to route virtual actors across independently operated clusters while preserving the local grain programming model. This introduces a layered metacluster architecture which supports deterministic placement and mutable directory-backed ownership without coupling the runtime to one global-directory design.

Approach

  • Add directly serializable universal references with virtual and cluster-bound identities, including observer and SystemTarget routing.
  • Introduce pluggable ClusterLocator and cluster placement abstractions, with rendezvous and lease-backed directory implementations.
  • Add static metacluster topology, inter-cluster relay transport, fail-closed ingress validation, ownership renewal, relocation, versions, and fencing tokens.
  • Integrate resolution and dispatch into client and silo runtime paths while preserving legacy local reference serialization behavior.
  • Add hosting APIs, generated API surfaces, user documentation, Accordant state-machine models, and CsCheck properties. The bounded metacluster scope reaches 94.57% line and 90.48% branch coverage.

Review notes

This branch also contains the existing file-storage consolidation commits, which move the file grain storage implementation into Orleans.Runtime and preserve its package-facing documentation and tests.

Two follow-up guarantees are intentionally characterized rather than redesigned here: strict exclusivity after a process resumes beyond its lease requires ownership/fencing validation at each activation-turn boundary, and cluster resolution plus dispatch should eventually share one end-to-end timeout deadline.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 2, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

There are correctness and resource-lifetime issues (e.g., unsafe JSON deserialization path and an undisposed CancellationTokenSource) which should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​Orleans.Core/​Serialization/​OrleansJsonSerializer.cs — When deserializing a cluster-bound universal reference, jo["ClusterId"]! can be missing and will…
Low severity src/​Orleans.Runtime/​Catalog/​ClusterOwnershipLeaseMonitor.cs_stopping (a CancellationTokenSource) is canceled but never disposed, which can leak resources…
What changed in this PR

Introduces first-class metacluster (“multi-clustering”) federation support in Orleans, enabling universal references, cluster location/placement, and inter-cluster request routing while preserving existing single-cluster reference semantics; also consolidates file grain storage into Orleans.Runtime with updated tests and docs.

Changes:

  • Add metacluster primitives (universal references, topology provider, locators/directors, ownership validation/renewal, inter-cluster transport + relay ingress).
  • Integrate cluster resolution and inter-cluster dispatch into client and silo runtime request paths and update serializers/codegen tests accordingly.
  • Move file grain storage provider implementation into Orleans.Runtime, updating API surface, tests, and documentation.
File Description
test/​Orleans.Serialization.UnitTests/​BuiltInCodecTests.cs Adds test helper support for creating grain references from UniversalReference.
test/​Orleans.Runtime.Internal.Tests/​Orleans.Runtime.Internal.Tests.csproj Adds Microsoft.Accordant dependency for new model-based tests.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceTopologyTests.cs Adds determinism/ownership property tests for cluster service topology projection.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceOperationResultTests.cs Adds tests for retry/disposition semantics of cluster service operation results.
test/​Orleans.Persistence.FileStorage.Tests/​RecordingGrainStorageSerializer.cs Adds test serializer to validate binary payload handling and capture calls.
test/​Orleans.Persistence.FileStorage.Tests/​Orleans.Persistence.FileStorage.Tests.csproj Updates test project to reference Orleans.Runtime after file storage consolidation.
test/​Orleans.Persistence.FileStorage.Tests/​FileSiloBuilderExtensionsTests.cs Adds DI/hosting registration tests for file grain storage extensions.
test/​Orleans.Persistence.FileStorage.Tests/​FileGrainStorageTestFixture.cs Adds fixture/context utilities for file storage conformance and boundary tests.
test/​Orleans.Persistence.FileStorage.Tests/​FileGrainStorageOptionsTests.cs Adds configuration validation tests for file grain storage options.
test/​Orleans.Persistence.FileStorage.Tests/​FileGrainStorageConformanceTests.cs Adds conformance runner integration for file grain storage provider.
test/​Orleans.Persistence.FileStorage.Tests/​FileGrainStorageBoundaryTests.cs Adds boundary/security-ish tests (binary payload, path-safe file naming, invalid record, lifecycle start).
test/​Orleans.Core.Tests/​Serialization/​MessageFactoryMetaclusterTests.cs Adds tests for request context export behavior for remote/inter-cluster sends.
test/​Orleans.Core.Tests/​Placement/​ClusterDirectoryPersistenceContractTests.cs Adds persistence contract tests for directory ownership entries and fencing semantics.
test/​Orleans.Core.Tests/​Orleans.Core.Tests.csproj Adds metacluster-related test dependencies/references (Microsoft.Accordant, internal grains).
test/​Orleans.Core.Tests/​Hosting/​MetaclusterServiceRegistrationTests.cs Adds service registration/idempotency/validation tests for metacluster DI + hosting extensions.
test/​Orleans.Core.Tests/​GlobalUsings.Phase2.cs Adds global using for CsCheck in Phase 2 tests.
test/​Orleans.Core.Tests/​General/​Phase2TestGrain.cs Adds a grain implementation used in new/updated test phases.
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestGrainWithMultipleInterfaces.verified.cs Updates snapshot to include UniversalReference proxy constructors.
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestGrainWithDifferentKeyTypes.verified.cs Updates snapshot to include UniversalReference proxy constructors across key shapes.
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestGrainMethodAnnotatedWithResponseTimeout.verified.cs Updates snapshot to include UniversalReference proxy constructor.
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestGrainMethodAnnotatedWithInvokableBaseType.verified.cs Updates snapshot to include UniversalReference proxy constructor.
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestGrainComplexGrain.verified.cs Updates snapshot to include UniversalReference proxy constructor (and field init parity).
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestClassWithGenerateMethodSerializersAnnotation.verified.cs Updates snapshot to include UniversalReference proxy constructor.
test/​Orleans.CodeGenerator.Tests/​snapshots/​OrleansSourceGeneratorTests.TestBasicGrain.verified.cs Updates snapshot to include UniversalReference proxy constructor.
test/​Orleans.CodeGenerator.Tests/​OrleansSourceGeneratorTests.cs Adds generator tests asserting UniversalReference proxy constructor emission and runtime correctness.
src/​Orleans.Runtime/​README.md Documents file grain storage being included in Microsoft.Orleans.Runtime.
src/​Orleans.Runtime/​Persistence/​FileStorage/​FileSiloBuilderExtensions.cs Adds hosting/service collection extensions to register file grain storage provider.
src/​Orleans.Runtime/​Persistence/​FileStorage/​FileGrainStorageOptions.cs Adds file grain storage options + configuration validator.
src/​Orleans.Runtime/​Persistence/​FileStorage/​FileGrainStorageFactory.cs Adds factory to create FileGrainStorage using named options/overrides.
src/​Orleans.Runtime/​Persistence/​FileStorage/​FileGrainStorage.cs Adds file-based IGrainStorage implementation with ETags and safe hashed filenames.
src/​Orleans.Runtime/​OrleansContracts.txt Adds InterClusterRelayGrain contract entry.
src/​Orleans.Runtime/​Messaging/​RejectingInterClusterRequestAuthorizer.cs Adds fail-closed default authorizer for inter-cluster ingress.
src/​Orleans.Runtime/​Messaging/​InterClusterRequestReceiver.cs Adds inter-cluster ingress validation and dispatch into local runtime routing path.
src/​Orleans.Runtime/​Messaging/​InterClusterRelayGrain.cs Adds relay grain which forwards inter-cluster calls into the receiver.
src/​Orleans.Runtime/​Hosting/​DefaultSiloServices.cs Registers default metacluster services, transport, validators, and ownership lease monitor in silos.
src/​Orleans.Runtime/​Hosting/​ClusterPlacementSiloBuilderExtensions.cs Adds silo builder extensions for enabling/configuring metacluster + registering locators/placement/transport/topology/authorizer.
src/​Orleans.Runtime/​GrainDirectory/​DistributedGrainDirectory.cs Exposes directory membership snapshot for new membership plumbing.
src/​Orleans.Runtime/​GrainDirectory/​DirectoryMembershipService.cs Refactors membership projection to use ClusterServiceMembership and updated view update semantics.
src/​Orleans.Runtime/​Core/​InternalClusterClient.cs Adds IGrainFactory.GetGrain(UniversalReference) forwarding on internal client.
src/​Orleans.Runtime/​Core/​InsideRuntimeClient.cs Adds cluster resolution + inter-cluster send path in silo runtime client.
src/​Orleans.Runtime/​ClusterServices/​PartitionTransitionCoordinator.cs Adds primitives to coordinate partition transition blocking/stages/fencing.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceTopology.cs Adds topology projection (ring boundaries/range owners) for cluster services.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceOperationResult.cs Adds serialized operation result envelope (executed/rejected/unknown) for cluster services.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceMembership.cs Adds membership-to-topology projection and async update stream.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceConfiguration.cs Adds configuration + fingerprinting + ClusterServiceViewId.
src/​Orleans.Runtime/​Catalog/​GrainTypeSharedContext.cs Hooks ownership lease monitoring into activation lifecycle when directory-backed ownership is used.
src/​Orleans.Runtime/​Catalog/​ClusterOwnershipLeaseMonitor.cs Adds activation tracking and periodic ownership renewal/deactivation for directory-backed ownership.
src/​Orleans.Runtime/​Catalog/​ClusterOwnershipAccessor.cs Adds accessor for current invocation’s cluster ownership record.
src/​Orleans.Core/​Serialization/​SystemTextJson/​GrainReferenceConverter.cs Extends STJ grain reference JSON format to preserve universal reference identity when needed while keeping legacy format when possible.
src/​Orleans.Core/​Serialization/​OrleansJsonSerializer.cs Extends Newtonsoft grain reference JSON payload with service/binding/cluster identity.
src/​Orleans.Core/​Runtime/​OutsideRuntimeClient.cs Adds cluster resolution + inter-cluster send path in client runtime client.
src/​Orleans.Core/​Runtime/​GrainReferenceRuntime.cs Ensures casting preserves universal reference identity when possible.
src/​Orleans.Core/​Placement/​RendezvousClusterLocator.cs Adds rendezvous-hash locator for deterministic virtual placement across active clusters.
src/​Orleans.Core/​Placement/​InMemoryClusterDirectory.cs Adds in-memory directory implementation for testing/dev.
src/​Orleans.Core/​Placement/​DirectoryClusterLocator.cs Adds directory-backed locator and local ownership validation/renewal via IClusterDirectory.
src/​Orleans.Core/​Placement/​ClusterReferenceResolver.cs Adds universal-reference-to-cluster resolution with caching and topology validation.
src/​Orleans.Core/​Placement/​ClusterPlacementStrategyResolver.cs Adds resolver for cluster placement strategies (by grain properties + DI).
src/​Orleans.Core/​Placement/​ClusterPlacementDirectorResolver.cs Adds resolver for placement directors (keyed by strategy type).
src/​Orleans.Core/​Placement/​ClusterLocatorResolver.cs Adds resolver for cluster locators (by grain properties + keyed DI).
src/​Orleans.Core/​Messaging/​UnavailableInterClusterTransport.cs Adds fail-closed default transport which throws when federation transport isn’t configured.
src/​Orleans.Core/​Messaging/​StaticMetaclusterTopologyProvider.cs Adds built-in static topology provider sourced from MetaclusterOptions.
src/​Orleans.Core/​Messaging/​MessageFactory.cs Adds exported request context helper for inter-cluster resolution/dispatch.
src/​Orleans.Core/​Messaging/​IInterClusterClientProvider.cs Adds abstraction for supplying connected clients for remote clusters.
src/​Orleans.Core/​Messaging/​ClientInterClusterTransport.cs Adds transport which forwards requests via per-cluster connected clients and a relay grain.
src/​Orleans.Core/​Hosting/​ClusterPlacementExtensions.cs Adds client + service collection extensions for metacluster locators/placement/transport/topology registration.
src/​Orleans.Core/​GrainReferences/​UniversalReferenceBindingResolver.cs Adds binding decision logic (virtual vs cluster-bound) based on metacluster config and grain properties.
src/​Orleans.Core/​GrainReferences/​GrainReferenceActivator.cs Adds activator support for creating references from UniversalReference and emitting proxy constructors accordingly.
src/​Orleans.Core/​Core/​GrainFactory.cs Adds IGrainFactory.GetGrain(UniversalReference) implementations.
src/​Orleans.Core/​Core/​DefaultClientServices.cs Registers default metacluster services/validators in clients.
src/​Orleans.Core/​Core/​ClusterClient.cs Adds IGrainFactory.GetGrain(UniversalReference) forwarding on cluster client.
src/​Orleans.Core/​Configuration/​MetaclusterOptionsValidator.cs Adds startup validation for metacluster configuration invariants.
src/​Orleans.Core.Abstractions/​Placement/​IClusterDirectory.cs Adds public metacluster directory/ownership contracts and types.
src/​Orleans.Core.Abstractions/​Placement/​ClusterPlacementStrategy.cs Adds public cluster placement strategy/director/result abstractions.
src/​Orleans.Core.Abstractions/​Placement/​ClusterPlacementAttribute.cs Adds attributes for specifying locator and placement strategies via grain properties.
src/​Orleans.Core.Abstractions/​Placement/​ClusterLocator.cs Adds public locator and location context/result abstractions.
src/​Orleans.Core.Abstractions/​OrleansContracts.txt Adds IInterClusterRelay contract entry.
src/​Orleans.Core.Abstractions/​Messaging/​MetaclusterTopology.cs Adds public topology model and provider abstraction.
src/​Orleans.Core.Abstractions/​Messaging/​IInterClusterTransport.cs Adds public transport/receiver/authorizer/relay contracts.
src/​Orleans.Core.Abstractions/​Manifest/​GrainProperties.cs Adds well-known grain property keys for locator and placement strategy.
src/​Orleans.Core.Abstractions/​IDs/​UniversalReference.cs Adds public universal reference identity + binding enum.
src/​Orleans.Core.Abstractions/​IDs/​ClusterIdentity.cs Adds public cluster identity type.
src/​Orleans.Core.Abstractions/​Core/​IGrainFactory.cs Adds default-interface methods for universal reference GetGrain APIs.
src/​Orleans.Core.Abstractions/​Core/​GrainExtensions.cs Adds GetUniversalReference() extension for IAddressable.
src/​Orleans.Core.Abstractions/​Configuration/​Options/​MetaclusterOptions.cs Adds public options model for metacluster configuration.
src/​File/​Orleans.Persistence.FileStorage/​README.md Removes legacy standalone file storage package README (provider moved into runtime).
src/​File/​Orleans.Persistence.FileStorage/​Orleans.Persistence.FileStorage.csproj Removes legacy standalone file storage package project (provider moved into runtime).
src/​api/​Orleans.Runtime/​Orleans.Runtime.cs Updates generated public API surface for runtime (file storage + hosting extensions + metacluster hooks).
src/​api/​Orleans.Core/​Orleans.Core.cs Updates generated public API surface for core (placement, transports, reference activation).
Orleans.slnx Removes legacy file storage project and adds new consolidated file storage test project.
docs/​site/​src/​data/​unpublished-api-packages.json Removes unpublished entry for standalone file storage package.
docs/​site/​src/​data/​external-link-allowlist.json Removes allowlist entry for standalone file storage NuGet link.
docs/​site/​src/​content/​docs/​toc.yml Adds “Multi-clustering” documentation entry.
docs/​site/​src/​content/​docs/​resources/​nuget-packages.md Updates package list to note file storage is included in Microsoft.Orleans.Runtime.
docs/​site/​src/​content/​docs/​host/​multi-clustering.md Adds conceptual documentation for universal references, locators/directors, topology, transports, and ownership.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Orleans.Core/Serialization/OrleansJsonSerializer.cs Outdated
Comment thread src/Orleans.Runtime/Catalog/ClusterOwnershipLeaseMonitor.cs Outdated
Copilot AI review requested due to automatic review settings September 2, 2026 22:23
@ReubenBond
ReubenBond force-pushed the merge-file-storage-runtime branch from 7ad01f7 to 64d8ff1 Compare September 2, 2026 22:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new inter-cluster ingress dispatch path has a pooled completion source cancellation/timeout leak, and the new partition transition coordinator failure path can leave transitions in a permanently blocking/leaking state unless failure completion/removal is fixed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity · 2 Medium severity

New issues introduced by this change (3)
Severity Finding
High severity src/​Orleans.Runtime/​ClusterServices/​PartitionTransitionCoordinator.cs — PartitionTransitionCoordinator.Fail() marks a transition as failed but does not remove it from…
Medium severity src/​Orleans.Runtime/​ClusterServices/​PartitionTransitionCoordinator.cs — PartitionTransition.FailCore() completes the transition task via TrySetCanceled, which discards the…
Medium severity src/​Orleans.Runtime/​Messaging/​InterClusterRequestReceiver.cs — Awaiting the pooled ResponseCompletionSource via Task.WaitAsync can throw on cancellation/timeout…
Issues resolved since last review (2)
Severity Finding
Low severity src/​Orleans.Runtime/​Catalog/​ClusterOwnershipLeaseMonitor.cs_stopping (a CancellationTokenSource) is canceled but never disposed, which can leak resources… View resolved comment
Medium severity src/​Orleans.Core/​Serialization/​OrleansJsonSerializer.cs — When deserializing a cluster-bound universal reference, jo["ClusterId"]! can be missing and will… View resolved comment

Comment thread src/Orleans.Runtime/Messaging/InterClusterRequestReceiver.cs Outdated
@ReubenBond

ReubenBond commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

CI runs 33690121242 and 33699261411 exposed PR-specific failures which are being addressed on this branch.

The broad RPC timeout failures came from duplicate/current membership snapshots using throwing publication in both projection layers; those now use monotonic non-throwing publication. The latest run then exposed a collision-expectation mismatch in DirectoryMembershipSnapshotTests.GetRangeReturnsRangeForRequestedPartition across five OS/TFM jobs after boundary deduplication correctly changed to retain the last deterministic owner. I am updating the directory snapshot expectation and adding direct displaced-partition coverage. Independent timer, async-enumerable, and streaming failures from the earlier run remain classified as flakes.

Copilot AI review requested due to automatic review settings September 2, 2026 23:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It introduces broad new federation primitives and touches core routing/serialization/runtime paths, so it requires careful human validation beyond a narrow automated review.

Review tier: Lite
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Orleans.Runtime/​ClusterServices/​ClusterServiceTopology.cs — The duplicate-boundary removal keeps the first entry for a given hash (it removes…
Issues resolved since last review (3)
Severity Finding
Medium severity src/​Orleans.Runtime/​Messaging/​InterClusterRequestReceiver.cs — Awaiting the pooled ResponseCompletionSource via Task.WaitAsync can throw on cancellation/timeout… View resolved comment
Medium severity src/​Orleans.Runtime/​ClusterServices/​PartitionTransitionCoordinator.cs — PartitionTransition.FailCore() completes the transition task via TrySetCanceled, which discards the… View resolved comment
High severity src/​Orleans.Runtime/​ClusterServices/​PartitionTransitionCoordinator.cs — PartitionTransitionCoordinator.Fail() marks a transition as failed but does not remove it from… View resolved comment

Comment thread src/Orleans.Runtime/ClusterServices/ClusterServiceTopology.cs
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request
Lines 82.04% (108,195 / 131,877)
Branches 71.17% (30,909 / 43,430)

Report-only conclusion: current-main baseline stale.

The newest successful coverage run tested 3604a08, not current main 9cf2fac.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

Copilot AI review requested due to automatic review settings September 3, 2026 00:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The inter-cluster send paths don’t dispose pooled Response objects for one-way calls, which can leak pooled resources in both client and silo runtimes.

Review tier: Lite
Findings: None

Issues resolved since last review (1)
Severity Finding
Medium severity src/​Orleans.Runtime/​ClusterServices/​ClusterServiceTopology.cs — The duplicate-boundary removal keeps the first entry for a given hash (it removes… View resolved comment
Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

src/Orleans.Core/Runtime/OutsideRuntimeClient.cs:390

  • Inter-cluster send returns a pooled Response. When context is null (one-way call), the returned response is never disposed, which can leak pooled response instances and any associated buffers. Dispose the response when it is not passed to a completion source.
    src/Orleans.Runtime/Core/InsideRuntimeClient.cs:287
  • Inter-cluster send returns a pooled Response. When context is null (one-way call), the returned response is never disposed, which can leak pooled response instances and any associated buffers. Dispose the response when it is not passed to a completion source.

Copilot AI review requested due to automatic review settings September 3, 2026 00:22
@ReubenBond
ReubenBond force-pushed the merge-file-storage-runtime branch from 8200128 to 195bce8 Compare September 3, 2026 00:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The System.Text.Json grain reference converter’s universal-reference path can throw non-JsonException types for invalid payloads, which should be normalized to JsonException for consistent serialization behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Orleans.Core/​Serialization/​SystemTextJson/​GrainReferenceConverter.cs — In the universal-reference JSON path, invalid/missing fields (for example missing/blank ServiceId,…
Issues resolved since last review (1)
Severity Finding
Medium severity src/​Orleans.Runtime/​ClusterServices/​ClusterServiceTopology.cs — The duplicate-boundary removal keeps the first entry for a given hash (it removes… View resolved comment

Copilot AI review requested due to automatic review settings September 3, 2026 02:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new range-transition completion logic can report successful completion even when the underlying transition operation threw, which can mislead waiters and telemetry and should be corrected before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Orleans.Runtime/​GrainDirectory/​GrainDirectoryPartition.cs — CompleteRangeTransition() ignores the captured exception when the transition has already reached a…
Issues resolved since last review (1)
Severity Finding
Medium severity src/​Orleans.Core/​Serialization/​SystemTextJson/​GrainReferenceConverter.cs — In the universal-reference JSON path, invalid/missing fields (for example missing/blank ServiceId,… View resolved comment

Comment thread src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs Outdated
Copilot AI review requested due to automatic review settings September 3, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The change set is large and cross-cutting across serialization, routing, placement, and runtime lifecycle, requiring careful human validation of correctness and compatibility.

Review tier: Lite
Findings: None

Issues resolved since last review (1)
Severity Finding
High severity src/​Orleans.Runtime/​GrainDirectory/​GrainDirectoryPartition.cs — CompleteRangeTransition() ignores the captured exception when the transition has already reached a… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/Orleans.Core/Core/GrainFactory.cs:165

  • GetGrain(UniversalReference) returns a reference even if the provided universal reference has a different ServiceId than the local service. The typed overload validates this and throws an ArgumentException, but the untyped overload currently defers the mismatch until later (e.g., ClusterReferenceResolver.Resolve), which makes failures less actionable and creates inconsistent API behavior. Mirror the typed overload’s validation and throw ArgumentException immediately when the service identity doesn’t match.

Copilot AI review requested due to automatic review settings September 3, 2026 04:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

System.Text.Json grain-reference serialization can drop ClusterId/Binding for cluster-bound references, causing incorrect rebinding when deserialized in a different cluster.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Orleans.Core/​Serialization/​SystemTextJson/​GrainReferenceConverter.csWrite can emit the legacy [GrainId, Interface] payload for cluster-bound universal references…
Issues resolved since last review (1)
Severity Finding
High severity src/​Orleans.Runtime/​GrainDirectory/​GrainDirectoryPartition.cs — CompleteRangeTransition() ignores the captured exception when the transition has already reached a… View resolved comment
Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

src/Orleans.Core/Runtime/OutsideRuntimeClient.cs:280

  • SendRequest allocates a linked CancellationTokenSource and starts a CancelAfter timer for every call, even when metacluster is disabled and the target reference is virtual (so resolution is unnecessary and the task would complete synchronously). This adds avoidable allocations/timers on a hot path.

Consider short-circuiting to the local-cluster path when metacluster is disabled and the target reference is virtual.
src/Orleans.Runtime/Core/InsideRuntimeClient.cs:154

  • SendRequest allocates a linked CancellationTokenSource and starts a CancelAfter timer for every call, even in the common single-cluster path where metacluster is disabled and references are virtual (resolution is unnecessary and the task would complete synchronously). This adds avoidable allocations/timers on a very hot path.

Consider short-circuiting to the local-cluster path when metacluster is disabled and the target reference is virtual.

Comment thread src/Orleans.Core/Serialization/SystemTextJson/GrainReferenceConverter.cs Outdated
Copilot AI review requested due to automatic review settings September 3, 2026 11:27
@ReubenBond
ReubenBond force-pushed the merge-file-storage-runtime branch from ce22a7d to ed8fd4d Compare September 3, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It introduces broad changes across core runtime routing/serialization and public APIs, which warrants final human review for compatibility and operational impact.

Review tier: Lite
Findings: None

Copilot AI review requested due to automatic review settings September 10, 2026 19:43
@ReubenBond
ReubenBond force-pushed the merge-file-storage-runtime branch from 3d62264 to 818244d Compare September 10, 2026 19:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The change set introduces broad new public APIs and modifies core runtime routing/serialization paths, warranting careful human review beyond automated confidence.

Review tier: Lite
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity src/​Orleans.Core.Abstractions/​IDs/​UniversalReference.cs — UniversalReference equality ignores InterfaceType without documentation

Comment on lines +63 to +67
/// <summary>
/// Gets the grain interface represented by this reference.
/// </summary>
[Id(1)]
public GrainInterfaceType InterfaceType { get; }
@ReubenBond

Copy link
Copy Markdown
Member Author

CI run 34522117240 failed during the build step due to trim/AOT analyzer errors (IL2091) in src/Orleans.Core/Hosting/ClusterPlacementExtensions.cs:

Generic type parameters TTransport, TClientProvider, TProvider, TLocator, TDirectory, TStrategy, and TDirector require [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] annotations to satisfy DI registration calls (AddSingleton, AddKeyedSingleton, AddKeyedTransient).

Copilot AI review requested due to automatic review settings September 13, 2026 15:00
@ReubenBond
ReubenBond force-pushed the merge-file-storage-runtime branch from 818244d to e2fa8c4 Compare September 13, 2026 15:00
Copilot stopped reviewing on behalf of ReubenBond due to an error September 13, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

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.

2 participants