File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/openlayer/lib/tracing Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -729,7 +729,14 @@ def _finalize_sync_generator_step(
729729 inference_pipeline_id : Optional [str ] = None ,
730730) -> None :
731731 """Finalize sync generator step - called when generator is consumed."""
732- _current_step .reset (token )
732+ try :
733+ _current_step .reset (token )
734+ except ValueError :
735+ # Context variable was created in a different context (e.g., different thread)
736+ # This can happen in async/multi-threaded environments like FastAPI/OpenWebUI
737+ # We can safely ignore this as the step finalization will still complete
738+ logger .debug ("Context variable reset failed - generator consumed in different context" )
739+
733740 _finalize_step_logging (step = step , inputs = inputs , output = output , start_time = step .start_time )
734741 _handle_trace_completion (
735742 is_root_step = is_root_step ,
You can’t perform that action at this time.
0 commit comments