Skip to content

Proactively cancel activities on workflow termination and timeout#10047

Open
rkannan82 wants to merge 2 commits intomainfrom
kannan/cancel-activity-on-terminate
Open

Proactively cancel activities on workflow termination and timeout#10047
rkannan82 wants to merge 2 commits intomainfrom
kannan/cancel-activity-on-terminate

Conversation

@rkannan82
Copy link
Copy Markdown
Contributor

@rkannan82 rkannan82 commented Apr 24, 2026

What

When a workflow is terminated or times out, dispatch cancel-commands to workers for in-flight activities. Extends the mechanism from #9233 to cover forceful workflow close scenarios (including reset, which terminates the old run).

Guarded by EnableCancelActivityWorkerCommand. Disabled.

Why

Previously, workers only discovered workflow termination/timeout passively via heartbeat (NOT_FOUND) or when completing the activity. If heartbeat isn't enabled, activities run to completion uselessly.

How did you test it?

  • Unit tests covering filtering logic (control queue, started clock, feature flag) and multi-queue batching.
  • E2E tests for terminate and reset: verify cancel command arrives on control queue with matching task token.

🤖 Generated with Claude Code

@rkannan82 rkannan82 force-pushed the kannan/cancel-activity-on-terminate branch from 3f50b28 to 2802499 Compare May 4, 2026 18:23
When a workflow is terminated or times out, dispatch cancel commands to
workers for in-flight activities that registered a control queue. Extends
the mechanism from #9233 to cover forceful workflow close scenarios
(including reset, which terminates the old run).

Guarded by EnableCancelActivityWorkerCommand. Disabled by default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82 rkannan82 force-pushed the kannan/cancel-activity-on-terminate branch from 2802499 to 69daa0c Compare May 4, 2026 18:25
@rkannan82 rkannan82 requested a review from yycptt May 4, 2026 18:25
@rkannan82 rkannan82 marked this pull request as ready for review May 4, 2026 18:25
@rkannan82 rkannan82 requested review from a team as code owners May 4, 2026 18:25
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant