Repository navigation
Done
Description
Summary
When a call task points to a function, the runtime runs two complete task lifecycles on the same position: one for the calling task and one for the function body. The function itself runs only once (one HTTP request), but every lifecycle side effect happens twice.
Reproducer
If you want to run the application clone the following repository https://github.com/mathecruz/owscloud
document:
dsl: 1.0.3
namespace: default
name: dynamodb-put-item
version: 0.1.0
use:
functions:
aws-dynamodb-putitem:
call: http
with:
method: post
endpoint: http://localhost:4566/
headers:
Content-Type: application/x-amz-json-1.0
X-Amz-Target: DynamoDB_20120810.PutItem
body: "${ . }"
do:
- SaveParent:
try:
- Save:
output:
as: "${ $task.rawInput }"
call: aws-dynamodb-putitem
with:
TableName: orders
Item:
id:
S: "${ .id }"
total:
"N": "${ .total }"
catch:
errors:
with:
type: https://asl2ows.invalid/errors/DynamoDB.ProvisionedThroughputExceededException
as: error
retry:
delay: PT0.5S
backoff:
exponential: {}
limit:
attempt:
count: 3Observed (execution trace listener)
Workflow name=dynamodb-put-item instanceId=01M7VDNVVR8P0NFH86CM29SH4A started input={"total":"42.50","id":"order-1001"}
Task 'SaveParent' started pos=do/0/SaveParent/try
Task 'Save' started pos=do/0/SaveParent/try/0/Save <-- caller
Task 'Save' started pos=do/0/SaveParent/try/0/Save <-- function body, same position
Request: POST http://localhost:4566/ X-Flow-Task-Id=do/0/SaveParent/try/0/Save
{"TableName":"orders","Item":{"id":{"S":"order-1001"},"total":{"N":"42.50"}}}
Response: 200 OK {}
Task 'Save' completed output={} <-- function body: raw output
Task 'Save' completed output={"total":"42.50","id":"order-1001"} <-- caller: after output.as
Task 'SaveParent' completed output={"total":"42.50","id":"order-1001"}
Workflow ... completed
Expected
Task 'SaveParent' started
Task 'Save' started pos=do/0/SaveParent/try/0/Save
Request / Response (once)
Task 'Save' completed output={"total":"42.50","id":"order-1001"}
Task 'SaveParent' completed output={"total":"42.50","id":"order-1001"}
This is what the same workflow produces when Save declares call: http inline instead of calling the function.
We can have problems with persistence, metrics and duplicated lifecycles.
Activity
mathecruz commentedon Nov 22, 2026
@fjtirado My question is: should the function invoked by a call have its own lifecycle, or should only the call task have one, with the function body emitting no events and creating no persistence checkpoint of its own?
fjtirado commentedon Nov 23, 2026
@mathecruz There should be two life cycly event, one for the function call and another for the actual function.
Rationale is that both have different input and output (as it is clear in your examples.
What need to be modified if the positiokn of the actual function call. In the example, aws-dynamodb-putitem should be added to the position
Ill file a PR
[Fix open-workflow-specification#1859] Change position for inner func…
[Fix open-workflow-specification#1859] Matheus comments
[Fix open-workflow-specification#1859] Matheus comments
[Fix open-workflow-specification#1859] Matheus comments
[Fix open-workflow-specification#1859] Matheus comments
[Fix open-workflow-specification#1859] Matheus comments
[Fix open-workflow-specification#1859] Matheus comments