Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "upstash-workflow"
version = "0.1.3"
version = "0.1.4"
description = "Python SDK for Upstash Workflow"
license = "MIT"
authors = ["Upstash <support@upstash.com>"]
Expand Down
2 changes: 2 additions & 0 deletions tests/asyncio/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ async def execute() -> None:
"Upstash-Workflow-RunId": "wfr-id",
"Upstash-Workflow-Url": "https://www.my-website.com/api",
"Upstash-Feature-Set": "WF_NoDelete,InitialBody",
"Upstash-Failure-Callback-Feature-Set": "LazyFetch,InitialBody",
"Upstash-Callback-Failure-Callback-Feature-Set": "LazyFetch,InitialBody",
"Upstash-Failure-Callback-Forward-Upstash-Workflow-Is-Failure": "true",
"Upstash-Failure-Callback-Forward-Upstash-Workflow-Failure-Callback": "true",
"Upstash-Failure-Callback-Workflow-Runid": "wfr-id",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def execute() -> None:
"Upstash-Workflow-RunId": "wfr-id",
"Upstash-Workflow-Url": "https://www.my-website.com/api",
"Upstash-Feature-Set": "WF_NoDelete,InitialBody",
"Upstash-Failure-Callback-Feature-Set": "LazyFetch,InitialBody",
"Upstash-Callback-Failure-Callback-Feature-Set": "LazyFetch,InitialBody",
"Upstash-Failure-Callback-Forward-Upstash-Workflow-Is-Failure": "true",
"Upstash-Failure-Callback-Forward-Upstash-Workflow-Failure-Callback": "true",
"Upstash-Failure-Callback-Workflow-Runid": "wfr-id",
Expand Down
2 changes: 1 addition & 1 deletion upstash_workflow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.3"
__version__ = "0.1.4"

from upstash_workflow.context.context import WorkflowContext
from upstash_workflow.serve.serve import serve
Expand Down
16 changes: 14 additions & 2 deletions upstash_workflow/asyncio/serve/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from typing import Callable, Dict, Optional, cast, TypeVar, Any, Generic, Awaitable
from qstash import AsyncQStash, Receiver
from upstash_workflow.workflow_types import _Response
from upstash_workflow.constants import DEFAULT_RETRIES
from upstash_workflow.constants import (
DEFAULT_RETRIES,
WORKFLOW_PROTOCOL_VERSION_HEADER,
WORKFLOW_PROTOCOL_VERSION,
)
from upstash_workflow.types import (
_FinishCondition,
)
Expand Down Expand Up @@ -74,11 +78,19 @@ def _on_step_finish(
"workflowRunId": workflow_run_id,
},
status=400,
headers={
WORKFLOW_PROTOCOL_VERSION_HEADER: WORKFLOW_PROTOCOL_VERSION
},
),
)

return cast(
TResponse, _Response(body={"workflowRunId": workflow_run_id}, status=200)
TResponse,
_Response(
body={"workflowRunId": workflow_run_id},
status=200,
headers={WORKFLOW_PROTOCOL_VERSION_HEADER: WORKFLOW_PROTOCOL_VERSION},
),
)

def _initial_payload_parser(initial_request: str) -> TInitialPayload:
Expand Down
16 changes: 14 additions & 2 deletions upstash_workflow/serve/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
)
from qstash import QStash, Receiver
from upstash_workflow.workflow_types import _Response, _SyncRequest, _AsyncRequest
from upstash_workflow.constants import DEFAULT_RETRIES
from upstash_workflow.constants import (
DEFAULT_RETRIES,
WORKFLOW_PROTOCOL_VERSION_HEADER,
WORKFLOW_PROTOCOL_VERSION,
)
from upstash_workflow.types import (
_FinishCondition,
)
Expand Down Expand Up @@ -99,11 +103,19 @@ def _on_step_finish(
"workflowRunId": workflow_run_id,
},
status=400,
headers={
WORKFLOW_PROTOCOL_VERSION_HEADER: WORKFLOW_PROTOCOL_VERSION
},
),
)

return cast(
TResponse, _Response(body={"workflowRunId": workflow_run_id}, status=200)
TResponse,
_Response(
body={"workflowRunId": workflow_run_id},
status=200,
headers={WORKFLOW_PROTOCOL_VERSION_HEADER: WORKFLOW_PROTOCOL_VERSION},
),
)

def _initial_payload_parser(initial_request: str) -> TInitialPayload:
Expand Down
6 changes: 5 additions & 1 deletion upstash_workflow/workflow_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _get_headers(
WORKFLOW_INIT_HEADER: init_header_value,
WORKFLOW_ID_HEADER: workflow_run_id,
WORKFLOW_URL_HEADER: workflow_url,
WORKFLOW_FEATURE_HEADER: "LazyFetch,InitialBody",
WORKFLOW_FEATURE_HEADER: "LazyFetch,InitialBody,WF_DetectTrigger",
}
Copy link
Copy Markdown

@alitariksahin alitariksahin Nov 2, 2025

Choose a reason for hiding this comment

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

should we also add this to callback-feature-set here

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.

about WF_DetectTrigger, it's only needed in initial request

also added the other two feature sets I mentioned in the daily. Apparently they are needed


if not (step and step.call_url):
Expand All @@ -300,6 +300,7 @@ def _get_headers(
base_headers["Upstash-Failure-Callback-Workflow-Init"] = "false"
base_headers["Upstash-Failure-Callback-Workflow-Url"] = workflow_url
base_headers["Upstash-Failure-Callback-Workflow-Calltype"] = "failureCall"
base_headers["Upstash-Failure-Callback-Feature-Set"] = "LazyFetch,InitialBody"
if step and step.call_url:
base_headers[
f"Upstash-Callback-Failure-Callback-Forward-{WORKFLOW_FAILURE_HEADER}"
Expand All @@ -317,6 +318,9 @@ def _get_headers(
base_headers["Upstash-Callback-Failure-Callback-Workflow-Calltype"] = (
"failureCall"
)
base_headers["Upstash-Callback-Failure-Callback-Feature-Set"] = (
"LazyFetch,InitialBody"
)

if _should_set_retries(retries):
base_headers["Upstash-Failure-Callback-Retries"] = str(retries)
Expand Down