Repository navigation
fix(config): accept the documented 0 sentinel for per-attempt timeout override - #3377
Lesereingrape wants to merge 2 commits into
Conversation
… override DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE is declared confloat(gt=0), so setting it to 0 - which the block comment above it documents as the auto-derive sentinel - raises an uncaught ValidationError from get_settings() and takes down the CLI, deepeval.initialize() and any evaluate() call. Both consumers of the value already branch on <= 0, and the sibling outer override accepts ge=0.
|
@Lesereingrape is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
chrikrah
left a comment
There was a problem hiding this comment.
@Lesereingrape I would merge this. It brings the per-attempt override in line with DEEPEVAL_PER_TASK_TIMEOUT_SECONDS_OVERRIDE and DEEPEVAL_TASK_GATHER_BUFFER_SECONDS_OVERRIDE, which already take confloat(ge=0), and with the comment at deepeval/config/settings.py:1019. Reverting settings.py with your tests kept fails test_per_attempt_timeout_override_zero_auto_derives.
non-blocking: the timeout error at deepeval/models/retry_policy.py:509 tells users "None disables", and after this change neither None nor 0 does. DEEPEVAL_DISABLE_TIMEOUTS is the switch that turns the inner timeout off, per the first three runs below.
Evidence at head 3ea637d, base 385117c, Python 3.12, editable install:
$ P='from deepeval.models.retry_policy import resolve_effective_attempt_timeout as r; print(r())'
$ python -c "$P"
88.5
$ DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE=0 python -c "$P"
88.5
$ DEEPEVAL_DISABLE_TIMEOUTS=1 python -c "$P"
0
$ python -m pytest tests/test_core/test_config/test_settings.py -q
55 passed in 2.65s
$ git checkout 385117c -- deepeval/config/settings.py
$ python -m pytest tests/test_core/test_config/test_settings.py -q
FAILED tests/test_core/test_config/test_settings.py::test_per_attempt_timeout_override_zero_auto_derives
1 failed, 54 passed in 2.80s
@penguine-ip, should the message at :509 name DEEPEVAL_DISABLE_TIMEOUTS in this pull request, or separately?
The per-attempt timeout hint told users "(None disables)", but neither an unset nor a 0 DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE disables the inner timeout -- both derive it from the per-task budget. DEEPEVAL_DISABLE_TIMEOUTS is the opt-out, so the message now points there, with a regression test.
|
@chrikrah Thanks — I reproduced your matrix on this branch (Python 3.12, editable install): I folded the wording fix in rather than splitting it (
and added Local results: @penguine-ip Say the word if you would rather keep this PR to the validator alone — the message change and its test are one commit, so moving them out is a rebase away. |
|
Two
Same two test IDs and the same two messages on the |
chrikrah
left a comment
There was a problem hiding this comment.
@Lesereingrape I would merge ce8b918 with the message change kept in. Each production file fails only its own new test when reverted, so splitting it out later stays cheap.
# ce8b918 export, base 385117c, Python 3.12.3, pytest 9.1.1, DEEPEVAL_TELEMETRY_OPT_OUT=1
$ python -m pytest tests/test_core/test_config/test_settings.py tests/test_core/test_retry_policy.py -q
93 passed, 1 skipped in 12.51s # ce8b918
90 passed, 1 skipped in 13.61s # 385117c
# retry_policy.py from 385117c, tests kept
FAILED tests/test_core/test_retry_policy.py::test_timeout_error_names_the_switch_that_disables_timeouts
# settings.py from 385117c, tests kept
FAILED tests/test_core/test_config/test_settings.py::test_per_attempt_timeout_override_zero_auto_derives
@penguine-ip, ce8b918 puts the :509 fix you were asked about into this pull request. @kritinv, would you take a look if he is busy?
Description
DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDEis declared asOptional[confloat(gt=0)], but the comment directly above it documents0as the "derive it for me" value:So the documented sentinel is rejected before a
Settingsobject is ever built, andget_settings()raises an uncaughtValidationError:Anything that loads settings then fails —
deepeval --help,deepeval.initialize(), and anyevaluate()run. This is easy to hit from CI or a compose file that declares the variable with a neutral default of0.Two things indicate
0is meant to be accepted:DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDSchecksfloat(over) > 0,_calc_auto_outer_timeoutcheckstimeout_seconds <= 0), so today those0paths are unreachable through the override;confloat(ge=0).This only widens the constraint to let the documented sentinel through; negative timeouts are still rejected.
How Has This Been Tested?
tests/test_core/test_config/test_settings.py: addedtest_per_attempt_timeout_override_zero_auto_derives, which fails onmainwith theValidationErrorabove, and now passes with=0producing exactly the same derived budget as leaving the variable unset; addedtest_per_attempt_timeout_override_negative_still_rejectedas a guard for the loosened constraint.pytest tests/test_core/test_config/test_settings.py→ 54 passed, 1 failed. The failure istest_env_dir_path_expanduser, which fails identically on a clean checkout ofmainin this Windows environment (52 passed, 1 failed before the change).pytest tests/test_core/test_retry_policy.py→ 37 passed, 1 skipped.DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE=0 python -m deepeval.cli.main --helpnow prints usage instead of crashing;=5still takes precedence (per-attempt 5.0s, outer budget 13.0s);=-1still raises.black --checkandruff checkclean on both changed files.