wenjin272 commented on issue #983:
URL: https://github.com/apache/flink-agents/issues/983#issuecomment-5261576995

   I agree with keeping #984 as a detection mechanism for now, collecting 
evidence there, and tracking the actual race and its fix in a separate issue.
   
   For the fix, my current preference would be to bind a `MemorySet` to the 
current partition key when the memory set is created, and require 
`get_memory_set` to be called only from the mailbox thread. Operations such as 
`add`, `get`, `search`, and `delete` could then use the key already captured by 
the `MemorySet`, instead of reading mutable context from the shared 
`Mem0LongTermMemory` on a worker thread.
   
   We may want to capture the observation ID and suppression flag at the same 
point as well, so the entire per-action context is immutable before the 
operation is submitted. This would also address the observation-field race you 
mentioned.
   
   Capturing the context at `durable_execute_async` submission time should work 
too, but it seems more complicated because that API is generic and would need 
some way to recognize or propagate the context required by LTM operations. 
Binding the context when constructing the `MemorySet` keeps the isolation 
within the memory API and naturally applies to all of its operations.
   
   The main constraint is that a `MemorySet` should be obtained for the current 
action on the mailbox thread rather than cached and reused across actions. WDYT?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to