The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): keep _final_for_stream anchor pinned by test_stream_final_adoption_gate
Teknium13949a95e453
diff --git a/gateway/run_turn_runner.py b/gateway/run_turn_runner.pyindex 7ece196e806..0081d693a8e 100644--- a/gateway/run_turn_runner.py+++ b/gateway/run_turn_runner.py@@ -1623,7 +1623,7 @@ class TurnRunner:# completed final: interrupt paths return {interrupted: True, completed: False} with a# DIAGNOSTIC final_response — adopting it would seal the partial answer over with the# diagnostic AND suppress the gateway's own error delivery.- final = None+ _final_for_stream = Noneif (isinstance(result, dict)and not result.get("failed")@@ -1632,13 +1632,13 @@ class TurnRunner:):fr = result.get("final_response")if isinstance(fr, str) and fr.strip() and fr != "(empty)":- final = fr- if final is None:+ _final_for_stream = fr+ if _final_for_stream is None:stream_consumer.finish()return# Duck-type safe: test doubles / older consumers may expose a zero-arg finish().try:- stream_consumer.finish(final)+ stream_consumer.finish(_final_for_stream)except TypeError:stream_consumer.finish()