Python: make declarative YAML path loading UTF-8 and async-safe - #8260
Python: make declarative YAML path loading UTF-8 and async-safe#8260fzfzzfzzzfzzzz wants to merge 1 commit 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.
|
fzfzzfzzzfzzzz please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
4 similar comments
|
fzfzzfzzzfzzzz please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
fzfzzfzzzfzzzz please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
fzfzzfzzzfzzzz please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
fzfzzfzzzfzzzz please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.