Skip to content

fix: add timestamp field to message types - #1183

Open
SushantTusharJoshi wants to merge 1 commit into
anthropics:mainfrom
SushantTusharJoshi:fix/message-timestamp
Open

fix: add timestamp field to message types#1183
SushantTusharJoshi wants to merge 1 commit into
anthropics:mainfrom
SushantTusharJoshi:fix/message-timestamp

Conversation

@SushantTusharJoshi

Copy link
Copy Markdown

Summary

  • Adds optional timestamp field to UserMessage, AssistantMessage, and SystemMessage dataclasses
  • Updates message_parser.py to populate timestamps from JSONL data for all message types
  • Uses kw_only=True on SystemMessage.timestamp to avoid dataclass inheritance issues with subclasses

Test plan

  • 8 new tests covering timestamp presence/absence for user, assistant, system, and task messages
  • All 134 tests pass (126 existing + 8 new)
  • Ruff lint clean

Closes #258

Developed with Claude Code as a coding partner

The JSONL transcript file includes a `timestamp` field on each message,
but the SDK message types (UserMessage, AssistantMessage, SystemMessage)
were not exposing it. This adds an optional `timestamp: str | None` field
to all three base message types and wires it through the message parser.

Closes anthropics#258

Developed with Claude Code as a coding partner
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.

Message models are missing 'timestamp' field

1 participant