debug(brain): Proxy-Response loggen — finish_reason + raw-msg + tool_calls-Anzahl

Diagnose-Log um Trigger-Hang zu klaeren: warum legt ARIA keinen Timer
an, obwohl trigger_timer als Tool definiert ist? Wir loggen jetzt nach
jedem Proxy-Call:
  - finish_reason
  - alle Keys aus der message
  - tool_calls-Anzahl + content-Laenge
  - die rohe message (truncated 1500 chars)

So sehen wir ob der Proxy tool_calls leer liefert (Proxy schluckt
tools-Feld?), ob Claude ignoriert (Anthropic-Native-Format statt
OpenAI?), oder ob unser Dispatch falsch parsed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 01:34:12 +02:00
parent b1796520b8
commit 0d13118f7e
+14
View File
@@ -111,6 +111,20 @@ class ProxyClient:
msg = choices[0].get("message") or {} msg = choices[0].get("message") or {}
finish_reason = choices[0].get("finish_reason", "") finish_reason = choices[0].get("finish_reason", "")
# Diagnose: was hat der Proxy zurueckgegeben?
# Wir loggen die rohe message + finish_reason damit wir sehen ob
# tool_calls da sind, leer oder schlicht weggeschnitten werden.
logger.info("Proxy ← finish=%s keys=%s tool_calls=%d content_len=%d",
finish_reason,
sorted(msg.keys()),
len(msg.get("tool_calls") or []),
len(msg.get("content") or "") if isinstance(msg.get("content"), str)
else sum(len(p.get("text", "")) for p in (msg.get("content") or []) if isinstance(p, dict)))
try:
logger.info("Proxy ← raw-msg=%s", json.dumps(msg)[:1500])
except Exception:
logger.info("Proxy ← raw-msg(non-serial)=%s", str(msg)[:1500])
content = msg.get("content") or "" content = msg.get("content") or ""
if isinstance(content, list): if isinstance(content, list):
content = "".join( content = "".join(