Skip to content

fix: fail task when update handler continues as new - #1708

Open
Sakshamm-Goyal wants to merge 2 commits into
temporalio:mainfrom
Sakshamm-Goyal:agent/repro-update-continue-as-new
Open

fix: fail task when update handler continues as new#1708
Sakshamm-Goyal wants to merge 2 commits into
temporalio:mainfrom
Sakshamm-Goyal:agent/repro-update-continue-as-new

Conversation

@Sakshamm-Goyal

Copy link
Copy Markdown
Contributor

Fixes #436.

ContinueAsNewError derives from BaseException, so the update-handler task bypassed the normal update exception path and escaped as an unobserved detached-task exception. The update never completed and the workflow task was not failed.

Treat that control-flow exception as a workflow-task failure in the update path. On retry, the update can complete normally; it never continues the workflow from the update handler.

Regression coverage proves the baseline failure (an unhandled update task and timed-out update RPC) and verifies the retry completes after exactly one task failure.

Validation:

  • pytest tests/worker/test_workflow.py::test_workflow_update_continue_as_new_fails_task tests/worker/test_workflow.py::test_workflow_update_task_fails tests/worker/test_workflow.py::test_workflow_update_handlers_unhappy -q (3 passed)
  • ruff format --check temporalio/worker/_workflow_instance.py tests/worker/test_workflow.py
  • git diff --check

Note: whole-file Ruff reports seven existing diagnostics in unrelated lines of tests/worker/test_workflow.py.

@Sakshamm-Goyal
Sakshamm-Goyal requested a review from a team as a code owner July 31, 2026 04:43
Comment thread temporalio/worker/_workflow_instance.py Outdated
@Sakshamm-Goyal

Copy link
Copy Markdown
Contributor Author

Corrected the inaccurate comment in 592e6e6. Continue-as-new is now documented as valid only from the top-level workflow; the update-handler path fails the workflow task rather than allowing that control-flow exception to escape. The change is comment-only and source compilation passes.

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.

[Bug] Ensure continue as new raised from update handler is a task failure

2 participants