Description
In metric.py, the MetricTimeoutError constructor uses a truthiness check (if timeout_seconds:) to decide whether to include the timeout value in the error details dict:
# line 119
if timeout_seconds:
error_details["timeout_seconds"] = timeout_seconds
This silently drops timeout_seconds=0.0 because 0.0 is falsy in Python. A timeout of 0.0 seconds (meaning "immediate timeout") is a perfectly valid configuration — it would tell the caller that the metric was expected to finish instantly or be considered timed out.
Impact
When MetricTimeoutError is raised with timeout_seconds=0.0:
self.details will NOT contain "timeout_seconds": 0.0
str(exc) will NOT show the timeout value (since __str__ in the base class renders self.details)
self.timeout_seconds WILL be 0.0 (line 123 stores it regardless), creating a discrepancy between self.details and self.timeout_seconds
Severity
Medium — The bug causes silent loss of diagnostic information for a valid edge case (0-second timeout). The attribute exists on the object but is invisible in string representations and logs.
Affected Code
openagent_eval/exceptions/metric.py lines 118-120
Suggested Fix
Use an explicit is not None check instead of truthiness:
if timeout_seconds is not None:
error_details["timeout_seconds"] = timeout_seconds
(This same pattern of if x: instead of if x is not None: also affects dataset.py:84 (line_number=0) and cli.py:90-93 (field="", value=""), though those edge cases are less likely in practice.)
Description
In
metric.py, theMetricTimeoutErrorconstructor uses a truthiness check (if timeout_seconds:) to decide whether to include the timeout value in the error details dict:This silently drops
timeout_seconds=0.0because0.0is falsy in Python. A timeout of0.0seconds (meaning "immediate timeout") is a perfectly valid configuration — it would tell the caller that the metric was expected to finish instantly or be considered timed out.Impact
When
MetricTimeoutErroris raised withtimeout_seconds=0.0:self.detailswill NOT contain"timeout_seconds": 0.0str(exc)will NOT show the timeout value (since__str__in the base class rendersself.details)self.timeout_secondsWILL be0.0(line 123 stores it regardless), creating a discrepancy betweenself.detailsandself.timeout_secondsSeverity
Medium — The bug causes silent loss of diagnostic information for a valid edge case (0-second timeout). The attribute exists on the object but is invisible in string representations and logs.
Affected Code
openagent_eval/exceptions/metric.pylines 118-120Suggested Fix
Use an explicit
is not Nonecheck instead of truthiness:(This same pattern of
if x:instead ofif x is not None:also affectsdataset.py:84(line_number=0) andcli.py:90-93(field="",value=""), though those edge cases are less likely in practice.)