fix(home-assistant): stop a voice satellite asking questions in a loop - #1796
Conversation
|
Claude finished @johnae's task —— View job Review
The diagnosis is well documented and the fix is minimal and in the right layer. The diff is well-formed (hunk counts in 1. The counter never resets on a genuine user answer (main concern)
for content in reversed(self.content):
if content.role != "assistant" or not content.content:
continueUser turns and tool-call turns are
That is exactly the path the prompt at 2. Small things in the same patch
3.
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfYTVcQVjCevVeoJofu8FF
2b6bc34 to
ad168de
Compare
|
Claude finished @johnae's task —— View job Review
The branch is unchanged from my earlier pass (still the single commit One substantive concern remains open. 1. The counter doesn't reset when the user's answer actually did something
for content in reversed(self.content):
if content.role != "assistant" or not content.content:
continue
The prompt's own music flow (
So the cap bites in the exact interaction the prompt encourages, not only in the loop. Worse, whether it bites is model-dependent: if gemma happens to emit some text alongside the tool call, that text won't end in Making the boundary explicit fixes both, and keeps the anti-loop property (background speech never produces a tool call): questions = 0
for content in reversed(self.content):
if content.role != "assistant":
continue
# A tool call means the previous answer led somewhere, so the
# questions before it were part of a real exchange, not a loop.
if getattr(content, "tool_calls", None):
break
if not content.content or not content.content.strip().endswith(question_marks):
break
questions += 1
if questions > 2:
return False
return TrueThe 2. Smaller things
3. Docs
Worth keeping in mind that raising sensitivity to "Moderately sensitive" increases false wakes, which is the loop's entry point; the cap bounds each episode, so the net is still an improvement, but the two changes pull in opposite directions. 4. VerificationNothing here is covered by anything CI builds — "checked against the patched module" isn't reproducible from the repo. Two things worth confirming locally before merge:
Performance / securityNo concerns. The scan is O(conversation length) once per reply (three iterations with the early return), and nothing here touches credentials or exposure — the lock stays hidden from Assist. I could not run · Branch: |
The bedroom Voice PE went silent: commands still ran, but it never answered.
At 06:42 background speech reached the model, which replied "Okej. Vad vill
du lyssna på?". Home Assistant keeps a conversation open after any reply
ending in "?", so the Voice PE listened again, heard more background speech,
and got another question back. That repeated every 5-10 seconds for about
twenty minutes. The Voice PE queued audio for every reply until its speaker
logged
Queue full, URI droppedand stopped accepting audio altogether. It isstill jammed and needs a power cycle.
questions in a row. That is enough for "Menade du X?", "Nej", "Vad vill du
lyssna på?", and it cuts a loop off at the third question. Checked
against the patched module: a single question, that three-step flow, and a
question after a statement stay open; a third question in a row does not.
"Okej." to anything unclear, to ask only when an answer is needed, and to
use "Vad vill du lyssna på?" only after a no to "Menade du". That alone
still let 2 of 4 background phrases get a question back, hence the patch.
"Moderately sensitive" (runtime; documented). The kitchen unit caught
"Okay Nabu" only 20-30% of the time.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XfYTVcQVjCevVeoJofu8FF