feat: expose orchestration context name - #373
Conversation
Expose the recorded logical orchestration name before invocation and during replay, including the classic Functions context. Preserve runtime constructor arguments and document the custom-context source compatibility impact. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0af01a5-0dfa-4e71-a660-c4186e65d7e0
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified, and the supplied tests cover the changed behavior.
Review effort: Lite
Findings: None
What changed in this PR
Adds replay-safe logical orchestration names to core and classic Durable Functions contexts.
Changes:
- Adds getter-only
OrchestrationContext.name. - Initializes the name from execution history.
- Forwards it through
context.df.name. - Adds tests and changelog updates.
| File | Description |
|---|---|
packages/durabletask-js/test/orchestration_executor.spec.ts |
Tests initialization, replay, aliases, and getter behavior. |
packages/durabletask-js/src/worker/runtime-orchestration-context.ts |
Stores and exposes the orchestration name. |
packages/durabletask-js/src/worker/orchestration-executor.ts |
Initializes the name from execution history. |
packages/durabletask-js/src/task/context/orchestration-context.ts |
Defines the public name getter. |
packages/azure-functions-durable/test/unit/orchestration-context.spec.ts |
Tests classic context integration. |
packages/azure-functions-durable/src/orchestration-context.ts |
Forwards the name through context.df. |
packages/azure-functions-durable/CHANGELOG.md |
Documents the classic API addition. |
CHANGELOG.md |
Documents the core API and breaking change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Real Azure DTS E2E — PASS at
|
| Case | Actual service and persisted-history evidence |
|---|---|
One native implementation registered as MiXeDAlpha, version 1.0.0 |
ctx.name preserves the scheduled logical alias/case at initial entry, after an actual activity completion, and after a durable timer fires; persisted output and ExecutionStarted.name agree. |
The same implementation registered as MixedBeta, version 2.0.0 |
Independently reports its own alias through the same initial/replay path rather than the native function name or another registration. |
| Parent/child aliases | The parent reports its own logical name; the actual sub-orchestration reports its child name, not the parent's name/instance ID or the unrelated worker default. Both complete with matching persisted names and history. |
Observed 4 Completed instances, 11 actual orchestration work items / wire ExecutionStarted observations, 4 initial entries and 7 replay entries, with 3 activity completions, 3 timer firings and 1 sub-orchestration completion. Passive observers forwarded the real gRPC streams unchanged; they did not fabricate work items or inject history.
All four exact test-owned root/child IDs were individually purged (deletedInstanceCount=1 each) and read back absent. All workers, clients and the test process stopped normally; the test-only overlay was archived and removed, leaving the production checkout clean and unchanged. All task-owned Azure resources have now been deleted: temporary data role, task hub, scheduler and resource group. Azure confirmed the resource group absent at 2026-09-28T17:06:45Z. No customer resources were touched.
Scope and reproduction
- Command:
npx --no-install jest --config .\jest.config.js --runInBand --detectOpenHandles --runTestsByPath .\test\e2e-azuremanaged\context-name-production.spec.ts --json --outputFile <artifacts>\azure-name-jest.json. - Node.js
24.14.0; an archived temporary integration overlay uses the existing SDK/Jest tooling. No committed source/dependency changes or new pushes were needed. - Evidence index:
azure-name-summary.json; detailed states, histories, wire observations and cleanup:azure-name-evidence.json. Evidence SHA-256:53f40463bebc8b96f9e16f39332c2b702396df3fbd459ffe46e330d4c8bc8770. Exact overlay SHA-256:5261806ca05266795c766f3ebbeaf7c6d5e18326fba7d3e1b42efc94bdbd9003. - This does not claim an actual Azure Functions host deployment, load/chaos coverage, or case-only alias collision semantics. It verifies case preservation for distinct mixed-case aliases. These fresh three service tests are separate from the earlier 173 local tests.
Summary
What changed?
OrchestrationContext.name, populated fromExecutionStarted.namebefore invoking user code. Logical aliases and case survive replay, including one implementation registered under two names.context.df.name; do not change registration, version dispatch, orInvocationContext.functionName.Why is this change needed?
TaskOrchestrationContext.Nameand invocation-name-backed implementation, rather than deriving identity from the JavaScript function.Issues / work items
Project checklist
CHANGELOG.mdOrchestrationContextsubclasses and typed test doubles must provide the new abstractnamegetter/property.RuntimeOrchestrationContextconstructor arguments are unchanged; manually constructed contexts return""until history initializes them.AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Human attestations above are intentionally unchecked; automated evidence follows.
Testing
Automated tests
nameassignment on all three context types (expected TS2540).9d29d57against a new isolated task hub on the real Azure DTS production service: 3/3 E2E tests passed, covering two aliases of one implementation and parent/child logical names across actual activity/timer replay. Four instances persisted Completed; all four were individually purged and read back absent. Fresh exact-head evidence, cleanup status, and limitations. This is not an Azure Functions host deployment test.Manual validation (only if runtime/behavior changed)
Notes for reviewers