Skip to content

Comments

cancel outstanding tasks if one task raises in generate#793

Merged
willccbb merged 1 commit intomainfrom
daniel/fix-orphaned-tasks
Jan 28, 2026
Merged

cancel outstanding tasks if one task raises in generate#793
willccbb merged 1 commit intomainfrom
daniel/fix-orphaned-tasks

Conversation

@rasdani
Copy link
Contributor

@rasdani rasdani commented Jan 28, 2026

Description

this fixes orphaned tasks sitting around, when a single task in generate raises an exception.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes


Note

Prevents orphaned async tasks during rollout generation.

  • In Environment.generate, wrap awaiting of as_completed coroutines with try/except; on any task exception, cancel all remaining tasks and drain them via asyncio.gather(..., return_exceptions=True) before re-raising
  • No API changes; behavior only affects error handling and task cleanup

Written by Cursor Bugbot for commit 8f3f734. This will update automatically on new commits. Configure here.

@willccbb willccbb merged commit f40fb35 into main Jan 28, 2026
6 checks passed
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.

2 participants