fix(steering): skip phantom zero-turn result on --resume; guard empty replies
On --resume, a background task stopped by the previous restart is replayed as its own zero-turn turn with an empty result, before the real turn. consume_stream took it as the answer -> empty Discord message (400) -> "Sorry, something went wrong", while the real turn ran orphaned. - stream_json: skip result with num_turns=0, empty, non-error - router: empty Claude response becomes a visible notice, not an adapter crash Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014y1sJNe6mkWwFMwkWmCg8J
This commit is contained in:
@@ -616,6 +616,11 @@ def route_message(
|
||||
# Same pattern as the existing __AUDIO__: sentinel — no
|
||||
# _set_last_response, the adapter reacts instead of replying.
|
||||
return response, False
|
||||
if not (response or "").strip():
|
||||
# Adapters can't send an empty message (Discord 400 → generic
|
||||
# "something went wrong"); say so instead of failing opaquely.
|
||||
log.warning("channel=%s: Claude returned an empty response", channel_id)
|
||||
return "⚠️ Claude a terminat turul fără niciun răspuns text. Mai trimite o dată mesajul.", False
|
||||
_set_last_response(channel_id, response)
|
||||
return response, False
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user