Skip to content

fix(graph): enforce branch_timeout_seconds and memory_conflict_strategy in parallel execution#6488

Draft
Jose37456 wants to merge 1 commit intoaden-hive:mainfrom
Jose37456:fix/5706-parallel-branch-timeout
Draft

fix(graph): enforce branch_timeout_seconds and memory_conflict_strategy in parallel execution#6488
Jose37456 wants to merge 1 commit intoaden-hive:mainfrom
Jose37456:fix/5706-parallel-branch-timeout

Conversation

@Jose37456
Copy link

Description

ParallelExecutionConfig.branch_timeout_seconds and memory_conflict_strategy were declared but never read. asyncio.gather had no timeout wrapper, so a stalled branch could block the entire graph indefinitely. The output-merge loop unconditionally called write_async on every key, making "first_wins" and "error" strategies no-ops.

Type of Change

  • Bug fix

Related Issues

Fixes #5706

Changes Made

  • core/framework/graph/executor.py:_execute_parallel_branches():
    • Timeout: wraps each branch coroutine with asyncio.wait_for(timeout=config.branch_timeout_seconds) and switches gather to return_exceptions=True so a timeout in one branch doesn't cancel siblings; timed-out branches flow into the existing on_branch_failure strategy
    • Memory conflict: before writing each output key, checks whether a differing value already exists and applies "first_wins" (skip), "error" (raise RuntimeError), or "last_wins" (overwrite, log at DEBUG) accordingly

Testing

  • Lint passes (ruff check clean)
  • No public API changes — all changes are inside _execute_parallel_branches()
  • Default behavior unchanged ("last_wins", 300s timeout)

Checklist

  • Self-review done
  • No new warnings introduced

…gy in parallel execution

Root cause: ParallelExecutionConfig.branch_timeout_seconds and
memory_conflict_strategy were declared but never read — asyncio.gather
had no timeout wrapper and the output-merge loop unconditionally called
write_async regardless of existing values.

Fix 1 — branch timeout: wrap each execute_single_branch coroutine with
asyncio.wait_for(timeout=config.branch_timeout_seconds) and switch gather
to return_exceptions=True so a timeout in one branch doesn't cancel
siblings. Timed-out branches are re-paired with their branch object and
flow naturally into the existing on_branch_failure handling.

Fix 2 — memory conflict strategy: before writing each output key check
whether a value already exists and is different.  If "first_wins", skip
the write; if "error", raise RuntimeError; if "last_wins" (default),
overwrite and log at DEBUG level.

Fixes aden-hive#5706
@github-actions
Copy link

PR Requirements Warning

This PR does not meet the contribution requirements.
If the issue is not fixed within ~24 hours, it may be automatically closed.

PR Author: @Jose37456
Found issues: #5706 (assignees: none)
Problem: The PR author must be assigned to the linked issue.

To fix:

  1. Assign yourself (@Jose37456) to one of the linked issues
  2. Re-open this PR

Exception: To bypass this requirement, you can:

  • Add the micro-fix label or include micro-fix in your PR title for trivial fixes
  • Add the documentation label or include doc/docs in your PR title for documentation changes

Micro-fix requirements (must meet ALL):

Qualifies Disqualifies
< 20 lines changed Any functional bug fix
Typos & Documentation & Linting Refactoring for "clean code"
No logic/API/DB changes New features (even tiny ones)

Why is this required? See #472 for details.

@github-actions github-actions bot added the pr-requirements-warning PR doesn't follow contribution guidelines. Please fix or it will be auto-closed. label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-requirements-warning PR doesn't follow contribution guidelines. Please fix or it will be auto-closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ParallelExecutionConfig.branch_timeout_seconds and memory_conflict_strategy are never enforced

1 participant