chopratejas commited on
Commit
40bffbc
·
1 Parent(s): 3ff289e

fix: initialize parsed_response to prevent UnboundLocalError crashing all streaming responses

Browse files

parsed_response was only assigned inside the memory_enabled block but
referenced unconditionally by CCR feedback and prefix cache tracker in
the finally block, causing every non-memory streaming request to crash
with UnboundLocalError and abort the connection.

headroom/proxy/handlers/streaming.py CHANGED
@@ -523,6 +523,7 @@ class StreamingMixin:
523
  # For memory mode, we buffer the response to check for tool calls
524
  buffered_chunks: list[bytes] = []
525
  full_sse_data = ""
 
526
 
527
  try:
528
  async with contextlib.aclosing(upstream_response) as response:
 
523
  # For memory mode, we buffer the response to check for tool calls
524
  buffered_chunks: list[bytes] = []
525
  full_sse_data = ""
526
+ parsed_response = None # Set by memory block; used by CCR + prefix tracker
527
 
528
  try:
529
  async with contextlib.aclosing(upstream_response) as response: