Python: make declarative YAML path loading UTF-8 and async-safe - #8260
Evan Mattson (moonbox3) merged 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation preserves missing-file behavior and adequately tests UTF-8 and asynchronous file access.
Pull request overview
Makes declarative YAML path loading portable and async-safe.
Changes:
- Reads agent and workflow YAML files explicitly as UTF-8.
- Offloads asynchronous agent file reads with
asyncio.to_thread(). - Adds regression tests for Unicode content, threading, and encoding.
File summaries
| File | Description |
|---|---|
_loader.py |
Adds UTF-8 agent loading and non-blocking async reads. |
_workflows/_factory.py |
Adds explicit UTF-8 workflow loading. |
test_declarative_loader.py |
Tests agent encoding and async thread offloading. |
test_workflow_factory.py |
Tests workflow UTF-8 loading. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Please agree to the CLA |
|
@microsoft-github-policy-service agree |
|
Thanks for the update. Before this is ready, could you please:
Once those are addressed, please re-request review. Thanks! |
|
Thanks! I checked the failed checks. The CLA is green now. The DevFlow PR Review run was cancelled by the workflow's concurrency handling (Canceling since a higher priority waiting request ... exists), so command_check and team_check never completed successfully. I don't have permission to rerun the upstream workflow as an external contributor. Could you please retrigger the DevFlow PR Review for #8260? Once command_check and team_check pass, the Merge Gatekeeper can be rerun and I'll re-request review. |
Motivation & Context
Declarative YAML path loaders relied on the process locale, so UTF-8 definitions containing characters outside a platform's default encoding could fail before parsing. The async agent path loader also performed filesystem reads directly on the event-loop thread.
Description & Review Guide
asyncio.to_thread()and translates a missing file back toDeclarativeLoaderError.Related Issue
Fixes #8254
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix) — a workflow keeps the label and title prefix in sync automatically.