Skip to content

Add links and callbacks support for standalone activity#759

Merged
fretz12 merged 10 commits intomasterfrom
fredtzeng/saa-api-features
Apr 10, 2026
Merged

Add links and callbacks support for standalone activity#759
fretz12 merged 10 commits intomasterfrom
fredtzeng/saa-api-features

Conversation

@fretz12
Copy link
Copy Markdown
Contributor

@fretz12 fretz12 commented Apr 7, 2026

What changed?

  • Added completion_callbacks and links fields to StartActivityExecutionRequest.
  • Added link field to StartActivityExecutionResponse.
  • Added callbacks field to DescribeActivityExecutionResponse.
  • Added links field to ActivityExecutionInfo.
  • Added new Link.Activity variant to the Link message type.
  • Added new CallbackInfo base message
  • Updated OpenAPI v2/v3 specs to reflect the above changes.

Why?
To support links and callbacks for standalone activity executions (SAA), bringing feature parity with workflow-based activity scheduling.

@fretz12 fretz12 requested review from a team April 7, 2026 16:05
@fretz12 fretz12 changed the title Add links, callbacks, and start delay support for standalone activity Add links and callbacks support for standalone activity Apr 7, 2026
Copy link
Copy Markdown
Contributor

@dandavison dandavison left a comment

Choose a reason for hiding this comment

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

Looks great but I think that we need to make CallbackInfo handle Activity before merging.

bytes long_poll_token = 5;

// Callbacks attached to this activity execution and their current state.
repeated temporal.api.workflow.v1.CallbackInfo callbacks = 6;
Copy link
Copy Markdown
Contributor

@dandavison dandavison Apr 9, 2026

Choose a reason for hiding this comment

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

This CallbackInfo is currently workflow-specific:

// CallbackInfo contains the state of an attached workflow callback.
message CallbackInfo {
    // Trigger for when the workflow is closed.
    message WorkflowClosed {}

    message Trigger {
        oneof variant {
            WorkflowClosed workflow_closed = 1;
        }
    }

We either need to make it more general, or add an activity-specific CallbackInfo. I'm thinking we'd want the former -- add an ActivityClosed or ExecutionClosed trigger. We're going to want to straighten this out, and it would be a breaking API change to do it later.

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.

Ah I totally missed this, this callback info struct is only for workflows. You'll need to create a callback info struct for activities instead.

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.

Good call, added an activity specific cb

repeated temporal.api.common.v1.Callback completion_callbacks = 19;
// Links to be associated with the activity. Callbacks may also have associated links;
// links already included with a callback should not be duplicated here.
repeated temporal.api.common.v1.Link links = 20;
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.

The SAA PR only uses links on the callback. Is it necessary/appropriate to add these top-level links in addition to the callback links? If so, could the Nexus team give a refresher on what the respective roles are of the two links (I had it in my head that top-level were deprecated).

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.

Not deprecated, I commented on this before. It's possible to link without attaching callbacks.

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.

For reference: #759 (comment)

// Set if activity cancelation was requested.
string canceled_reason = 32;

// Links associated with the activity.
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.

A reader is going to think initially these are links that in some way refer to this activity. However, they're not -- they're links pointing to other entities associated with the activity; typically the entity that started the activity. Let's clarify this for the reader, here and in the workflow counterpart HistoryEvent.links. As an author of a Nexus SDK I found this confusing at first, so there's not much doubt that other users will benefit from some help here.

Suggested change
// Links associated with the activity.
// Links to entities associated with this activity, for example
// to the entity that started this activity.

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.

Gotcha, changed here and at HistoryEvent

@fretz12 fretz12 force-pushed the fredtzeng/saa-api-features branch from 8f2ca2c to 2bc9df1 Compare April 10, 2026 03:12
@fretz12 fretz12 requested a review from dandavison April 10, 2026 03:16

// If the state is BLOCKED, blocked reason provides additional information.
string blocked_reason = 9;
}
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.

I think this is the right design; just describing it to make it explicit. So each CHASM component will have its own CallbackInfo, the role of which is to describe a callback's state and triggering condition. Since different CHASM components will have their own component-specific sets of possible triggering conditions, we define component-specific CallbackInfo types. In practice the only field that differs for now is that trigger oneof; they'll share identical callback state fields.

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.

Agree, we should ideally have a single type for callback info since it will be used across multiple archetypes. The trigger is the only archetype specific information.

I'm going to walk back what I wrote yesterday and ask you to create a temporal.api.callback.v1.CallbackInfo which has all of the common fields and put only Trigger and temporal.api.callback.v1.CallbackInfo in this message.

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.

I refactored the common fields to temporal.api.callback.v1.CallbackInfo. Left workflow callback info as is to avoid breaking changes

@fretz12 fretz12 requested review from bergundy and dandavison April 10, 2026 18:41
// Trigger for this callback.
Trigger trigger = 1;
// Common callback info.
temporal.api.callback.v1.CallbackInfo callback_info = 2;
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're thinking let's call this info.

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.

Renamed to info

Copy link
Copy Markdown
Contributor

@dandavison dandavison left a comment

Choose a reason for hiding this comment

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

LGTM

@fretz12 fretz12 merged commit 6f298e7 into master Apr 10, 2026
4 checks passed
@fretz12 fretz12 deleted the fredtzeng/saa-api-features branch April 10, 2026 21:35
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.

5 participants