Skip to content

test(langchain): Consolidate span origin assertion#5723

Open
alexander-alderman-webb wants to merge 5 commits intowebb/langchain/consolidate-tool-testfrom
webb/langchain/span-origin
Open

test(langchain): Consolidate span origin assertion#5723
alexander-alderman-webb wants to merge 5 commits intowebb/langchain/consolidate-tool-testfrom
webb/langchain/span-origin

Conversation

@alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Mar 20, 2026

Description

Check span origin in test_langchain_agent.

Issues

Reminders

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (asgi) Add option to disable suppressing chained exceptions by alexander-alderman-webb in #5714
  • (logging) Separate ignore lists for events/breadcrumbs and sentry logs by sl0thentr0py in #5698

Bug Fixes 🐛

Anthropic

  • Set exception info on streaming span when applicable by alexander-alderman-webb in #5683
  • Patch AsyncStream.close() and AsyncMessageStream.close() to finish spans by alexander-alderman-webb in #5675
  • Patch Stream.close() and MessageStream.close() to finish spans by alexander-alderman-webb in #5674

Other

  • (starlette) Catch Jinja2Templates ImportError by alexander-alderman-webb in #5741

Documentation 📚

  • Add note on AI PRs to CONTRIBUTING.md by sentrivana in #5696

Internal Changes 🔧

Langchain

  • Consolidate span origin assertion by alexander-alderman-webb in #5723
  • Consolidate available tools assertion by alexander-alderman-webb in #5721

Other

  • Add -latest alias for each integration test suite by sentrivana in #5706
  • Use date-based branch names for toxgen PRs by sentrivana in #5704
  • 🤖 Update test matrix with new releases (03/19) by github-actions in #5703
  • Add client report tests for span streaming by sentrivana in #5677

Other

  • Update CHANGELOG.md by sentrivana in #5685

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Codecov Results 📊

32 passed | Total: 32 | Pass Rate: 100% | Execution Time: 255ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +27
Passed Tests 📈 +27
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 15566 uncovered lines.
✅ Project coverage is 24.5%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    21.30%    24.50%     +3.2%
==========================================
  Files          189       189         —
  Lines        20616     20616         —
  Branches      6738      6738         —
==========================================
+ Hits          4392      5050      +658
- Misses       16224     15566      -658
- Partials       342       425       +83

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 23, 2026 09:56
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner March 23, 2026 09:56
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Consolidation drops origin check for invoke_agent span
    • I restored the missing coverage by asserting the gen_ai.invoke_agent span origin is auto.ai.langchain in the consolidated LangChain agent test.

Create PR

Or push these changes by commenting:

@cursor push 05bb2596cf
Preview (05bb2596cf)
diff --git a/tests/integrations/langchain/test_langchain.py b/tests/integrations/langchain/test_langchain.py
--- a/tests/integrations/langchain/test_langchain.py
+++ b/tests/integrations/langchain/test_langchain.py
@@ -217,12 +217,14 @@
     assert tx["contexts"]["trace"]["origin"] == "manual"
 
     chat_spans = list(x for x in tx["spans"] if x["op"] == "gen_ai.chat")
+    invoke_agent_span = next(x for x in tx["spans"] if x["op"] == "gen_ai.invoke_agent")
     tool_exec_span = next(x for x in tx["spans"] if x["op"] == "gen_ai.execute_tool")
 
     assert len(chat_spans) == 2
 
     assert chat_spans[0]["origin"] == "auto.ai.langchain"
     assert chat_spans[1]["origin"] == "auto.ai.langchain"
+    assert invoke_agent_span["origin"] == "auto.ai.langchain"
     assert tool_exec_span["origin"] == "auto.ai.langchain"
 
     # We can't guarantee anything about the "shape" of the langchain execution graph

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

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.

2 participants