fix: preserve float values in retry backoff config#30
Merged
steve-calvert-glean merged 1 commit intomainfrom Mar 24, 2026
Merged
fix: preserve float values in retry backoff config#30steve-calvert-glean merged 1 commit intomainfrom
steve-calvert-glean merged 1 commit intomainfrom
Conversation
Contributor
Author
steve-calvert-glean
left a comment
There was a problem hiding this comment.
Code Review — CHK-002
Acceptance Criteria Met
int()truncation is removed from all three variables:initial_interval,max_interval,max_elapsed_timeround()is used in place ofint()— this is the correct choice per the acceptance criteria- The dead
import reis removed (also cleans up CHK-028 as noted in the PR) - Change is minimal and focused — only
_common.pyis modified
Issues Found
round()still converts floats to ints, which means the fix is a behavior improvement (0.5 rounds to 1 instead of truncating to 0) but does not fully "preserve" float values as the PR title says. This is fine ifBackoffStrategyrequiresinttypes — the PR description acknowledges this: "BackoffStrategy requires int types, so round() is used to preserve intent". Confirm thatBackoffStrategy.initial_interval,max_interval, andmax_elapsed_timeare typed asintin the SDK; if they acceptfloatdirectly,round()is still safe but the comment in the description would need updating.- The
exponentfield is correctly left as a float (passed directly toBackoffStrategy), confirming the SDK does accept floats for at least one field. This inconsistency in the SDK's type surface is worth a comment in the code so future maintainers don't wonder whyexponentis float while the others useround(). _parse_retry_env_int(lines 68-75 of_common.py) is now dead code — nothing calls it after this change. It's not a blocker, but it's orphaned and should be removed in a follow-up.
Suggestions
- Add a brief inline comment near the
round()calls explaining why:# BackoffStrategy requires int; round() preserves intent (e.g. 0.5 → 1, not 0) - Track removal of
_parse_retry_env_intas a follow-up cleanup item.
Verdict: Ready to merge
rwjblue-glean
approved these changes
Mar 23, 2026
2532135 to
06818e2
Compare
rwjblue-glean
approved these changes
Mar 24, 2026
06818e2 to
3bfbd7b
Compare
…CHK-002) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3bfbd7b to
13b40c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
int()truncation in_build_retry_config()that silently corrupted sub-second valuesGLEAN_RETRY_INITIAL=0.5now correctly rounds to1instead of truncating to0import re(dead code)Root Cause
initial_interval = int(initial)truncates any float < 1.0 to zero, disabling the initial backoff.BackoffStrategyrequiresinttypes, soround()is used to preserve intent (0.5 → 1, not 0).Fixes
CHK-002 from EVAL-CHECKLIST.md (also cleans up CHK-028)
Test plan
uv run pytest tests/ -x -qpassesGLEAN_RETRY_INITIAL=0.5results in a non-zero interval