Skip to content

fix: correct coroutine_wrapper target in wrap_AsyncBackgroundExecutor_submit (closes #1739)#1742

Open
botbikamordehai2-sketch wants to merge 2 commits into
newrelic:mainfrom
botbikamordehai2-sketch:fix/issue-1739-1779961262
Open

fix: correct coroutine_wrapper target in wrap_AsyncBackgroundExecutor_submit (closes #1739)#1742
botbikamordehai2-sketch wants to merge 2 commits into
newrelic:mainfrom
botbikamordehai2-sketch:fix/issue-1739-1779961262

Conversation

@botbikamordehai2-sketch
Copy link
Copy Markdown

What

In wrap_AsyncBackgroundExecutor_submit, coroutine_wrapper was incorrectly called with wrapped (the AsyncBackgroundExecutor.submit method itself) instead of func (the coroutine function being submitted). This caused the wrong object to be wrapped and passed as the callable to submit, breaking LangGraph's weakref.WeakMethod usage in the runner.

Fix

Change func = coroutine_wrapper(wrapped, context) to func = coroutine_wrapper(func, context) so the submitted coroutine function is wrapped with the transaction context, not the submit method itself.

Closes #1739

@botbikamordehai2-sketch botbikamordehai2-sketch requested a review from a team as a code owner May 28, 2026 09:41
@mergify mergify Bot added the tests-failing Tests failing in CI. label May 28, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 28, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.04%. Comparing base (9022f11) to head (d443ad9).

Files with missing lines Patch % Lines
newrelic/hooks/mlmodel_langgraph.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1742      +/-   ##
==========================================
- Coverage   82.07%   82.04%   -0.03%     
==========================================
  Files         215      215              
  Lines       26309    26309              
  Branches     4150     4150              
==========================================
- Hits        21592    21585       -7     
- Misses       3304     3310       +6     
- Partials     1413     1414       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TimPansino
Copy link
Copy Markdown
Contributor

Good catch, that was definitely a typo. Thanks for the quick fix. We'll try to get this released early next week with some other things.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 29, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ lrafeei
❌ botbikamordehai2-sketch
You have signed the CLA already but the status is still pending? Let us recheck it.

@TimPansino
Copy link
Copy Markdown
Contributor

@botbikamordehai2-sketch Can you sign the CLA so we can merge this?

@mergify mergify Bot removed the tests-failing Tests failing in CI. label May 29, 2026
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.

LangGraph: TypeError "FunctionWrapperBase missing required argument 'wrapper'" from weakref.WeakMethod after create_agent instrumentation in 13.0.1

5 participants