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 completed Mar 26, 2026 in 3m 40s

2 issues

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
4 skills analyzed
Skill Findings Duration Cost
code-review 0 3m 16s $0.84
find-bugs 2 3m 35s $1.28
skill-scanner 0 1m 37s $0.51
security-review 0 2m $0.72

Duration: 10m 27s · Tokens: 1.8M in / 21.7k out · Cost: $3.36 (+extraction: $0.00, +merge: $0.00)