fix(agent): guard float infinity to int conversions in stale timeout watchdogs - #65594
Closed
AntonIXO wants to merge 2 commits into
Closed
fix(agent): guard float infinity to int conversions in stale timeout watchdogs#65594AntonIXO wants to merge 2 commits into
AntonIXO wants to merge 2 commits into
Conversation
Collaborator
Related to #64924: both guard infinite timeout formatting in |
tonydwb
reviewed
Jul 16, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment
Scope
- 1 file (agent/chat_completion_helpers.py), +10/-3 lines
- Guards float-to-int conversions when deadline/timeout values are infinity.
Quality
- F-strings with conditional formatting: display "inf" instead of crashing on int(float('inf')).
- Consistent with the infinite-wait-deadline fix in PR 65606 (same file context).
Looks Good
- Small, correct fix for a real edge case.
Reviewed by Hermes Agent
9 tasks
AntonIXO
force-pushed
the
fix-moa-float-infinity-overflow
branch
from
July 16, 2026 15:51
583c503 to
bb92f2f
Compare
3 tasks
Contributor
|
Superseded by #66139, which has now merged the same MoA/local heartbeat fix with the full 100-poll regression shape from this PR, plus accurate finite-watchdog selection and fail-open notice construction. #66139 explicitly credits this PR for the full-heartbeat regression approach. Thank you for the production evidence and coverage. |
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
Prevent
OverflowError: cannot convert float infinity to integerwhen the non-streaming API watchdog formats an unbounded timeout.Root cause / reproduction
_compute_non_stream_stale_timeout()intentionally returnsfloat("inf")for local endpoints such asmoa://local. After 100 polling intervals (100 × 0.3s ≈ 30s), the wait-notice heartbeat formatted that value withint(_deadline), aborting an otherwise-live MoA request. The outer conversation loop then retried, producing failures at approximately 30s, 62s, and 97s.This PR now includes a deterministic regression test that drives the exact 100-poll MoA heartbeat without waiting 30 seconds. Before the fix it fails at
chat_completion_helpers.pywith the reportedOverflowError; after the fix it emitsauto-reconnect at neverand leaves the request alive.Fix
Guard infinite timeout formatting in the wait-notice path and the related TTFB, stream-idle, and stale-timeout diagnostic paths.
Relation to #64924
This overlaps with #64924 on the primary wait-notice cast. It is broader rather than independent: it also guards the related watchdog diagnostic/error formatting and adds direct MoA regression coverage for the observed 30-second failure.
Verification
tests/agent/test_infinite_stale_timeout_wait_notice.py: 1 passedtests/agent/test_reasoning_stale_timeout_floor.py: 57 passedtests/agent/test_codex_ttfb_watchdog.py: 13 passed