Conversation
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@claude review |
There was a problem hiding this comment.
Claude Code Review
No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.
Tip: disable this comment in your organization's Code Review settings.
| @pytest.mark.parametrize("raw_value", ["0", "-5", "abc", "1.5"]) | ||
| @pytest.mark.parametrize( | ||
| "raw_value", | ||
| ["0", "-5", "abc", "1.5", pytest.param("9" * 5000, id="overlong-digits")], |
There was a problem hiding this comment.
If Python's integer-string digit limit is disabled, or the test runs on an older Python 3.10 patch release without that limit, converting the 5,000-digit value succeeds. The resolver then uses that positive value instead of the default, so this test fails its limit and warning assertions. Make the test establish a conversion limit or account for runtimes without one.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/unit/test_span_processor.py
Line: 201
Comment:
**Test depends on Python limit**
If Python's integer-string digit limit is disabled, or the test runs on an older Python 3.10 patch release without that limit, converting the 5,000-digit value succeeds. The resolver then uses that positive value instead of the default, so this test fails its limit and warning assertions. Make the test establish a conversion limit or account for runtimes without one.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Looks good — a small, correct fix for the ValueError on overlong numeric env values, with a regression test covering the exact failure mode.
Extended reasoning...
The change touches only _resolve_max_batch_size_bytes() in span_processor.py, wrapping int(raw_value) in try/except ValueError to handle Python 3.11+'s int-to-str conversion digit limit, falling back to the existing 0/warning/default-limit path. No security-sensitive surface (auth, crypto, permissions) is touched; it's parsing of a local env var into a batch-size int. The test change adds a single parametrized case (5000-digit string) to an existing test, which I confirmed exercises the new except branch. Small, self-contained, mechanical fix with clear intent and test coverage, matching the described bug precisely.
What does this PR do?
Follow-up to #1909. If
LANGFUSE_OTEL_MAX_BATCH_SIZE_BYTESis an all-digit string longer than Python's integer conversion limit (4,300 digits on 3.11+),int()raisesValueError. That error propagated out ofLangfuse()initialization. Now such values are handled like any other invalid value: a warning is logged and the default 64 MiB limit is kept.This was flagged by the Codex, Greptile and Claude reviews on #1909.
Type of change
Verification
The existing invalid-values test gained an
overlong-digitscase (5,000 nines). It failed withValueErrorbefore the fix.Checklist
code_review.md..env.templateif needed.The PR appears safe to merge, though the new regression test should be made independent of the runtime integer-string limit.
Summary
The PR catches integer-conversion failures for the OTel batch-size environment variable and adds a regression case. The new test assumes a runtime conversion limit that is not guaranteed in every supported configuration.
Reviews (1) · Last reviewed commit: "fix(otel): fall back to default batch li..."