Skip to content

Standardize timestamps to UTC across ChatMessage and dispatch paths #386

@PureWeen

Description

@PureWeen

Context

PR #375 revealed a DateTime.UtcNow vs DateTime.Now mismatch in the orchestration dispatch path (N5 finding). The fix was to use DateTime.Now to match ChatMessage.Timestamp convention, but this is a band-aid — the codebase uses mixed conventions.

Current state

  • ChatMessage.Timestamp uses DateTime.Now (local time)
  • PendingOrchestration.StartedAt uses DateTime.UtcNow
  • Resume path has manual ToLocalTime() conversion
  • Dispatch path now uses DateTime.Now after the N5 fix

Proposed fix

  1. Standardize all persisted/logical timestamps to DateTimeOffset.UtcNow
  2. Convert to local time only in UI display layers
  3. Update ChatMessage.Timestamp, PendingOrchestration.StartedAt, and all comparison sites
  4. Ensure events.jsonl timestamps are parsed consistently

Risk

This is a data migration — existing persisted sessions have local timestamps in events.jsonl. Need a migration path or dual-parsing.

Priority

Low — current code works correctly after the N5 fix, but the mixed convention is a recurring source of bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions