#2435·bisheng

Workflow Celery tasks fail after successful execution when telemetry metadata lookup raises

Author: luochen211Created Sep 22, 2026Updated Sep 22, 2026

Description

execute_workflow and continue_workflow perform workflow execution inside a try block, then query workflow metadata and submit telemetry from an unguarded finally block. If WorkFlowService.get_one_workflow_simple_info_sync() raises after the workflow runner has completed successfully, the exception escapes the Celery task.

This changes an already-completed workflow into a Celery failure and can make task-level retries or monitoring report the wrong outcome. For workflows with side effects, a retry at this boundary can also repeat work even though Redis already contains a terminal workflow status.

Reproduction

  1. Stub _execute_workflow (or _continue_workflow) to return successfully.
  2. Stub WorkFlowService.get_one_workflow_simple_info_sync to raise RuntimeError.
  3. Invoke the corresponding Celery task body.

On current main (2456ec17c), the telemetry metadata exception escapes the task after the workflow runner has returned. Both initial execution and continuation use the same pattern.

Expected behavior

Telemetry is best-effort and must not change the workflow task outcome. Failures while constructing or submitting telemetry should be logged with their traceback, while the completed workflow result remains authoritative.

Proposed fix

Move the shared telemetry block into a small best-effort helper used by both task wrappers, log telemetry exceptions, and add deterministic regression coverage for the initial and continuation paths.