fix: isolate assistant projection identities per thread#882
fix: isolate assistant projection identities per thread#882binbandit wants to merge 3 commits 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)
📝 Coding Plan
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? |
| thread: AssistantMessageIdentityThread, | ||
| event: ProviderRuntimeEvent, | ||
| ): MessageId { | ||
| const turnId = toTurnId(event.turnId); |
There was a problem hiding this comment.
when is event.turnId a string here that needs coercing?
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 projection identities per thread using composite (thread_id, message_id) keys
ProviderRuntimeIngestionandCheckpointReactorto resolve assistant message IDs via these helpers instead of constructing them inline.ProjectionThreadMessagesupsert logic to key rows by(thread_id, message_id)instead ofmessage_idalone, allowing the same message ID to exist independently across threads.projection_thread_messagestable with a composite primary key and migrate existing data.projection_thread_messages; existing rows are preserved but the schema change is irreversible without manual intervention.Macroscope summarized 8aa0b74.