Description
The AuditReport model in models.py uses datetime.now() (timezone-naive) as the default factory for the timestamp field:
timestamp: datetime = Field(default_factory=datetime.now)
Meanwhile, the StalenessDetector in staleness.py consistently uses datetime.now(timezone.utc) (timezone-aware) for all its comparisons and metadata. This creates an inconsistency:
- If any code compares
report.timestamp with timezone-aware datetimes, it will get a TypeError.
- The timestamp doesn't carry timezone information, making it ambiguous (is it UTC? local time?).
- This is inconsistent with the rest of the corpus module conventions.
Severity
Medium — Not a crash in normal usage (the timestamp field isn't compared in the current tests), but an inconsistency that creates a latent bug for any future code that compares report timestamps with staleness timestamps.
Affected Code
openagent_eval/corpus/models.py line 71: datetime.now without timezone
Suggested Fix
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
Description
The
AuditReportmodel inmodels.pyusesdatetime.now()(timezone-naive) as the default factory for thetimestampfield:Meanwhile, the
StalenessDetectorinstaleness.pyconsistently usesdatetime.now(timezone.utc)(timezone-aware) for all its comparisons and metadata. This creates an inconsistency:report.timestampwith timezone-aware datetimes, it will get aTypeError.Severity
Medium — Not a crash in normal usage (the
timestampfield isn't compared in the current tests), but an inconsistency that creates a latent bug for any future code that compares report timestamps with staleness timestamps.Affected Code
openagent_eval/corpus/models.pyline 71:datetime.nowwithout timezoneSuggested Fix