Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: contain malformed voice requests and redact model download failures
[._.]/ Adam Eivy325b5a04de4d
diff --git a/scripts/auk_voice_worker.py b/scripts/auk_voice_worker.pyindex 8f6a87d92b..46cfb12096 100644--- a/scripts/auk_voice_worker.py+++ b/scripts/auk_voice_worker.py@@ -14,9 +14,9 @@ def main():root = Path(sys.argv[1])engine = Nonefor line in sys.stdin:- request = json.loads(line)started = time.monotonic()try:+ request = json.loads(line)with contextlib.redirect_stdout(sys.stderr):import soundfile as sffrom auk_mlx.infer import AukMLX, GenerateOptionsdiff --git a/scripts/auk_voice_worker.test.js b/scripts/auk_voice_worker.test.jsnew file mode 100644index 0000000000..0942e5a5b4--- /dev/null+++ b/scripts/auk_voice_worker.test.js@@ -0,0 +1,52 @@+import { spawnSync } from 'node:child_process';+import { fileURLToPath } from 'node:url';+import { describe, expect, it } from 'vitest';+import { resolveTestPython } from '../server/lib/testHelper.js';++const python = resolveTestPython();+const script = fileURLToPath(new URL('./auk_voice_worker.py', import.meta.url));++// Run the resident protocol with synthetic audio dependencies, never a model or hardware.+const fixture = String.raw`+import importlib.util, os, sys, tempfile, types+from pathlib import Path+spec = importlib.util.spec_from_file_location("auk_worker", sys.argv[1])+worker = importlib.util.module_from_spec(spec)+spec.loader.exec_module(worker)+soundfile = types.ModuleType("soundfile")+soundfile.write = lambda *args: None+sys.modules["soundfile"] = soundfile+numpy = types.ModuleType("numpy")+numpy.concatenate = lambda chunks, axis: chunks+sys.modules["numpy"] = numpy+infer = types.ModuleType("auk_mlx.infer")+class Engine:+ def __init__(self, *args, **kwargs):+ pass+ def generate(self, *args, **kwargs):+ return [1], 24000+infer.AukMLX = Engine+infer.GenerateOptions = lambda **kwargs: kwargs+sys.modules["auk_mlx.infer"] = infer+with tempfile.TemporaryDirectory() as root:+ sys.argv = [sys.argv[1], root]+ os.chdir(root)+ worker.main()+`;++describe.skipIf(!python)('AuK resident request protocol', () => {+ it('responds to malformed JSON and still processes the next synthesis request', () => {+ const request = { output: 'fixture-output.wav', segments: [{ text: 'Invented words.', seconds: 1 }], instructions: 'Calm', seed: 42 };+ const result = spawnSync(python, ['-c', fixture, script], {+ encoding: 'utf8',+ input: `{malformed private-fixture-token\n${JSON.stringify(request)}\n`,+ });+ expect(result.status).toBe(0);+ expect(result.stderr).toBe('');+ const responses = result.stdout.trim().split('\n').map(line => JSON.parse(line));+ expect(responses).toHaveLength(2);+ expect(responses[0]).toEqual({ ok: false, error: 'JSONDecodeError' });+ expect(responses[1]).toEqual({ ok: true, latencyMs: expect.any(Number), firstAudioMs: expect.any(Number) });+ expect(result.stdout).not.toContain('private-fixture-token');+ });+});diff --git a/scripts/qwen3_tts_runner.py b/scripts/qwen3_tts_runner.pyindex cf1939661b..4cfcffa819 100755--- a/scripts/qwen3_tts_runner.py+++ b/scripts/qwen3_tts_runner.py@@ -820,7 +820,7 @@ def main() -> int:return 0except Exception as error:code = "QWEN3_DOWNLOAD_UNAVAILABLE" if isinstance(error, ImportError) else "QWEN3_DOWNLOAD_FAILED"- print(json.dumps({"ok": False, "code": code, "error": str(error)}), file=sys.stderr)+ print(json.dumps({"ok": False, "code": code, "error": "Qwen3 model download failed"}), file=sys.stderr)return 1if args.probe:diff --git a/scripts/qwen3_tts_runner.test.js b/scripts/qwen3_tts_runner.test.jsindex 271fd6a170..37350afcd0 100644--- a/scripts/qwen3_tts_runner.test.js+++ b/scripts/qwen3_tts_runner.test.js@@ -1,4 +1,4 @@-import { execFileSync } from 'node:child_process';+import { execFileSync, spawnSync } from 'node:child_process';import { fileURLToPath } from 'node:url';import { describe, expect, it } from 'vitest';import { resolveTestPython } from '../server/lib/testHelper.js';@@ -535,3 +535,24 @@ with tempfile.TemporaryDirectory() as temp:]);});});+++describe.skipIf(!python)('Qwen3 download process errors', () => {+ it.each([+ ['ImportError', 'QWEN3_DOWNLOAD_UNAVAILABLE'],+ ['RuntimeError', 'QWEN3_DOWNLOAD_FAILED'],+ ])('redacts %s diagnostics while preserving the download failure code', (exception, code) => {+ const result = spawnSync(python, ['-c', fixture + String.raw`+def fail_download(*args):+ raise ${exception}("private-fixture-token at /example/private/model")+runner.download_model = fail_download+sys.argv = [sys.argv[1], "--download", "--model-id", model_id, "--models-dir", "/example/models"]+raise SystemExit(runner.main())+`, script], { encoding: 'utf8' });+ expect(result.status).toBe(1);+ expect(result.stdout).toBe('');+ expect(JSON.parse(result.stderr)).toEqual({ ok: false, code, error: 'Qwen3 model download failed' });+ expect(result.stderr).not.toContain('private-fixture-token');+ expect(result.stderr).not.toContain('/example/private/model');+ });+});