Skip to content

Conversation

@sophiatev
Copy link
Collaborator

@sophiatev sophiatev commented Nov 13, 2025

This PR introduces the extended sessions feature for entities in .NET isolated. It essentially copies the existing logic for extended sessions for orchestrations and makes certain properties/classes more generic for shared logic between the two.

  • EntityTriggerAttributeBindingProvider: Passes the RemoteEntityContext configuration to the proto converter so that the entity state is only attached to the proto request if necessary (extended sessions are not enabled, or this is the first execution within an extended session)
  • OrchestrationTriggerAttributeBindingProvider: Changed to reference the more generic property IncludeState (previously IncludePastEvents)
  • RemoteEntityContext: Introduced a new Configurations field to pass information about extended sessions to the worker
  • RemoteOrchestratorContext: Changed to reference the more generic RemoteInstanceConfiguration and IncludeState objects/properties
  • OutOfProcMiddleware: Existing orchestration logic changed to reference the more generic WorkItemMetadata.IncludeState field, and logic introduces for entities to extract information from the WorkItemMetadata object and attach it to the RemoteEntityContext, as well as to throw a SessionAbortedException if the worker needed an entity state and none was attached to the request
  • ProtobufUtils: Changed to only include entity state in the request if necessary, and to serialize a map of values containing information about extended sessions for the worker process
  • RemoteInstanceConfiguration: Renamed version of RemoteOrchestratorConfiguration to be used by both orchestrations and entities
  • DurableFunctionExecutor.Entity: Changed to pass the extended sessions cache to the TaskEntityDispatcher
  • TaskEntityDispatcher: Changed to pass the cache to GrpcEntityRunner

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation PR is ready to merge and referenced in pending_docs.md
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • [] My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)
  • My changes do not require any extra work to be leveraged by OutOfProc SDKs
    • Otherwise: That work is being tracked here: #issue_or_pr_in_each_sdk
  • My changes do not change the version of the WebJobs.Extensions.DurableTask package
    • Otherwise: major or minor version updates are reflected in /src/Worker.Extensions.DurableTask/AssemblyInfo.cs
  • My changes do not add EventIds to our EventSource logs
    • Otherwise: Ensure the EventIds are within the supported range in our existing Windows infrastructure. You may validate this with a deployed app's telemetry. You may also extend the range by completing a PR such as this one.
  • My changes should be added to v2.x branch.
    • Otherwise: This change applies exclusively to WebJobs.Extensions.DurableTask v3.x. It will be retained only in the dev and main branches and will not be merged into the v2.x branch.

@sophiatev sophiatev marked this pull request as ready for review November 20, 2025 00:43
@sophiatev sophiatev changed the title Stevosyan/extended sessions for entities isolated Extended sessions for entities in .NET isolated Nov 20, 2025
/// Configuration settings for RemoteOrchestratorContext in out-of-process mode, transmitted via gRPC.
/// </summary>
public class RemoteOrchestratorConfiguration
public class RemoteInstanceConfiguration
Copy link
Member

Choose a reason for hiding this comment

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

This is another case of a breaking API change. Is it safe to make?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Checked with @nytian, this class is actually not used outside of this repo so this should be a safe change. I'll actually go ahead and make it an internal class in this PR too.

/// True by default.
/// </summary>
public bool IncludePastEvents { get; set; } = true;
public bool IncludeState { get; set; } = true;
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering whether this breaking change is safe. Does this property get used by anything, either directly or indirectly? An example of indirect usage would be something like it gets set by deserializing configuration in host.json (I'm not sure if it does, but it looks like something that potentially could be).

Copy link
Collaborator Author

@sophiatev sophiatev Dec 1, 2025

Choose a reason for hiding this comment

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

This property was introduced by me in the PR for extended sessions for orchestrations, so it shouldn't be getting used by anything outside of this repo. I think it should be a safe change to make.

Which does beg the question why I made it a public property... probably something I need to change in this PR.

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.

3 participants