SIGN IN SIGN UP

fix(observe): Handle asyncio.CancelledError in exception blocks (#1566)

Fixes langfuse/langfuse#12650

This catches and records the async task being cancelled—either directly or
because it timed out—which will raise an asyncio.CancelledError to stop
execution.

Also fix sync wrappers as well. Note that asyncio.CancelledError can cross
async-sync boundaries, such as `run_coroutine_threadsafe().result()` or a sync
helper function that re-raises cancellation that was previously
suppressed/deferred.

Co-authored-by: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com>
J
Jinoh Kang committed
1806084e521773ede6bde2ca1732f66f38c2bdf1
Parent: 51e0b7f
Committed by GitHub <noreply@github.com> on 3/19/2026, 5:32:56 PM