fix: use event timestamps for user messages in SessionFromEvents#2158
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 18, 2026
Merged
fix: use event timestamps for user messages in SessionFromEvents#2158dgageot merged 1 commit intodocker:mainfrom
dgageot merged 1 commit intodocker:mainfrom
Conversation
SessionFromEvents was creating user messages with time.Now(), which runs after the container has finished. This gave user messages a timestamp after the last assistant message, causing Session.Duration() to return ~0 and breaking the longest-first eval sorting. Now user messages use the timestamp from the "user_message" event in the container output stream. Falls back to the first "agent_choice" timestamp when no "user_message" event is present. Assisted-By: docker-agent
gtardif
approved these changes
Mar 18, 2026
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
No issues found in the changed code. The timestamp fix correctly addresses the Duration() calculation problem by using event timestamps instead of time.Now().
Review Summary:
- ✅ User message timestamps now use event stream timestamps
- ✅ Fallback to agent_choice timestamp when user_message event is absent
- ✅ Multi-turn evaluation logic correctly increments questionIdx
- ✅ parseEventTimestamp fallback to time.Now() is intentional error handling
The implementation properly fixes the bug where user messages had timestamps after assistant messages, which was breaking longest-first eval sorting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SessionFromEvents was creating user messages with time.Now(), which runs after the container has finished. This gave user messages a timestamp after the last assistant message, causing Session.Duration() to return ~0 and breaking the longest-first eval sorting.
Now user messages use the timestamp from the "user_message" event in the container output stream. Falls back to the first "agent_choice" timestamp when no "user_message" event is present.
Assisted-By: docker-agent