You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(routing): isinstance(result, Exception) misses asyncio.CancelledError -- appends to docs list causing AttributeError #284
asyncio.CancelledError is a BaseException (not Exception) in Python 3.8+. With return_exceptions=True in asyncio.gather, a cancelled _fetch_doc coroutine returns a CancelledError as the result value. The check isinstance(result, Exception) at routing.py:113 returns False for CancelledError. It is also not None, so docs.append(result) runs, appending the exception object to the docs list. Then sum(d.total_pages for d in docs) raises AttributeError: 'CancelledError' object has no attribute 'total_pages'.
Root cause
Fix #251 changed to asyncio.gather(..., return_exceptions=True) but used isinstance(result, Exception) which does not cover BaseException subclasses.
Fix
backend/app/api/routing.py line 113: change check to isinstance(result, BaseException) to also catch CancelledError, KeyboardInterrupt, and SystemExit.
Impact
Any client disconnect or outer task cancellation during multi-doc routing crashes with AttributeError instead of propagating a clean CancellationError.
Activity
fix(sprint-r4): root-cause fixes for all 17 bugs from code review rou…
piyushmakhija28 commentedon Jun 21, 2026
Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)