#503·mcp-agent

@app.workflow_run does not fail the run on Exception

Author: rholinsheadCreated Sep 17, 2025Updated Sep 18, 2025

When an Exception is raised within an @app.workflow_run-wrapped function, it results in a Workflow Task Failed in temporal but the run itself stays in 'Running' state. For example:

python
@app.workflow
class PauseResumeWorkflow(Workflow[str]):
    """
    A workflow that demonstrates Temporal's signaling capabilities.
    This workflow pauses execution and waits for a signal before continuing.
    """

    @app.workflow_run
    async def run(
        self, message: str = "This workflow demonstrates pause and resume functionality"
    ) -> WorkflowResult[str]:
        """
        Run the pause-resume workflow.

        Args:
            message: A message to include in the workflow result.

        Returns:
            WorkflowResult containing the processed data.
        """
        print(f"Starting PauseResumeWorkflow with message: {message}")
        print(f"Workflow is pausing, workflow_id: {self.id}, run_id: {self.run_id}")
        print(
            "To resume this workflow, use the 'workflows-resume' tool or the Temporal UI"
        )

        raise RuntimeError("TEST")