diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 0b643ceb7..88e817526 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -12634,6 +12634,10 @@ "startDelay": { "type": "string", "description": "Time to wait before making the first activity task available for dispatch. This delay is not applied to retry attempts." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this activity." } } }, @@ -12903,6 +12907,10 @@ "timeSkippingConfig": { "$ref": "#/definitions/v1TimeSkippingConfig", "description": "Time-skipping configuration. If not set, time skipping is disabled." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this workflow." } } }, @@ -13423,6 +13431,10 @@ "$ref": "#/definitions/apiCommonV1Link" }, "description": "Links to be associated with this update." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this update." } }, "description": "The request information that will be delivered all the way down to the\nWorkflow Execution." @@ -13908,6 +13920,10 @@ "type": "string", "format": "date-time", "description": "The time at which the first activity task is made available for dispatch, computed as\n`schedule_time + start_delay`. Same as `schedule_time` if `start_delay` is not set." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this activity." } }, "description": "Information about a standalone activity." @@ -18438,6 +18454,10 @@ "type": "string", "description": "Operation token. Only populated for asynchronous operations after a successful StartOperation call." }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context for this operation's payloads, derived from its stored target.\nFor a reused operation, this is the original execution's context." + }, "result": { "$ref": "#/definitions/v1Payload", "description": "The result if the operation completed successfully." @@ -18675,6 +18695,21 @@ }, "description": "Priority contains metadata that controls relative ordering of task processing\nwhen tasks are backed up in a queue. Initially, Priority will be used in\nmatching (workflow and activity) task queues. Later it may be used in history\ntask queues and in rate limiting decisions.\n\nPriority is attached to workflows and activities. By default, activities\ninherit Priority from the workflow that created them, but may override fields\nwhen an activity is started or modified.\n\nDespite being named \"Priority\", this message also contains fields that\ncontrol \"fairness\" mechanisms.\n\nFor all fields, the field not present or equal to zero/empty string means to\ninherit the value from the calling workflow, or if there is no calling\nworkflow, then use the default value.\n\nFor all fields other than fairness_key, the zero value isn't meaningful so\nthere's no confusion between inherit/default and a meaningful value. For\nfairness_key, the empty string will be interpreted as \"inherit\". This means\nthat if a workflow has a non-empty fairness key, you can't override the\nfairness key of its activity to the empty string.\n\nThe overall semantics of Priority are:\n1. First, consider \"priority\": higher priority (lower number) goes first.\n2. Then, consider fairness: try to dispatch tasks for different fairness keys\n in proportion to their weight.\n\nApplications may use any subset of mechanisms that are useful to them and\nleave the other fields to use default values.\n\nNot all queues in the system may support the \"full\" semantics of all priority\nfields. (Currently only support in matching task queues is planned.)" }, + "v1PropagatedSerializationContext": { + "type": "object", + "properties": { + "endpoint": { + "type": "string" + }, + "service": { + "type": "string" + }, + "operation": { + "type": "string" + } + }, + "description": "PropagatedSerializationContext represents the context of the Nexus caller that started this execution." + }, "v1QueryRejectCondition": { "type": "string", "enum": [ @@ -18919,6 +18954,10 @@ "$ref": "#/definitions/v1Link" }, "description": "Links to be associated with this update." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this update." } }, "description": "The client request that triggers a Workflow Update." @@ -21649,6 +21688,10 @@ "timeSkippingInfo": { "$ref": "#/definitions/v1TimeSkippingInfo", "description": "Information about time skipping of the workflow execution.\nIf the execution has never enabled time skipping, it will be nil." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this workflow." } }, "description": "Holds all the extra information about workflow execution that is not part of Visibility." @@ -22076,6 +22119,10 @@ "timeSkippingStatePropagation": { "$ref": "#/definitions/v1TimeSkippingStatePropagation", "description": "The time-skipping state propagated from a previous run of this workflow. This can be nil\nif no time skipping has occurred or there is no previous run." + }, + "propagatedNexusSerializationContext": { + "$ref": "#/definitions/v1PropagatedSerializationContext", + "description": "Serialization context propagated from the Nexus caller that started this workflow." } }, "title": "Always the first event in workflow history" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 2aa7c45bf..e69e946df 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -9915,6 +9915,10 @@ components: The time at which the first activity task is made available for dispatch, computed as `schedule_time + start_delay`. Same as `schedule_time` if `start_delay` is not set. format: date-time + propagatedNexusSerializationContext: + allOf: + - $ref: '#/components/schemas/PropagatedSerializationContext' + description: Serialization context propagated from the Nexus caller that started this activity. description: Information about a standalone activity. ActivityExecutionListInfo: type: object @@ -10948,6 +10952,25 @@ components: NexusHandler callbacks are only supported for certain types of operations, e.g. standalone Nexus operations. Attempting to attach a Worker callback for an unsupported operation will result in an INVALID_ARGUMENT error from the server. + CancelOperationRequest: + type: object + properties: + service: + type: string + description: Service name. + operation: + type: string + description: Type of operation to cancel. + operationId: + type: string + description: |- + Operation ID as originally generated by a Handler. + + Deprecated. Renamed to operation_token. + operationToken: + type: string + description: Operation token as originally generated by a Handler. + description: A request to cancel an operation. CanceledFailureInfo: type: object properties: @@ -13078,22 +13101,6 @@ components: Used as part of WorkflowExecutionStartedEventAttributes to pass down the AutoUpgrade behavior and source deployment version to a workflow execution whose parent/previous workflow has an AutoUpgrade behavior. Also used for Upgrade-on-CaN behaviors AutoUpgrade and UseRampingVersion. - Input: - type: object - properties: - header: - allOf: - - $ref: '#/components/schemas/Header' - description: |- - Headers that are passed with the Update from the requesting entity. - These can include things like auth or tracing tokens. - name: - type: string - description: The name of the Update handler to invoke on the target Workflow. - args: - allOf: - - $ref: '#/components/schemas/Payloads' - description: The arguments to pass to the named Update handler. IntervalSpec: type: object properties: @@ -14704,6 +14711,12 @@ components: operationToken: type: string description: Operation token. Only populated for asynchronous operations after a successful StartOperation call. + propagatedNexusSerializationContext: + allOf: + - $ref: '#/components/schemas/PropagatedSerializationContext' + description: |- + Serialization context for this operation's payloads, derived from its stored target. + For a reused operation, this is the original execution's context. result: allOf: - $ref: '#/components/schemas/Payload' @@ -15064,6 +15077,16 @@ components: Not all queues in the system may support the "full" semantics of all priority fields. (Currently only support in matching task queues is planned.) + PropagatedSerializationContext: + type: object + properties: + endpoint: + type: string + service: + type: string + operation: + type: string + description: PropagatedSerializationContext represents the context of the Nexus caller that started this execution. QueryRejected: type: object properties: @@ -15313,24 +15336,32 @@ components: Request: type: object properties: - meta: - $ref: '#/components/schemas/Meta' - input: - $ref: '#/components/schemas/Input' - requestId: + header: + type: object + additionalProperties: + type: string + description: |- + Headers extracted from the original request in the Temporal frontend. + When using Nexus over HTTP, this includes the request's HTTP headers ignoring multiple values. + scheduledTime: type: string - description: The request ID of the request. - completionCallbacks: - type: array - items: - $ref: '#/components/schemas/Callback' - description: Callbacks to be called by the server when this update reaches a terminal state. - links: - type: array - items: - $ref: '#/components/schemas/Link' - description: Links to be associated with this update. - description: The client request that triggers a Workflow Update. + description: |- + The timestamp when the request was scheduled in the frontend. + (-- api-linter: core::0142::time-field-names=disabled + aip.dev/not-precedent: Not following linter rules. --) + format: date-time + capabilities: + $ref: '#/components/schemas/Request_Capabilities' + startOperation: + $ref: '#/components/schemas/StartOperationRequest' + cancelOperation: + $ref: '#/components/schemas/CancelOperationRequest' + endpoint: + type: string + description: |- + The endpoint this request was addressed to before forwarding to the worker. + Supported from server version 1.30.0. + description: A Nexus request. RequestCancelActivityExecutionRequest: type: object properties: @@ -15544,6 +15575,14 @@ components: Indicate if the request is still buffered. If so, the event ID is not known and its value will be an invalid event ID. description: RequestIdInfo contains details of a request ID. + Request_Capabilities: + type: object + properties: + temporalFailureResponses: + type: boolean + description: |- + If set, handlers may use temporal.api.failure.v1.Failure instances to return failures to the server. + This also allows handler and operation errors to have their own messages and stack traces. ResetActivityExecutionRequest: type: object properties: @@ -17124,6 +17163,10 @@ components: pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ type: string description: Time to wait before making the first activity task available for dispatch. This delay is not applied to retry attempts. + propagatedNexusSerializationContext: + allOf: + - $ref: '#/components/schemas/PropagatedSerializationContext' + description: Serialization context propagated from the Nexus caller that started this activity. StartActivityExecutionResponse: type: object properties: @@ -17458,6 +17501,36 @@ components: started: type: boolean description: If true, a new operation was started. + StartOperationRequest: + type: object + properties: + service: + type: string + description: Name of service to start the operation in. + operation: + type: string + description: Type of operation to start. + requestId: + type: string + description: A request ID that can be used as an idempotentency key. + callback: + type: string + description: Callback URL to call upon completion if the started operation is async. + payload: + allOf: + - $ref: '#/components/schemas/Payload' + description: Full request body from the incoming HTTP request. + callbackHeader: + type: object + additionalProperties: + type: string + description: Header that is expected to be attached to the callback request when the operation completes. + links: + type: array + items: + $ref: '#/components/schemas/Link' + description: Links contain caller information and can be attached to the operations started by the handler. + description: A request to start an operation. StartWorkflowExecutionRequest: type: object properties: @@ -17601,6 +17674,10 @@ components: allOf: - $ref: '#/components/schemas/TimeSkippingConfig' description: Time-skipping configuration. If not set, time skipping is disabled. + propagatedNexusSerializationContext: + allOf: + - $ref: '#/components/schemas/PropagatedSerializationContext' + description: Serialization context propagated from the Nexus caller that started this workflow. StartWorkflowExecutionResponse: type: object properties: @@ -20090,6 +20167,10 @@ components: description: |- Information about time skipping of the workflow execution. If the execution has never enabled time skipping, it will be nil. + propagatedNexusSerializationContext: + allOf: + - $ref: '#/components/schemas/PropagatedSerializationContext' + description: Serialization context propagated from the Nexus caller that started this workflow. description: Holds all the extra information about workflow execution that is not part of Visibility. WorkflowExecutionFailedEventAttributes: type: object @@ -20634,6 +20715,10 @@ components: description: |- The time-skipping state propagated from a previous run of this workflow. This can be nil if no time skipping has occurred or there is no previous run. + propagatedNexusSerializationContext: + allOf: + - $ref: '#/components/schemas/PropagatedSerializationContext' + description: Serialization context propagated from the Nexus caller that started this workflow. description: Always the first event in workflow history WorkflowExecutionTerminatedEventAttributes: type: object diff --git a/temporal/api/activity/v1/message.proto b/temporal/api/activity/v1/message.proto index e3852aa9f..862729526 100644 --- a/temporal/api/activity/v1/message.proto +++ b/temporal/api/activity/v1/message.proto @@ -18,6 +18,7 @@ import "temporal/api/enums/v1/activity.proto"; import "temporal/api/callback/v1/message.proto"; import "temporal/api/enums/v1/workflow.proto"; import "temporal/api/failure/v1/message.proto"; +import "temporal/api/nexus/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/sdk/v1/user_metadata.proto"; @@ -195,6 +196,9 @@ message ActivityExecutionInfo { // The time at which the first activity task is made available for dispatch, computed as // `schedule_time + start_delay`. Same as `schedule_time` if `start_delay` is not set. google.protobuf.Timestamp execution_time = 38; + + // Serialization context propagated from the Nexus caller that started this activity. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 39; } // Limited activity information returned in the list response. diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index b40324d68..1c6efd305 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -19,6 +19,7 @@ import "temporal/api/enums/v1/workflow.proto"; import "temporal/api/common/v1/message.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; +import "temporal/api/nexus/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/update/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; @@ -213,6 +214,8 @@ message WorkflowExecutionStartedEventAttributes { // if no time skipping has occurred or there is no previous run. temporal.api.common.v1.TimeSkippingStatePropagation time_skipping_state_propagation = 43; + // Serialization context propagated from the Nexus caller that started this workflow. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 44; } diff --git a/temporal/api/nexus/v1/message.proto b/temporal/api/nexus/v1/message.proto index a4e400c29..b3581ac49 100644 --- a/temporal/api/nexus/v1/message.proto +++ b/temporal/api/nexus/v1/message.proto @@ -17,6 +17,13 @@ import "temporal/api/enums/v1/nexus.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/sdk/v1/user_metadata.proto"; +// PropagatedSerializationContext represents the context of the Nexus caller that started this execution. +message PropagatedSerializationContext { + string endpoint = 1; + string service = 2; + string operation = 3; +} + // A general purpose failure message. // See: https://github.com/nexus-rpc/api/blob/main/SPEC.md#failure message Failure { diff --git a/temporal/api/update/v1/message.proto b/temporal/api/update/v1/message.proto index 76c46d47d..45dac1955 100644 --- a/temporal/api/update/v1/message.proto +++ b/temporal/api/update/v1/message.proto @@ -12,6 +12,7 @@ option csharp_namespace = "Temporalio.Api.Update.V1"; import "temporal/api/common/v1/message.proto"; import "temporal/api/enums/v1/update.proto"; import "temporal/api/failure/v1/message.proto"; +import "temporal/api/nexus/v1/message.proto"; // Specifies client's intent to wait for Update results. message WaitPolicy { @@ -68,6 +69,8 @@ message Request { repeated temporal.api.common.v1.Callback completion_callbacks = 4; // Links to be associated with this update. repeated temporal.api.common.v1.Link links = 5; + // Serialization context propagated from the Nexus caller that started this update. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 6; } // An Update protocol message indicating that a Workflow Update has been rejected. diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index cf763aa12..9c013b1dc 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -21,6 +21,7 @@ import "temporal/api/enums/v1/workflow.proto"; import "temporal/api/common/v1/message.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; +import "temporal/api/nexus/v1/message.proto"; import "temporal/api/taskqueue/v1/message.proto"; import "temporal/api/sdk/v1/user_metadata.proto"; @@ -138,6 +139,9 @@ message WorkflowExecutionExtendedInfo { // Information about time skipping of the workflow execution. // If the execution has never enabled time skipping, it will be nil. temporal.api.common.v1.TimeSkippingInfo time_skipping_info = 9; + + // Serialization context propagated from the Nexus caller that started this workflow. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 10; } // Holds all the information about worker versioning for a particular workflow execution. diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 1aae988d8..1e3e4d14f 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -219,6 +219,8 @@ message StartWorkflowExecutionRequest { // Time-skipping configuration. If not set, time skipping is disabled. temporal.api.common.v1.TimeSkippingConfig time_skipping_config = 29; + // Serialization context propagated from the Nexus caller that started this workflow. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 30; } message StartWorkflowExecutionResponse { @@ -612,6 +614,8 @@ message PollActivityTaskQueueResponse { // 3. If every group has some pending polls, assign the next poll to a group randomly // according to the weights. temporal.api.taskqueue.v1.PollerGroupsInfo poller_groups_info = 22; + // Serialization context propagated from the Nexus caller that started this activity. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 23; } message RecordActivityTaskHeartbeatRequest { @@ -3270,6 +3274,8 @@ message StartActivityExecutionRequest { temporal.api.common.v1.OnConflictOptions on_conflict_options = 21; // Time to wait before making the first activity task available for dispatch. This delay is not applied to retry attempts. google.protobuf.Duration start_delay = 22; + // Serialization context propagated from the Nexus caller that started this activity. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 23; } message StartActivityExecutionResponse { @@ -3501,6 +3507,10 @@ message PollNexusOperationExecutionResponse { // Operation token. Only populated for asynchronous operations after a successful StartOperation call. string operation_token = 3; + // Serialization context for this operation's payloads, derived from its stored target. + // For a reused operation, this is the original execution's context. + temporal.api.nexus.v1.PropagatedSerializationContext propagated_nexus_serialization_context = 6; + // The operation outcome, available if the operation is in a closed state. oneof outcome { // The result if the operation completed successfully.