Update thread_ts and parent_ts fields to represent checkpoint IDs (uuids) instead of timestamps
Summary
Following the LangGraph 0.1 to 0.2 migration, thread_ts and parent_ts fields no longer represent timestamps but rather checkpoint IDs (workflow UUIDs). This issue tracks the necessary changes to align our codebase with this new semantic meaning.
See #470469 (comment 2546292256) See blog
Background
In LangGraph 0.1, these fields were actual timestamps. However, as documented in the LangGraph migration guide, they were changed to represent checkpoint_id and parent_checkpoint_id respectively. Since we already store checkpoint and workflow UUIDs separately, we need to update our implementation to reflect this change.
Proposed Changes
1. GraphQL Type Updates
File: ee/app/graphql/types/ai/duo_workflows/workflow_event_type.rb
Change the field types from TimeType to String:
-
timestampfield:Types::TimeType→GraphQL::Types::String -
parent_timestampfield:Types::TimeType→GraphQL::Types::String
2. Model Scope Update
Not needed because thread_ts/parent_ts are using uuid_v7 which is time ordered
This not needed - it turns out thread_ts is
File: ee/app/models/ai/duo_workflows/checkpoint.rb
Update the ordering scope to use created_at instead of thread_ts:
-
ordered_with_writesscope:order(thread_ts: :desc)→order(created_at: :desc)
3. Presenter Updates
File: ee/app/presenters/ai/duo_workflows/workflow_checkpoint_event_presenter.rb
Remove time parsing and return the IDs directly:
-
timestampmethod: RemoveTime.parse()wrapper, returnevent.thread_tsdirectly -
parent_timestampmethod: RemoveTime.parse()wrapper, returnevent.parent_tsdirectly
4. Rake Task Updates
File: ee/lib/tasks/gitlab/duo_workflow/duo_workflow.rake
Update test data generation to use UUIDs instead of timestamps:
- In
create_checkpoint_datamethod:- Change
thread_tsfromTime.current.iso8601(6)toSecureRandom.uuid - Change
parent_tsfrom time-based calculation toSecureRandom.uuid(when step > 0)
- Change
Implementation Notes
- These fields will now contain UUID strings instead of timestamp strings
- The change is semantic only - the database column types remain the same (likely string/text)
- Ensure any frontend code consuming these fields is updated accordingly
Testing Checklist
- Update factories and unit tests for the presenter methods
- Update GraphQL query tests to expect string types
- Verify rake task generates valid UUID data
- Test checkpoint ordering still works correctly with
created_at - Ensure no regressions in workflow event display