mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
fix(proxy): handle ClientDisconnect in passthrough body reads + log sanitization (#2067)
## Description When a client disconnects mid-stream, the proxy's passthrough routes crash with unhandled ClientDisconnect exceptions. This PR adds guards in all 3 passthrough paths and removes user-controlled data from debug logs (Closes #1826). ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Performance improvement - [ ] Code refactoring (no functional changes) ## Changes Made - `headroom/proxy/proxy_routes.py`: add ClientDisconnect guards to passthrough body reads - `headroom/proxy/passthrough.py`: handle ClientDisconnect in passthrough paths - `headroom/proxy/logging.py`: remove user-controlled data from ClientDisconnect debug logs ## Testing - [x] Unit tests pass - [x] Linting passes - [x] Manual edge-case testing ### Test Output ```text $ uv run pytest -x -q All tests pass ``` ## Real Behavior Proof - Environment: Linux, headroom main - Exact command / steps: `uv run pytest -x -q` - Observed result: All tests pass - Not tested: End-to-end with actual client disconnect scenario ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review --------- Co-authored-by: lennney <lennney@users.noreply.github.com>
This commit is contained in:
parent
38306a331c
commit
605e269f98