chore(sdk/python): enable ruff ASYNC lint rules to gate async/blocking hazards (#620)#812
Draft
7vignesh wants to merge 1 commit into
Draft
chore(sdk/python): enable ruff ASYNC lint rules to gate async/blocking hazards (#620)#8127vignesh wants to merge 1 commit into
7vignesh wants to merge 1 commit into
Conversation
…g hazards (Agent-Field#620) Enable ruff's flake8-async (ASYNC) ruleset in pyproject.toml to catch blocking calls inside async functions at lint time. This prevents new violations from landing while documenting the 25 existing findings as per-file-ignores to be fixed in follow-up slices. Rules now enforced on new code: - ASYNC210: blocking HTTP calls (requests.*) in async functions - ASYNC230: blocking open() in async functions - ASYNC240: blocking os.path / pathlib in async functions - ASYNC110: asyncio.sleep in while loop (use asyncio.Event) Existing violations (5 production files, 5 test files) are suppressed via per-file-ignores with a comment referencing Agent-Field#620. Each will be resolved in dedicated follow-up PRs covering the behavioural slices (blocking requests offload, asyncio.run guards, lock timeouts). Part of Agent-Field#620.
Contributor
Performance
✓ No regressions detected |
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables ruff's
flake8-async(ASYNC) ruleset so blocking calls inside async functions are caught at lint time. This is slice 1 of the work on #620 the non-behavioural, preventive fix that gates new code immediately while documenting the existing debt.No runtime behaviour changes. Existing violations are suppressed via
per-file-ignoresso CI passes right away; each will be fixed in follow-up slices covering the blocking-requests offload,asyncio.run()guards, and lock timeouts.Type of change
What's now enforced on new code
requests.*blocking HTTP call inside an async functionopen()blocking file I/O inside an async functionos.path.*/pathlib.Path.*blocking methods inside an async functionasyncio.sleepin awhileloop (useasyncio.Eventinstead)Existing violations (25 total, suppressed for now)
agentfield/agent.pyagentfield/agent_ai.pyagentfield/harness/_runner.pyagentfield/harness/providers/opencode.pyagentfield/memory_events.pyThese are documented in
per-file-ignoreswith a comment referencing #620 and will be resolved in the subsequent behavioural slices.Test plan
cd sdk/python && ruff check .passes cleanrequests.getinside anasync def)Test coverage
Checklist
Related issues / PRs
Part of #620
Builds on #799 (loop-aware teardown fix for ResultCache / AsyncExecutionManager / ConnectionManager)