Skip to content

fix(corpus): make AuditReport.timestamp UTC-aware#244

Merged
himanshu231204 merged 1 commit into
OpenAgentHQ:mainfrom
syf2211:fix/audit-report-timezone-aware-59
Jul 25, 2026
Merged

fix(corpus): make AuditReport.timestamp UTC-aware#244
himanshu231204 merged 1 commit into
OpenAgentHQ:mainfrom
syf2211:fix/audit-report-timezone-aware-59

Conversation

@syf2211

@syf2211 syf2211 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the default AuditReport.timestamp timezone-aware UTC instead of a naive local datetime.now().

Motivation

StalenessDetector and other corpus audit code use UTC-aware datetimes (datetime.now(UTC)). AuditReport.timestamp defaulted to naive datetime.now(), which is inconsistent and can raise TypeError when compared with aware datetimes.

Fixes #59

Changes

  • openagent_eval/corpus/models.py: default timestamp factory now uses datetime.now(UTC)
  • tests/unit/test_corpus/test_models.py: regression test asserting default timestamp is UTC-aware

Tests

  • pytest tests/unit/test_corpus/test_models.py -q — 13 passed

Notes

Use datetime.now(UTC) for the default AuditReport timestamp so it stays
consistent with staleness checks and other corpus audit code that
operates on timezone-aware UTC datetimes.

Fixes OpenAgentHQ#59
@himanshu231204

Copy link
Copy Markdown
Member

/oc review pr

@opencode-agent

Copy link
Copy Markdown
Contributor

Review: APPROVE

The change is correct and minimal:

  • openagent_eval/corpus/models.py:71datetime.now()datetime.now(UTC). The UTC import was already present (line 5). The factory now produces timezone-aware datetimes consistent with StalenessDetector and the rest of the corpus audit code, preventing TypeError when comparing aware vs naive datetimes.

  • tests/unit/test_corpus/test_models.py:76-81 — Regression test asserts tzinfo is not None and tzinfo == UTC, covering the fix.

The test from the new test_default_timestamp_is_timezone_aware_utc passes (Python 3.12 confirms datetime.now(UTC).tzinfo == UTC). No lint or type issues. The PR references #59 correctly and follows the project conventions.

New%20session%20-%202026-07-25T13%3A11%3A19.581Z
opencode session  |  github run

@himanshu231204
himanshu231204 merged commit 5dded44 into OpenAgentHQ:main Jul 25, 2026
8 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congratulations @syf2211!

Your pull request has been successfully merged into main. 🚀

Thank you for contributing to OpenAgentHQ and helping improve the project.

We truly appreciate your contribution and hope to see you back with more amazing PRs!

Happy Open Sourcing! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants