fix: isolate assistant projection identities per thread#882
fix: isolate assistant projection identities per thread#882binbandit wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@juliusmarminge if we can, can we please prioritise this one? |
Summary
(thread_id, message_id)so reused assistant IDs no longer overwrite another thread's projection rowWhy
message_idalone, and runtime-generated assistant IDs were not consistently thread-scopedChanges
014_ProjectionThreadMessagesThreadScopedKeyto rebuildprojection_thread_messageswith a composite primary key on(thread_id, message_id)ProjectionThreadMessagesupserts and attachment carry-forward logic to scope conflicts and lookups by threadassistantMessageIdentityhelpers and use them inProviderRuntimeIngestionandCheckpointReactorto mint thread-scoped IDs for new data while reusing legacy IDs when they already exist in projectionsValidation
bun fmtbun lintbun typecheckbun run test src/orchestration/assistantMessageIdentity.test.ts src/persistence/Layers/ProjectionThreadMessages.test.ts src/orchestration/Layers/ProviderRuntimeIngestion.test.ts src/wsServer.test.tsNote
Isolate assistant message IDs per thread in projection and runtime ingestion
threadId(e.g.assistant:{threadId}:item:{itemId}) instead of being derived globally from item/turn/event IDs, preventing cross-thread collisions.resolveRuntimeAssistantMessageIdandresolveCheckpointAssistantMessageIdhandle ID resolution, reusing legacy persisted IDs when a thread resumes from an existing checkpoint.ProjectionThreadMessagesupserts are now keyed on(thread_id, message_id)instead ofmessage_idalone, scoping attachment preservation to the correct thread.projection_thread_messagestable with a composite primary key(thread_id, message_id).thread.message-sentand related events will change for new messages; existing persisted IDs are detected and reused to preserve continuity for resumed threads.Macroscope summarized f17c579.