Skip to content

corpus(models): AuditReport.timestamp is timezone-naive (inconsistent) #59

Description

@himanshu231204

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions