langchain-ai / langchain-ai/langgraph
bug: except BaseException should be except Exception in cleanup paths
- Dominant language
- Python
- Stars
- 41.8k
- Forks
- 7.1k
- Avg merge
- 23h 7m
- Merged PRs (30d)
- 30
Description
## Description
Three `except BaseException: pass` blocks in cleanup/error-handling paths catch too broadly -- `BaseException` includes `KeyboardInterrupt` and `SystemExit`, which should propagate rather than being silently swallowed.
Affected locations:
- `libs/langgraph/langgraph/stream/_mux.py:341` -- `transformer.fail(err)` in sync path
- `libs/langgraph/langgraph/stream/_mux.py:444` -- `transformer.afail(err)` in async path
- `libs/langgraph/langgraph/pregel/_executor.py:86` -- `task.result()` in `_dequeue_done_tasks`
## Fix
Replace `except BaseException` with `except Exception` at all three locations. This still catches all normal exceptions but allows system-level signals to propagate.
Contributor guide
Research direction
Start at the three listed locations in libs/langgraph/langgraph/stream/_mux.py and libs/langgraph/langgraph/pregel/_executor.py. Inspect the surrounding cleanup and error-handling paths, then verify that normal exceptions remain handled while KeyboardInterrupt and SystemExit are no longer swallowed. Done means all three overly broad handlers are corrected consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100