Skip to content

perf: optimize async coroutine inspection unwrapping#108

Open
shenald-dev wants to merge 4 commits into
mainfrom
bolt-async-inspection-fix-12350163539096166018
Open

perf: optimize async coroutine inspection unwrapping#108
shenald-dev wants to merge 4 commits into
mainfrom
bolt-async-inspection-fix-12350163539096166018

Conversation

@shenald-dev
Copy link
Copy Markdown
Owner

Replaced manual iteration and unwrapping of functools.partial in engine.py with direct inspect.iscoroutinefunction(func) assignments, as Python 3.8+ supports this natively. This prevents unreachable dead code and simplifies the async evaluation hot path.


PR created automatically by Jules for task 12350163539096166018 started by @shenald-dev

Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@shenald-dev
Copy link
Copy Markdown
Owner Author

Hey @shenald-dev, heads up — this PR has merge conflicts with main.

To fix:

git checkout bolt-async-inspection-fix-12350163539096166018
git fetch origin && git merge origin/main

@shenald-dev shenald-dev added enhancement New feature or request refactor labels May 20, 2026
@shenald-dev
Copy link
Copy Markdown
Owner Author

Please resolve the merge conflicts with main before merging. Additionally, consider adding a test case to verify that the optimization does not change behavior for functools.partial-wrapped coroutines and regular functions. Ensure the minimum supported Python version is 3.8+ as assumed.

Reviewed — quality: high

@google-labs-jules
Copy link
Copy Markdown
Contributor

Hey @shenald-dev, heads up — this PR has merge conflicts with main.

To fix:

git checkout bolt-async-inspection-fix-12350163539096166018
git fetch origin && git merge origin/main

I have successfully fetched and merged main into the PR branch, resolved the merge conflicts in .jules/bolt.md, and ensured tests pass. I am submitting the code changes now.

Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
@shenald-dev
Copy link
Copy Markdown
Owner Author

🔄 Re-evaluating based on recent changes:

Thanks for the optimization! The changes look good and CI passes. Please ensure that the pyproject.toml reflects the required Python >=3.8 version and add a test case (e.g., in tests/test_fail_fast.py or a new test) that verifies behavior is unchanged for functools.partial-wrapped coroutines and regular functions. Once those are addressed, this PR is ready to merge.

Reviewed — quality: medium

@google-labs-jules
Copy link
Copy Markdown
Contributor

🔄 Re-evaluating based on recent changes:

Thanks for the optimization! The changes look good and CI passes. Please ensure that the pyproject.toml reflects the required Python >=3.8 version and add a test case (e.g., in tests/test_fail_fast.py or a new test) that verifies behavior is unchanged for functools.partial-wrapped coroutines and regular functions. Once those are addressed, this PR is ready to merge.

Reviewed — quality: medium

Thanks for the review!

  1. Regarding requires-python, the pyproject.toml is currently configured with requires-python = ">=3.10", which inherently satisfies the >=3.8 requirement since it enforces an even higher version.
  2. I have added test_functools_partial_wrapped_sync_function to tests/test_engine.py to explicitly verify behavior for a regular synchronous function wrapped in functools.partial. test_async_callable_with_partial already exists to verify async functions wrapped in functools.partial. Tests pass successfully.

Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
@shenald-dev
Copy link
Copy Markdown
Owner Author

Hey @shenald-dev, heads up — this PR has merge conflicts with main.

To fix:

git checkout bolt-async-inspection-fix-12350163539096166018
git fetch origin && git merge origin/main

@google-labs-jules
Copy link
Copy Markdown
Contributor

Hey @shenald-dev, heads up — this PR has merge conflicts with main.

To fix:

git checkout bolt-async-inspection-fix-12350163539096166018
git fetch origin && git merge origin/main

I have successfully fetched and merged main into the PR branch, resolved the merge conflicts, and verified tests still pass. Pushing up the fix now.

Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
@shenald-dev
Copy link
Copy Markdown
Owner Author

PR is well-structured, includes necessary tests and updates pyproject.toml for Python 3.8+. The optimization is clear and CI passes.

Reviewed — quality: high

@google-labs-jules
Copy link
Copy Markdown
Contributor

PR is well-structured, includes necessary tests and updates pyproject.toml for Python 3.8+. The optimization is clear and CI passes.

Reviewed — quality: high

Acknowledged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant