fix(app): a worker stop returns only after its last output is logged

Stopping (and restarting) the voice worker now waits, at most 5 s, for its output readers to log
what the exited worker wrote, so its last lines are masked with the secrets that run was started
with before the next start replaces them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 10:15:20 +09:00
parent 648e8304b0
commit fba258821b
3 changed files with 77 additions and 10 deletions

View File

@@ -86,7 +86,9 @@ The app starts `python -m voice_worker --host 127.0.0.1 --port <port> <args>` in
`JARVIS_VOICE_TOKEN`. The port is a free loopback port chosen once at start. If the worker exits, it is
started again on the same port with the same token after 1 s, doubling to at most 30 s while it keeps
failing (reset once a run printed `READY`). Stopping kills it; MeloTTS's child process ends when its
input closes.
input closes. A stop (and a restart) first logs everything the exited worker wrote, waiting at most
5 s (a child of the worker may hold its output open): a stop returns only after its last lines were
masked with the secrets that run was started with (`admin.spec.md`, "Logs").
## Worker link
@@ -225,7 +227,7 @@ registered until it is removed (M5 setup).
silent at both ends, below its peak), speaker limit, chat access and splitting, settings, frames; the worker
link against a fake server (hello, events, reconnect, failed TTS); the worker process with a
stand-in `voice_worker` package run by a real Python (token only in the environment, restart on the
same port, stop).
same port, stop, the last output logged before a stop returns).
- `JARVIS_VOICE_PYTHON=<venv python> cargo test --test worker_protocol` runs the worker link and
playback against the real Python worker server with fake engines (`tests/fixtures/fake_engine_worker.py`).
- `tests/live_discord.rs` (opt-in, `JARVIS_LIVE_DISCORD=1`, see the file header): two bots in one