Skip to content

fix: Fix exception chains - #7552

Merged
sentrivana merged 7 commits into
major/3.0from
ivana/major/chained-exceptions
Sep 24, 2026
Merged

sentrivana merged 7 commits into
major/3.0from
ivana/major/chained-exceptions

Conversation

@sentrivana

@sentrivana sentrivana commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Port of #4164

See #3913 for an example of an exception chain that is currently not working properly.

Closes https://linear.app/getsentry/issue/PY-1948/better-handling-of-exception-groups

@linear-code

linear-code Bot commented Sep 21, 2026

Copy link
Copy Markdown

PY-1948

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ 63249 passed | ❌ 4 failed | ⏭️ 2890 skipped | Total: 66143 | Pass Rate: 95.62% | Execution Time: 177m 54s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -67850
Passed Tests 📉 -63590
Failed Tests 📈 +2
Skipped Tests 📉 -4262

➕ New Tests (2)

View new tests
  • test_input_attributes_nonstreaming_chat[True-messages0-expected_system_instructions0-expected_input_messages0]
    • File: tests.integrations.mistral.test_mistral
    • Status: ❌ Failing
  • test_async_transport_rate_limiting_with_concurrency
    • File: tests.test_transport
    • Status: ❌ Failing

➖ Removed Tests (1)

View removed tests
  • test_binary_content_encoding_mixed_content[False-False]
    • File: tests.integrations.litellm.test_litellm

❌ Failed Tests

test_input_attributes_nonstreaming_chat[True-messages0-expected_system_instructions0-expected_input_messages0]

File: tests.integrations.mistral.test_mistral
Suite: py3.10-mistral-v2.0.5
Error: KeyError: 139756399903168

Stack Trace
tests/integrations/mistral/test_mistral.py:380: in test_input_attributes_nonstreaming_chat
    sentry_init(
tests/conftest.py:349: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:278: in __init__
    self._init_impl()
sentry_sdk/client.py:428: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:216: in setup_integrations
    for integration_cls in iter_default_integrations(
sentry_sdk/integrations/__init__.py:44: in iter_default_integrations
    yield getattr(import_module(module), cls)
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1024: in _find_and_load
    ???
<frozen importlib._bootstrap>:171: in __enter__
    ???
<frozen importlib._bootstrap>:123: in acquire
    ???
E   KeyError: 139756399903168

test_async_transport_rate_limiting_with_concurrency

File: tests.test_transport
Suite: py3.8-common
Error: AssertionError: assert False is True + where False = _check_disabled('error') + where _check_disabled = <sentry_sdk.transport.AsyncHttpTransport object at 0x7f0108e0ad30>._check_disabled + where <sentry_sdk.transport.AsyncHttpTransport object at 0x7f0108e0ad30> = <sentry_sdk.client._Client object at 0x7f00c4e03af0>.transport

Stack Trace
tests/test_transport.py:1037: in test_async_transport_rate_limiting_with_concurrency
    assert client.transport._check_disabled("error") is True
E   AssertionError: assert False is True
E    +  where False = _check_disabled('error')
E    +    where _check_disabled = <sentry_sdk.transport.AsyncHttpTransport object at 0x7f0108e0ad30>._check_disabled
E    +      where <sentry_sdk.transport.AsyncHttpTransport object at 0x7f0108e0ad30> = <sentry_sdk.client._Client object at 0x7f00c4e03af0>.transport

✅ Patch coverage is 100.00%. Project has 2071 uncovered lines.
❌ Project coverage is 90.14%. Comparing base (43b3bcd) to head (ce8a270).

Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
- Coverage    90.22%    90.14%    -0.08%
==========================================
  Files          194       178       -16
  Lines        25997     20997     -5000
  Branches      9662      7580     -2082
==========================================
+ Hits         23454     18926     -4528
- Misses        2543      2071      -472
- Partials      1451      1197      -254

Generated by Codecov Action

sentrivana and others added 3 commits September 21, 2026 14:00
The huggingface_hub and strawberry tests were still asserting the
integration mechanism type at values[0], but with unified exception
chain handling, chained exceptions now appear at index 0 with
mechanism type "chained".

Co-Authored-By: Claude Opus 4.6 <[email protected]>
pamod-madubashana

This comment was marked as spam.

@sentrivana
sentrivana marked this pull request as ready for review September 22, 2026 09:33
@sentrivana
sentrivana requested a review from a team as a code owner September 22, 2026 09:33

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM overall, just need to update a couple of doc links in the comments 🚀

Comment thread sentry_sdk/utils.py Outdated
Comment thread sentry_sdk/utils.py Outdated
@sentrivana
sentrivana merged commit cde3aca into major/3.0 Sep 24, 2026
141 of 145 checks passed
@sentrivana
sentrivana deleted the ivana/major/chained-exceptions branch September 24, 2026 11:02
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.

4 participants