Skip to content

fix(executor): attribute parallel-batch exceptions to the correct action (#415)#417

Open
Yuthika10 wants to merge 1 commit into
VyomKulshrestha:mainfrom
Yuthika10:fix/batch-exception-attribution-415
Open

fix(executor): attribute parallel-batch exceptions to the correct action (#415)#417
Yuthika10 wants to merge 1 commit into
VyomKulshrestha:mainfrom
Yuthika10:fix/batch-exception-attribution-415

Conversation

@Yuthika10

Copy link
Copy Markdown
Contributor

Summary

In the parallel-batch path of Executor.execute, when an action raised an exception, the failure was always recorded against batch[0] - the first action in the batch - regardless of which action actually raised. asyncio.gather returns results positionally, so the exception's position in batch_results corresponds to batch[position], but that position was discarded and batch[0] was hardcoded. Since _analyze_dependencies groups independent actions into multi-action batches, a non-first action raising would name the wrong action in the resulting ActionResult and the audit trail.

This fixes the attribution to use the position, and extracts the batch-result collection into a small testable method so the behavior can be unit-tested.

Closes #415


Type of change

  • Bug fix
  • New feature / enhancement
  • Documentation update
  • Tests / CI
  • Performance improvement
  • Refactor (no functional change)

Changes made

  • daemon/pilot/agents/executor.py: extracted the parallel-batch result handling into _collect_batch_results(batch, batch_results, results), which iterates with enumerate and attributes a raised exception to batch[position] instead of batch[0]. The success branch is unchanged (it already used the idx returned by execute_single_action).
  • daemon/tests/test_executor_batch_attribution.py: new unit tests - a non-first action raising is attributed to the correct action, the first-action case still works (guards against simply flipping the bug), and an all-success batch reports no failure.

How to test

  1. pytest daemon/tests/test_executor_batch_attribution.py -v - the three tests pass.
  2. The key test, test_exception_attributed_to_failing_action_not_first, fails against the old batch[0] code and passes with the fix - it builds a 3-action batch where the second action raises and asserts the failure names that action.
  3. ruff check and ruff format --check on the two files are clean.

Checklist

  • I have read the CONTRIBUTING.md
  • My code follows the existing code style
  • I have added/updated tests where applicable
  • All existing tests pass (pytest for backend, npm run test for frontend)
  • I have updated documentation if needed
  • I have tested on at least one platform (Windows / macOS / Linux)

Screenshots / recordings (if UI change)

N/A — no UI change.


GSSoC declaration

  • This contribution is made under the GSSoC 2026 program
  • I have not plagiarised code from other repositories

@Yuthika10

Copy link
Copy Markdown
Contributor Author

Hi @VyomKulshrestha just sent a PR for issue #415 - has passed all 6 checks. Can you please review the code? Would love your feedback on this for any further improvements.

@Yuthika10

Copy link
Copy Markdown
Contributor Author

Hi @VyomKulshrestha! Can you plese go thorugh this PR?

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.

[Bug] Parallel batch exceptions are attributed to the wrong action (always batch[0]) in executor.py

1 participant