Skip to content

Fix ignore stale executor success with per invocation workload run - #73546

Draft
Pedrinhonitz wants to merge 17 commits into
apache:mainfrom
Pedrinhonitz:fix/ignore-stale-executor-success-with-per-invocation-workload_run_id
Draft

Pedrinhonitz wants to merge 17 commits into
apache:mainfrom
Pedrinhonitz:fix/ignore-stale-executor-success-with-per-invocation-workload_run_id

Conversation

@Pedrinhonitz

Copy link
Copy Markdown
Contributor

Summary

Fixes the deferred-task race where a stale executor SUCCESS (from the worker that exited on defer) is applied to the resumed attempt that still shares the same TaskInstanceKey (try_number unchanged). Heuristics based on next_method + state (SCHEDULED/QUEUED/RUNNING) keep growing and still miss cases.

This PR introduces a per-invocation workload_run_id (UUID):

Generated on every scheduler enqueue and stored on TaskInstance (+ history / migration).

Carried on executor completion events (event_buffer is now (state, info, workload_run_id)).

In process_executor_events, events whose run id does not match the TI’s current workload_run_id are treated as stale (same idea as requeued) and do not fail the current attempt.

LocalExecutor / Celery / Kubernetes emit and consume the id (with provider-compat fallbacks for older cores).

Cleared with external_executor_id on clear/orphan paths.

Related: #66374 / #66431, #67287 / #68741, #72716 / #71579 / #72767


Was generative AI tooling used to co-author this PR?
  • Yes.

Generated-by: Cursor IA IDLE, for discussion and planning of the solution. Following the guidelines

@boring-cyborg boring-cyborg Bot added area:db-migrations PRs with DB migration area:Executors-core LocalExecutor & SequentialExecutor area:providers area:scheduler kind:documentation provider:celery provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Sep 22, 2026
@Pedrinhonitz Pedrinhonitz changed the title Fix/ignore stale executor success with per invocation workload run Fix ignore stale executor success with per invocation workload run Sep 22, 2026
@Pedrinhonitz
Pedrinhonitz force-pushed the fix/ignore-stale-executor-success-with-per-invocation-workload_run_id branch from 940d3dc to 15a4801 Compare September 23, 2026 22:26
@Pedrinhonitz
Pedrinhonitz marked this pull request as draft September 27, 2026 23:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:db-migrations PRs with DB migration area:Executors-core LocalExecutor & SequentialExecutor area:providers area:scheduler kind:documentation provider:celery provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant