Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sentry_sdk/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def iter_default_integrations(with_auto_enabling_integrations):

_INTEGRATION_DEACTIVATES = {
"langchain": {"openai", "anthropic"},
"openai_agents": {"openai"},
"pydantic_ai": {"openai"},
}


Expand Down
14 changes: 12 additions & 2 deletions tests/test_ai_integration_deactivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from sentry_sdk import get_client
from sentry_sdk.integrations import _INTEGRATION_DEACTIVATES
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration
from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration


try:
Expand Down Expand Up @@ -36,6 +38,10 @@ def test_integration_deactivates_map_exists():
assert "langchain" in _INTEGRATION_DEACTIVATES
assert "openai" in _INTEGRATION_DEACTIVATES["langchain"]
assert "anthropic" in _INTEGRATION_DEACTIVATES["langchain"]
assert "openai_agents" in _INTEGRATION_DEACTIVATES
assert "openai" in _INTEGRATION_DEACTIVATES["openai_agents"]
assert "pydantic_ai" in _INTEGRATION_DEACTIVATES
assert "openai" in _INTEGRATION_DEACTIVATES["pydantic_ai"]


def test_langchain_auto_deactivates_openai_and_anthropic(
Expand Down Expand Up @@ -104,13 +110,17 @@ def test_user_can_override_with_both_explicit_integrations(
assert AnthropicIntegration in integration_types


def test_disabling_langchain_allows_openai_and_anthropic(
def test_disabling_integrations_allows_openai_and_anthropic(
sentry_init, reset_integrations
):
sentry_init(
default_integrations=False,
auto_enabling_integrations=True,
disabled_integrations=[LangchainIntegration],
disabled_integrations=[
LangchainIntegration,
OpenAIAgentsIntegration,
PydanticAIIntegration,
],
Copy link

Choose a reason for hiding this comment

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

Bug: Test doesn't verify OpenAI/Anthropic integrations are enabled

The test test_disabling_integrations_allows_openai_and_anthropic was expanded to disable OpenAIAgentsIntegration and PydanticAIIntegration in addition to LangchainIntegration, but the assertion still only verifies that LangchainIntegration not in integration_types. The test name implies it verifies that OpenAIIntegration and AnthropicIntegration are allowed to be enabled, but there's no assertion checking that they actually are in integration_types.

Fix in Cursor Fix in Web

)

client = get_client()
Expand Down
Loading