Add tags support for activities, sub-orchestrations, and client APIs#89
Merged
YunchuWang merged 6 commits intomainfrom Feb 3, 2026
Merged
Add tags support for activities, sub-orchestrations, and client APIs#89YunchuWang merged 6 commits intomainfrom
YunchuWang merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive tags support to the Durable Task JavaScript SDK, enabling key-value metadata to be attached to orchestrations, activities, and sub-orchestrations. Tags are propagated through the entire lifecycle including retries, providing better organization, filtering, and tracking capabilities.
Changes:
- Added
tagsproperty toOrchestrationStateand extended client/worker APIs to support tag reading and writing - Introduced
StartOrchestrationOptionsinterface for client-side orchestration scheduling with tags - Extended
TaskOptionsandSubOrchestrationOptionswith tags support for activities and sub-orchestrations - Implemented tag preservation during activity/sub-orchestration retry scheduling
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/durabletask-js/src/utils/tags.util.ts | New utility for converting proto tag maps to TypeScript records |
| packages/durabletask-js/src/utils/pb-helper.util.ts | Added populateTagsMap helper and extended proto action creators with tags parameter |
| packages/durabletask-js/src/orchestration/orchestration-state.ts | Added tags property to OrchestrationState class |
| packages/durabletask-js/src/orchestration/index.ts | Extended newOrchestrationState factory to extract tags from proto state |
| packages/durabletask-js/src/task/options/task-options.ts | Added tags to TaskOptions and introduced StartOrchestrationOptions interface |
| packages/durabletask-js/src/task/options/index.ts | Exported new StartOrchestrationOptions interface |
| packages/durabletask-js/src/index.ts | Exported StartOrchestrationOptions from main entry point |
| packages/durabletask-js/src/client/client.ts | Added scheduleNewOrchestration overload accepting StartOrchestrationOptions; updated example docs |
| packages/durabletask-js/src/worker/runtime-orchestration-context.ts | Added tag support to callActivity/callSubOrchestrator and tag preservation during retries |
| packages/durabletask-js/test/query-apis.spec.ts | Unit test for OrchestrationState with tags |
| packages/durabletask-js/test/orchestration_executor.spec.ts | Unit tests for tags on activities, sub-orchestrations, and retry preservation; removed debug console.log statements |
| test/e2e-azuremanaged/orchestration.spec.ts | E2E test for orchestration tags round-trip |
| tests/e2e/orchestration.spec.ts | Minor formatting change (extra blank line) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Contributor
YunchuWang
reviewed
Feb 3, 2026
| const tags = { env: "test", owner: "durable" }; | ||
| const id = await taskHubClient.scheduleNewOrchestration(orchestrator, undefined, { tags }); | ||
| const state = await taskHubClient.waitForOrchestrationCompletion(id, undefined, 30); | ||
|
|
Member
There was a problem hiding this comment.
tests for scheduling activity and suborch with tags too? can be in this same testcase?
YunchuWang
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What changed?
tagsproperty (key-value metadata) toOrchestrationStatefor reading tags from orchestration stateStartOrchestrationOptionsinterface withtagssupport for scheduling new orchestrationstagstoTaskOptionsfor activities andSubOrchestrationOptionsfor sub-orchestrationsscheduleNewOrchestrationwith an overload acceptingStartOrchestrationOptionsnewScheduleTaskActionandnewCreateSubOrchestrationActionto accept tagsmapToRecordutility intags.util.tsfor converting proto tag maps to TypeScript recordsWhy is this change needed?
CreateInstanceRequest,OrchestrationState,ScheduleTaskAction,CreateSubOrchestrationAction, andSubOrchestrationInstanceCreatedEventIssues / work items
Project checklist
CHANGELOG.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
packages/durabletask-js/src/utils/tags.util.ts(new file)packages/durabletask-js/src/task/options/task-options.tspackages/durabletask-js/src/task/options/index.tspackages/durabletask-js/src/index.tspackages/durabletask-js/src/orchestration/orchestration-state.tspackages/durabletask-js/src/orchestration/index.tspackages/durabletask-js/src/client/client.tspackages/durabletask-js/src/utils/pb-helper.util.tspackages/durabletask-js/src/worker/runtime-orchestration-context.tspackages/durabletask-js/test/query-apis.spec.tspackages/durabletask-js/test/orchestration_executor.spec.tstest/e2e-azuremanaged/orchestration.spec.tsAI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
Notes for reviewers
mapToRecordutility handles undefined proto maps gracefully