diff --git a/crates/protos/protos/api_upstream/openapi/openapiv2.json b/crates/protos/protos/api_upstream/openapi/openapiv2.json index c17eeac00e..94d75239e7 100644 --- a/crates/protos/protos/api_upstream/openapi/openapiv2.json +++ b/crates/protos/protos/api_upstream/openapi/openapiv2.json @@ -10879,9 +10879,13 @@ "$ref": "#/definitions/v1Payload", "description": "There are restrictions on the maxium payload size a single callback can carry, as well as the\ntotal sum of all source context payloads attached to an execution. See dynamic configuration:\n\"callback.nexusHandler.sourceContext.maxSize\", \"callback.nexusHandler.sourceContext.aggregateMaxSize\".", "title": "Arbitrary user-supplied data from the source operation's callsite. (As applicable, not all operations\nsupport attaching context data.)" + }, + "progressOperation": { + "type": "string", + "description": "Target operation for progress of the source operation, e.g. \"OnProgress\". Empty means the\ncallback takes the completion only." } }, - "description": "The targeted Nexus service must be registered within the same namespace as the source operation\nthe callback is attached to. (While Nexus allows for cross-namespace operations, NexusHandler callbacks\nare strictly caller-side.)\n\nNexusHandler callbacks are only supported for certain types of operations, e.g. standalone Nexus operations.\nAttempting to attach a Worker callback for an unsupported operation will result in an INVALID_ARGUMENT\nerror from the server.", + "description": "When `progress_operation` is set, the server also invokes that operation of the same service\nfor the source operation's progress. That operation must have the following:\n- Input: temporal.api.notificationservice.v1.OnProgressRequest\n- Output: temporal.api.notificationservice.v1.OnProgressResponse\nIt may be invoked any number of times before, during or after the single completion. It\nmust complete synchronously.\n\nThe targeted Nexus service must be registered within the same namespace as the source operation\nthe callback is attached to. (While Nexus allows for cross-namespace operations, NexusHandler callbacks\nare strictly caller-side.)\n\nNexusHandler callbacks are only supported for certain types of operations, e.g. standalone Nexus operations.\nAttempting to attach a Worker callback for an unsupported operation will result in an INVALID_ARGUMENT\nerror from the server.", "title": "NexusHandler callbacks are requests to invoke a specific shape of Nexus operation on a Temporal worker.\nThe specified Nexus operation must have the following:\n- Input: temporal.api.notificationservice.v1.OnCompleteRequest\n- Output: temporal.api.notificationservice.v1.OnCompleteResponse" }, "ComputeStatusProviderValidationStatus": { diff --git a/crates/protos/protos/api_upstream/openapi/openapiv3.yaml b/crates/protos/protos/api_upstream/openapi/openapiv3.yaml index d599bcce7f..41ecba7c19 100644 --- a/crates/protos/protos/api_upstream/openapi/openapiv3.yaml +++ b/crates/protos/protos/api_upstream/openapi/openapiv3.yaml @@ -10935,12 +10935,24 @@ components: There are restrictions on the maxium payload size a single callback can carry, as well as the total sum of all source context payloads attached to an execution. See dynamic configuration: "callback.nexusHandler.sourceContext.maxSize", "callback.nexusHandler.sourceContext.aggregateMaxSize". + progressOperation: + type: string + description: |- + Target operation for progress of the source operation, e.g. "OnProgress". Empty means the + callback takes the completion only. description: |- NexusHandler callbacks are requests to invoke a specific shape of Nexus operation on a Temporal worker. The specified Nexus operation must have the following: - Input: temporal.api.notificationservice.v1.OnCompleteRequest - Output: temporal.api.notificationservice.v1.OnCompleteResponse + When `progress_operation` is set, the server also invokes that operation of the same service + for the source operation's progress. That operation must have the following: + - Input: temporal.api.notificationservice.v1.OnProgressRequest + - Output: temporal.api.notificationservice.v1.OnProgressResponse + It may be invoked any number of times before, during or after the single completion. It + must complete synchronously. + The targeted Nexus service must be registered within the same namespace as the source operation the callback is attached to. (While Nexus allows for cross-namespace operations, NexusHandler callbacks are strictly caller-side.) diff --git a/crates/protos/protos/api_upstream/temporal/api/common/v1/message.proto b/crates/protos/protos/api_upstream/temporal/api/common/v1/message.proto index 908c5c80b8..14aca95b68 100644 --- a/crates/protos/protos/api_upstream/temporal/api/common/v1/message.proto +++ b/crates/protos/protos/api_upstream/temporal/api/common/v1/message.proto @@ -207,6 +207,13 @@ message Callback { // - Input: temporal.api.notificationservice.v1.OnCompleteRequest // - Output: temporal.api.notificationservice.v1.OnCompleteResponse // + // When `progress_operation` is set, the server also invokes that operation of the same service + // for the source operation's progress. That operation must have the following: + // - Input: temporal.api.notificationservice.v1.OnProgressRequest + // - Output: temporal.api.notificationservice.v1.OnProgressResponse + // It may be invoked any number of times before, during or after the single completion. It + // must complete synchronously. + // // The targeted Nexus service must be registered within the same namespace as the source operation // the callback is attached to. (While Nexus allows for cross-namespace operations, NexusHandler callbacks // are strictly caller-side.) @@ -232,6 +239,10 @@ message Callback { // total sum of all source context payloads attached to an execution. See dynamic configuration: // "callback.nexusHandler.sourceContext.maxSize", "callback.nexusHandler.sourceContext.aggregateMaxSize". temporal.api.common.v1.Payload source_context = 4; + + // Target operation for progress of the source operation, e.g. "OnProgress". Empty means the + // callback takes the completion only. + string progress_operation = 5; } reserved 1; // For a generic callback mechanism to be added later. diff --git a/crates/protos/protos/api_upstream/temporal/api/notificationservice/v1/request_response.proto b/crates/protos/protos/api_upstream/temporal/api/notificationservice/v1/request_response.proto index 9a7ac529f2..0561d888e8 100644 --- a/crates/protos/protos/api_upstream/temporal/api/notificationservice/v1/request_response.proto +++ b/crates/protos/protos/api_upstream/temporal/api/notificationservice/v1/request_response.proto @@ -31,6 +31,10 @@ message OnCompleteRequest { // User-supplied data which was added to the source invocation. (As applicable.) temporal.api.common.v1.Payload source_context = 3; + + // The `receiver_state` of the last OnProgressResponse that the server accepted for this + // callback. Empty when no progress was accepted. + bytes receiver_state = 4; } // OnCompleteResponse is the return type of the OnComplete operation. diff --git a/crates/sdk-core/CHANGELOG.md b/crates/sdk-core/CHANGELOG.md index 15ab159165..34aab6eb85 100644 --- a/crates/sdk-core/CHANGELOG.md +++ b/crates/sdk-core/CHANGELOG.md @@ -42,6 +42,8 @@ relevant information. * Lang can set `heartbeat_task` on a successful activation completion to complete the workflow task while local activities still run, as Core does at a local activity heartbeat. Core ignores the flag on replay. +* Core keeps `progress_operation` on the Nexus callbacks it decodes from lang, and its vendored + protos include `receiver_state` on the Nexus `OnCompleteRequest`. * A local activity's task names the workflow task in which core dispatched it. A rerun after a failed task always names a later task, so lang can key each run's side effects by it.