Skip to content

Signal links#2889

Open
Evanthx wants to merge 8 commits into
masterfrom
signal-links
Open

Signal links#2889
Evanthx wants to merge 8 commits into
masterfrom
signal-links

Conversation

@Evanthx
Copy link
Copy Markdown
Contributor

@Evanthx Evanthx commented May 26, 2026

Sending signals through Nexus now populates a link from the sender to the receiver as well as one from the receiver back to the sender.

What was changed

Why?

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

@Evanthx Evanthx requested a review from a team as a code owner May 26, 2026 21:00
Link startWorkflowResponseLink;
// Links extracted from the inbound Nexus task. Stored once at the task-handler boundary so the
// workflow client (signal, signalWithStart) can attach them to outgoing requests via
// SignalWorkflowExecutionRequest.links, matching the Go SDK's NexusOperationLinksKey ctx value.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

IMO don't mention the Go SDK here

Suggested change
// SignalWorkflowExecutionRequest.links, matching the Go SDK's NexusOperationLinksKey ctx value.
// SignalWorkflowExecutionRequest.links.

Comment on lines +89 to +92
/**
* Set the {@code common.v1.Link}s extracted from the inbound Nexus task so they can be attached
* to any signal RPCs issued by the operation handler.
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is for signal RPCs currently, but will be other RPCs in the near-ish™️ future right?

Comment on lines +107 to +111
public void addSignalWorkflowResponseLink(Link link) {
if (link != null) {
this.signalWorkflowResponseLinks.add(link);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm wondering if this is too operation specific. As more operations include links, we'll keep adding new getters/setters here and then have to ensure they're all consumed when building the StartOperationResponse. A perhaps contrived example would be a nexus operation that signals a workflow, updates a workflow, then starts a workflow would have backlinks for all of those if my understanding is correct.

Comment on lines +304 to +318
// LinkConverter only returns a WorkflowEvent-shaped common.v1.Link; nexus links of
// other shapes (e.g. non-temporal URLs) come back null and are intentionally not
// forwarded onto SignalWorkflowExecutionRequest.links, which requires the
// WorkflowEvent variant. Log so a debugging session can see what was dropped.
io.temporal.api.common.v1.Link commonLink =
LinkConverter.nexusLinkToWorkflowEvent(link);
if (commonLink != null) {
inboundCommonLinks.add(commonLink);
} else {
log.warn(
"Dropping inbound Nexus link from outbound signal propagation: type='{}',"
+ " url='{}' (not a parseable temporal WorkflowEvent link)",
link.getType(),
link.getUrl());
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This seems incorrect to me. A SANO will have a link to a Nexus operation populated and it should be sent to signal (and other) RPCs. I think we'll need to include a more generic helper on the LinkConverter that converts a Nexus link based on the type field to the appropriate Temporal proto link type.

Comment on lines +331 to +345
// If signal/signalWithStart RPCs issued by the handler returned backlinks, propagate
// them to the caller so the caller workflow's history event links to each signal event
// on the callee. Same set of backlinks applies to both sync and async response variants.
List<io.temporal.api.nexus.v1.Link> signalBacklinks = new ArrayList<>();
for (io.temporal.api.common.v1.Link signalResponseLink :
CurrentNexusOperationContext.get().getSignalWorkflowResponseLinks()) {
if (!signalResponseLink.hasWorkflowEvent()) {
continue;
}
io.temporal.api.nexus.v1.Link converted =
LinkConverter.workflowEventToNexusLink(signalResponseLink.getWorkflowEvent());
if (converted != null) {
signalBacklinks.add(converted);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar to my consideration of RPC specific accessors above, we'd need to check every link accessor do processing here. I think it'd be cleaner here as well to avoid details of the specific RPC that the handler may have invoked.

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.

2 participants