Skip to content

fix: ProcessPoolTaskRunner now checks upstream task states in wait_for dependencies#21122

Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/OSS-7764-1773438866
Draft

fix: ProcessPoolTaskRunner now checks upstream task states in wait_for dependencies#21122
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/OSS-7764-1773438866

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

Fixes a bug where ProcessPoolTaskRunner silently ignored upstream task failures in wait_for dependencies. Downstream tasks would execute even when their upstream dependencies had failed, instead of being set to NotReady as ThreadPoolTaskRunner correctly does.

Closes #21117

Root cause

_resolve_futures_and_submit called wait() on wait_for futures but then passed wait_for=None to the subprocess, so the subprocess task engine's _wait_for_dependencies was never invoked to check upstream states.

Fix

After waiting for futures to complete, extract their terminal State objects and pass them as wait_for to the subprocess. State objects are picklable (unlike futures) and the existing task engine machinery (_wait_for_dependenciesresolve_to_final_result) already handles State objects — raising UpstreamTaskError for non-completed upstreams, which results in the NotReady state.

Important review notes

  • State picklability: The fix relies on State (Pydantic model) surviving cloudpickle serialization to the subprocess. This should be fine but is worth verifying.
  • allow_failure annotations: If wait_for items are wrapped in allow_failure(), the annotation is not preserved through the state extraction. However, this edge case was already broken before this PR (the existing wait(list(wait_for)) call would fail on allow_failure-wrapped items). Fixing that is out of scope.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

Links

…r dependencies

Previously, _resolve_futures_and_submit called wait() on wait_for
futures but discarded their states by passing wait_for=None to the
subprocess. This meant the subprocess task engine never ran
_wait_for_dependencies, so failed upstream tasks were silently ignored
and the downstream task would execute instead of being set to NotReady.

The fix extracts the terminal State from each waited future and passes
those states (which are picklable, unlike futures) to the subprocess.
The task engine's _wait_for_dependencies -> resolve_to_final_result
already handles State objects, correctly raising UpstreamTaskError for
non-completed upstreams, which sets the downstream task to NotReady.

Closes #21117

Co-authored-by: alex.s <alex.s>
Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions github-actions bot added the bug Something isn't working label Mar 13, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 13, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing devin/OSS-7764-1773438866 (a30c032) with main (bba455a)

Open in CodSpeed

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProcessPoolTaskRunner ignores upstream task failures in wait_for dependencies

0 participants