Skip to content

FIX: Offload local dataset file reads - #2402

Merged
hannahwestra25 merged 2 commits into
microsoft:mainfrom
biefan:agent/offload-local-dataset-io
Aug 17, 2026
Merged

FIX: Offload local dataset file reads#2402
hannahwestra25 merged 2 commits into
microsoft:mainfrom
biefan:agent/offload-local-dataset-io

Conversation

@biefan

Copy link
Copy Markdown
Contributor

Description

Local dataset loading currently performs synchronous file reads and YAML parsing from async methods. This can block the event loop while datasets are loaded or their metadata is discovered.

This change:

  • runs SeedDataset.from_yaml_file in a worker thread from fetch_dataset_async;
  • moves local metadata file reading and YAML parsing into the same non-blocking path; and
  • adds regression tests that verify the synchronous loaders are passed to asyncio.to_thread instead of being called on the event loop thread.

Dataset contents, metadata coercion, filtering, and error propagation remain unchanged.

Tests and Documentation

  • uv run pytest tests/unit/datasets/test_local_dataset_loader.py tests/unit/datasets/test_seed_dataset_provider.py -q — 210 passed
  • uv run ruff check pyrit/datasets/seed_datasets/local/local_dataset_loader.py tests/unit/datasets/test_local_dataset_loader.py tests/unit/datasets/test_seed_dataset_provider.py — passed
  • uv run ruff format --check pyrit/datasets/seed_datasets/local/local_dataset_loader.py tests/unit/datasets/test_local_dataset_loader.py tests/unit/datasets/test_seed_dataset_provider.py — passed
  • uv run ty check pyrit/datasets/seed_datasets/local/local_dataset_loader.py — passed

Documentation and JupyText updates are not applicable because this does not change the public API or documented behavior.

@biefan biefan (biefan) changed the title [DRAFT] FIX: Offload local dataset file reads FIX: Offload local dataset file reads Aug 17, 2026
@biefan
biefan (biefan) marked this pull request as ready for review August 17, 2026 04:41
@hannahwestra25 hannahwestra25 self-assigned this Aug 17, 2026

@hannahwestra25 hannahwestra25 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good! thanks for contributing!

@hannahwestra25
hannahwestra25 added this pull request to the merge queue Aug 17, 2026
Merged via the queue into microsoft:main with commit 1270f26 Aug 17, 2026
54 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