fix: preserve full_entities metadata when adding multimodal entities#228
Merged
LarFii merged 2 commits intoMar 24, 2026
Merged
Conversation
…ixes HKUDS#135) The close() method is registered with atexit.register() and runs during Python interpreter shutdown. The previous implementation had two issues: 1. get_running_loop() can succeed on a loop that is not running (just attached to the thread), causing create_task() to fail 2. asyncio.run() raises RuntimeError if an event loop is already set for the thread, even if that loop is closed The fix checks loop.is_running() explicitly, and when there is no running loop, properly cleans up any stale loop reference before calling asyncio.run(). This eliminates the noisy warning: 'There is no current event loop in thread MainThread' Added standalone tests in tests/test_close_event_loop.py that verify the fix works across all event loop states (no loop, closed loop, running loop, finalize exception).
Collaborator
|
Thanks for your contribution! |
2 tasks
3 tasks
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.
Summary
This fixes a data-loss bug in Stage 3.5 multimodal entity storage.
When
_store_multimodal_entities_to_full_entities()updates an existingfull_entitiesentry, it previously rebuilt the record using only:entity_namescountupdate_timeAs a result, any existing metadata fields already stored for the same
doc_idcould be silently overwritten.
Changes
full_entitiesmetadata via merge instead of rebuilding from scratchWhy this matters
Stage 3.5 should enrich existing document entity records with multimodal main
entities, not replace previously stored metadata from the text pipeline.
Testing