Skip to content

Add experimental Event Groups support - #1784

Open
mjameswh wants to merge 1 commit into
mainfrom
event-groups-feature
Open

Add experimental Event Groups support#1784
mjameswh wants to merge 1 commit into
mainfrom
event-groups-feature

Conversation

@mjameswh

@mjameswh mjameswh commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Add experimental support for Event Groups.

Event Groups is a new form of Workflow-level metadata that allows for improved visibility into a Workflow execution's history by grouping logically related Events together based on user-defined or system-inferred criteria.

  • Explicit markers: create_event_group(label) returns a marker attachable to commands via a event_groups=[...] option or an execution scope (with group.scope():, propagated through coroutines via contextvars). Nested scopes compose; markers dedupe by id.
  • Implicit markers: automatically wrap signal and update handlers.
  • Markers are serialized onto outgoing commands as eventGroupMarkers. Explicit label marker ids are derived deterministically as SHA1(originalExecutionRunId + label) (sandbox-safe SHA-1 in sha1.ts).
  • Exposes WorkflowInfo.originalExecutionRunId (plumbed core → lang) and bumps the sdk-core submodule to the matching build.

Testing

Event Groups support requires Server v1.32.0-158.0, which has not yet been included in a published CLI release. In the mean time, tests can be run using the following CLI specifier:

TESTS_CLI_VERSION=v1.7.4-standalone-nexus-operations

@mjameswh
mjameswh force-pushed the event-groups-feature branch from 09293a3 to 426d273 Compare August 25, 2026 02:59
Comment thread temporalio/worker/_workflow_instance.py Outdated
Comment thread temporalio/worker/_workflow_instance.py
@mjameswh mjameswh changed the title Add experimental Event Groups support [WIP] Add experimental Event Groups support Aug 25, 2026
@mjameswh
mjameswh force-pushed the event-groups-feature branch 5 times, most recently from 2f4c4b2 to fa34107 Compare September 9, 2026 03:10
@mjameswh
mjameswh force-pushed the event-groups-feature branch from fa34107 to 7a893ae Compare September 9, 2026 03:13
@mjameswh mjameswh changed the title [WIP] Add experimental Event Groups support Add experimental Event Groups support Sep 9, 2026
@mjameswh
mjameswh marked this pull request as ready for review September 9, 2026 03:30
@mjameswh
mjameswh requested a review from a team as a code owner September 9, 2026 03:30
@mjameswh
mjameswh requested a review from tconley1428 September 9, 2026 12:08
if not label:
raise ValueError("Event group label cannot be empty")
if id is None:
# Salted with the run id so that the label cannot be recovered from the

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.

Why do we care about the label being recoverable from the id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because we're also processing them through codecs, specifically because we admit that users may want to put sensitive data in their labels. But encoding your label is moot if a hacker can easily break your label's derived ID.

def _inbound_event_group(event_id: int) -> EventGroup:
"""Create the implicit Event Group for an inbound signal's history event."""
if event_id <= 0:
# Invalid event ID. Don't fail the WFT — return a stub Implicit EG Marker instead.

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.

Is this unexpected enough that a warning log is warranted?

"_Definition",
"_is_unbound_method_on_cls",
"_parameters_identical_up_to_naming",
"_capture_event_group_markers",

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.

We put the previous private things in here for legacy reasons when we broke up the file (since they were exported by default previously) but we probably don't want to export them unless you specifically want them to be available off of workflow, which seems unlikely.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the context, I was wondering why we cared. I'll remove my additions.

@Sushisource Sushisource 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.

Overall makes sense to me. Will let Tim approve, his comment about the exports seems important.

Boy oh boy is adding these parameters to 8 billion function overrides annoying. Thank god the LLMs can do it now.

@@ -0,0 +1,251 @@
"""Event Groups, a way to regroup logically related workflow events.

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.

Suggested change
"""Event Groups, a way to regroup logically related workflow events.
"""Event Groups, a way to group logically related workflow events.

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