Skip to content

Merge branch 'master' into webb/openai/split-up-openai

ca57580
Select commit
Loading
Failed to load commit list.
Draft

ref(openai): Create functions for streaming token usage #5884

Merge branch 'master' into webb/openai/split-up-openai
ca57580
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Mar 26, 2026 in 3m 38s

2 issues

find-bugs: Found 2 issues (1 high, 1 low)

High

Tests call _calculate_token_usage with wrong number of arguments - `sentry_sdk/integrations/openai.py:645`

The _calculate_token_usage function signature was changed from 5 parameters to 4 parameters (removing streaming_message_responses). However, the tests at lines 1800, 1833, 1866, 1900, and 1926 still pass 5 arguments including streaming_message_responses. This will cause test failures since the 4th positional argument will be interpreted as count_tokens instead of as the callable function.

Low

Redundant nested Optional in type annotation - `sentry_sdk/integrations/openai.py:227`

The type annotation on line 227 uses Optional[Optional[Union[str, ResponseInputParam]]] which is redundant. Optional[Optional[X]] is semantically equivalent to Optional[X]. While this doesn't cause runtime issues, it suggests a copy-paste error or misunderstanding of the type.

Also found at:

  • sentry_sdk/integrations/openai.py:262-265

Duration: 3m 35s · Tokens: 642.5k in / 8.2k out · Cost: $1.28 (+extraction: $0.00, +merge: $0.00)

Annotations

Check failure on line 645 in sentry_sdk/integrations/openai.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

Tests call _calculate_token_usage with wrong number of arguments

The `_calculate_token_usage` function signature was changed from 5 parameters to 4 parameters (removing `streaming_message_responses`). However, the tests at lines 1800, 1833, 1866, 1900, and 1926 still pass 5 arguments including `streaming_message_responses`. This will cause test failures since the 4th positional argument will be interpreted as `count_tokens` instead of as the callable function.