Skip to content

fix(deploy): restart the TTS worker explicitly, not via notify handler (#12886) - #13144

Merged
mrveiss merged 3 commits into
Dev_new_guifrom
issue-12886-restart
Jul 31, 2026
Merged

mrveiss merged 3 commits into
Dev_new_guifrom
issue-12886-restart

Conversation

@mrveiss

@mrveiss mrveiss commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Thinking Path

Supersedes the approach in #13143, which did not work. Verified on the host rather than from the recap.

State after #13143 merged and an update ran: the file is correct on disk, the route is still 404.

/opt/autobot/autobot-tts-worker/tts-worker.py   grep -c 'synthesize/stream' -> 2
autobot-tts-worker  ExecMainStartTimestamp = Mon 2026-07-27 17:51:27

Four days old. The worker had the new file and was serving old code from memory.

Handler-driven restart fails here for two compounding reasons:

  1. Handlers flush at end of play. PLAY 2 dies at the browser tasks (deploy: PLAY 2 fails at 'Browser | Wait for service to be ready' — autobot-browser-worker has no unit file and :3000 is held by Grafana on loopback; last blocker after #12883 #12912), so the queued restart tts-worker was discarded — that was the fix(deploy): flush the TTS restart immediately so a later failure cannot swallow it (#12886) #13143 diagnosis, and meta: flush_handlers was the right fix for that.
  2. flush_handlers still did nothing, because by then the file was already current from the prior run. The template task reported ok, so it never notified, so nothing was queued to flush. A host that received the file but missed the restart is stuck permanently — there is no longer any change to trigger it.

(2) is the part I got wrong in #13143: I fixed when handlers run without asking whether a handler would fire at all.

So restart explicitly, matching the convention every other component in this play already follows — NPU, Browser and backend all use systemd: state=restarted with become: true and failed_when: false. Unconditional, so it cannot be swallowed by a later failure and does not depend on a changed-file signal.

What Changed

playbooks/update-all-nodes.yml — the meta: flush_handlers task from #13143 is replaced by an explicit [PLAY 2] TTS | Restart service task, mirroring the NPU restart exactly, with a comment recording both failure modes.

tests/test_updater_refreshes_tts_worker_12886.py — the flush assertion is replaced by one requiring an explicit autobot-tts-worker restart task ordered after the include.

Verification

tests/test_updater_refreshes_tts_worker_12886.py .......
7 passed

ansible-playbook --syntax-check -i localhost, playbooks/update-all-nodes.yml
playbook: playbooks/update-all-nodes.yml

Still unproven on the host, which is the only acceptance that counts: /tts/synthesize/stream served, ExecMainStartTimestamp recent, and the #12959 probe's tts-worker (#12886) entry clearing. I will run the update after merge and report the outcome either way — this is the third attempt at this delivery, and I would rather report another miss than claim success from a green recap.

Model Used

Claude Opus 5 (claude-opus-5)

Follow-up

Closes #12886 once the route is confirmed served.

Refs #12912 (browser blocker — its failure is what exposed the handler problem), #12959, #13132.

#12886)

The file reached the host and the route was still 404, because the service was
never restarted — running since Jul 27, serving stale code from memory.

Handler-driven restart fails here twice over, both observed live:

  1. handlers flush at END of play, and PLAY 2 dies at the browser tasks
     (#12912), so the queued 'restart tts-worker' was discarded;
  2. #13143's flush_handlers did not help, because by then the file was already
     current — the template reported ok, never notified, and there was nothing
     queued to flush. A host with the file but no restart stays stale forever.

Restart explicitly instead, matching how every other component in this play is
handled (NPU, Browser, backend all use systemd state=restarted with become and
failed_when: false). Unconditional, so it cannot be swallowed and does not
depend on a changed-file signal.

Tests: the flush assertion is replaced by one requiring an explicit restart task
after the include; 7 pass; playbook passes ansible --syntax-check.
@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

github-actions Bot and others added 2 commits July 31, 2026 18:13
Security review flagged fail-open state drift: the restart carried
failed_when: false, copied from the NPU/Browser convention above it.

That is wrong for this task specifically. The entire issue is a worker serving
stale code while the update reported success. Swallowing a restart failure
recreates it exactly — file lands, process never reloads, play goes green,
nothing says otherwise.

The neighbouring restarts swallow errors so one optional worker cannot fail the
whole update. That trade-off does not apply to the task whose only purpose is
proving the worker reloaded.

Tests: 1 new asserting the restart does not fail open; 8 pass; syntax-check
clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant