Repository navigation
field-voiced: the Chatterbox worker, and a shared worker client - #60
Merged
Merged
Conversation
Voice as the second client, which is what #59's extraction was for. The package is a job dataclass and an adapter; the flock, framing, gate and idle-exit are field_worker's. The adapter is wired against chatterbox-tts 0.1.7 read from the published wheel rather than from its README, and three things that reading settled are recorded in its docstring. `from_pretrained` handles the MPS-unavailable fallback itself, so we pass a preference rather than probing. `conds.pt` ships as a builtin voice, which is what makes audio_prompt_path=None a real default voice rather than an error path — the configuration bloom is about to use. And model.sr is 24000, so a voice variant is not at any project rate and creek will wrap it in a normalize sound, which is the rule chunk 5 just rebuilt around our own resampler. Verified rather than assumed: pyright strict passes, and the daemon imports and parses a job on a bare interpreter with no torch present, which is the lazy-import constraint the aced harness set. CI gates this package too — a package declaring strict typing with nothing running it is exactly what the #59 review found, and adding a third one silently would repeat it. No TS client yet, deliberately. src/aced/client.ts records that its duplication with audiod/client.ts is "tolerated until a third daemon argues for a shared base", and field-voiced is that third daemon. The trigger the codebase wrote down has fired, so the client is an extraction rather than a copy, and that is its own change.
src/aced/client.ts said its duplication with audiod/client.ts was "tolerated until a third daemon argues for a shared base". field-voiced is that third daemon, so this is the trigger the codebase wrote down firing, not a preference. What was aced-specific turned out to be seven strings and a job type. The generate *response* is shared too, because GenerationOutput became shared in #59: paths, the seeds that made them, and the model is what a recipe records whichever model it was. AcedClient and VoicedClient are each a WorkerSpec and a typed generate. audiod's client stays put, and that is a judgement rather than an oversight: it spawns a C++ binary rather than a uv project and its vocabulary is transport, not generation. Framing is all it shares, and sharing framing alone would tangle both sides more than either is now. The live aced tests caught a real bug in the first draft. connectTo built a base WorkerClient and I cast it to the subclass, which typechecks and then dies with "generate is not a function"; the constructor is threaded through now. That is the second time on this branch that the existing harness has paid for itself. field-voiced gets the same harness — spawn, handshake, unknown op, and job validation, all against the real daemon with no torch installed. It is also what would notice if a future edit imported chatterbox at module scope, which would silently cost the coverage.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ff1b2c1. Configure here.
ninjudd
commented
Aug 8, 2026
ninjudd
commented
Aug 8, 2026
ninjudd
commented
Aug 8, 2026
ninjudd
commented
Aug 8, 2026
#60 review, five findings, all confirmed. P1 is the one that would have shipped a lie. Chatterbox's generate stores the conditionals it derives: with a reference, prepare_conditionals assigns self.conds; without one it only asserts self.conds is not None and reuses whatever is there. The daemon holds the model for its lifetime — which is the entire point of the daemon-lite design — so one referenced job silently becomes the voice of every later unreferenced job in the session. The recipe would say default voice and the committed audio would be someone else's. Verified against the 0.1.7 wheel at tts.py:206 and 222. The pristine builtin conditionals are now kept aside at load and restored before every unreferenced variant, deep-copied both times because generate mutates conds.t3 in place. Four more. The handshake checked the protocol but never who answered, so one worker's daemon satisfied another's client on a stale socket — reproduced by starting field-aced on voice's socket path, and that reproduction is now a test. int(float(...)) took variants: 2.7 as 2 and seed 1.5 as 1, recording inputs the caller never gave. An empty voice_ref read as "absent" rather than as the malformed path it is, which would generate in the wrong voice and commit it. And the protocol tests still exercised the per-worker ACE schema copies, which went dead when the client moved to the shared ones — testing shapes nothing parsed with, while the shapes everything parsed with had no tests at all. Moved rather than duplicated, since the point is that there is one contract now. Every fix has a regression, and each fails with its fix disabled.
ninjudd
added a commit
that referenced
this pull request
Aug 8, 2026
Make field-voiced work against the actual model Five merged pull requests built this worker and every one of them said, accurately, that nothing had loaded Chatterbox yet. Generating creek's line is the first time anything did, and it found three things — two of them mine. `chatterbox-tts` needs `pkg_resources` and nothing in the graph asks for it. Chatterbox watermarks every generation through `perth`, whose `perth_net/__init__.py` imports `pkg_resources`; Python 3.12 no longer ships it and uv does not install it unasked. perth catches that ImportError and sets `PerthImplicitWatermarker = None`, so the failure surfaced one layer up as `'NoneType' object is not callable` from Chatterbox's constructor, naming neither perth nor setuptools. Declared as `setuptools>=70,<81` — the upper bound is not decoration, since setuptools removed `pkg_resources` itself and 83.0.0 satisfies a bare `>=70` while leaving perth exactly as broken. The #60 leak fix never worked. Restoring the builtin voice before each unreferenced variant went through `copy.deepcopy(model.conds)`, and torch refuses: "Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol." Some of those tensors come out of a forward pass. The fix was right about the leak and inoperative against the model, and it was verified by reading `chatterbox/tts.py` rather than by running it — which is precisely the distinction that review round could not make, because loading the model was the one thing the harness existed to avoid. `clone_conds` rebuilds the dataclass field by field with each tensor detached, which is the same shape Chatterbox's own `save`/`load` round-trip uses. A model-side failure left no trace. The lifecycle turned every exception into a one-line protocol error and logged nothing, so the first of these presented as a single sentence with no stack anywhere, and diagnosing it meant rebuilding the whole model load by hand outside the daemon. The wire still carries one line; the daemon's log now also carries the traceback that explains it. The regression test for that last one gets its own interpreter rather than the shared harness's. The existing one prefers `python/voiced/.venv` when it exists, which after a real `field setup voiced` contains Chatterbox — so a test wanting the backend to fail on import would instead load a 2 GB model, and would do so only on machines where setup had been run. Stating the precondition beats inheriting it; that is the same ambient-state trap the environment gate hit twice in #61 and #62. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes voice worker runtime dependencies, conditional cloning on every default-voice variant, and error logging; no auth surface, but incorrect cond cloning could still affect voice provenance. > > **Overview** > Fixes **field-voiced** so the first real Chatterbox load works: **`setuptools>=70,<81`** is declared so **`perth`** can import **`pkg_resources`** (otherwise **`'NoneType' object is not callable`** with no useful name on the wire). > > Replaces **`copy.deepcopy(model.conds)`** with **`clone_conds`**, which rebuilds conditionals field-by-field with detached tensor clones—the prior #60 leak fix failed on real tensors from the forward pass. > > The shared worker daemon now logs full tracebacks to stderr (the voiced log) on request and generation failures while clients still get one-line protocol errors. > > Adds a Vitest block that uses a **bare** Python (no Chatterbox) so a backend import failure is asserted to appear in **`voiced.log`**, avoiding the main harness’s venv that would load the model. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b520227. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

field-voiced— voice as the second client of the lifecycle #59 extracted. Worker, protocol, adapter, TS client, live protocol tests. No CLI wiring yet; that is the next slice.The adapter is wired against the wheel, not the README
I downloaded and read
chatterbox-tts0.1.7 rather than working from documentation, and three things that reading settled are recorded in the adapter's docstring:from_pretrainedhandles the MPS-unavailable fallback itself, so we pass a device preference rather than probing for one.conds.ptships as a builtin voice. That is what makesaudio_prompt_path=Nonea genuine default voice rather than an error path — the configuration bloom is about to use, now confirmed to exist rather than assumed.model.sris 24000. A voice variant is therefore at no project rate, so creek will wrap it in anormalizesound — the rule chunk 5 just rebuilt around our own resampler. The bloom half depends on work that already shipped.The client extraction was a trigger, not a preference
src/aced/client.tscarried this: "The deliberate duplication with audiod/client.ts is small and tolerated until a third daemon argues for a shared base."field-voicedis the third daemon. Copying 226 lines while that sentence sat in the file would have been the same shape of defect the last several reviews kept finding — a claim written down and then not honoured.What was aced-specific turned out to be seven strings and a job type. The generate response is shared too, since
GenerationOutputbecame shared in #59.audiod's client stays where it is, deliberately: it spawns a C++ binary rather than a uv project, and its vocabulary is transport rather than generation. Framing is all it shares, and sharing framing alone would tangle both sides more than either is now.The existing harness paid for itself again
The first draft of
connectTobuilt a baseWorkerClientand cast it to the subclass. That typechecks; at runtime it dies withgenerate is not a function. The live aced tests caught it on the first run, and the constructor is threaded through now.That is the second time on this branch — the first was the lazy-import constraint those tests imply, which I learned from #59's review rather than from planning.
Verification
360 tests.
field-voicedgets the same live harness asfield-aced: spawn, handshake, unknown op, job validation, all against the real Python daemon with no torch installed. It is also what would notice if a future edit imported chatterbox at module scope, which would silently cost that coverage.Both Python packages are pyright strict and CI gates all three —
worker,aced,voiced. Adding a package that declares strict typing with nothing running it is exactly what #59's review caught, and doing it a third time silently would have been worse.What is not here
No
field generaterouting yet, and no real model run: proving the default voice end to end means downloading ~2 GB of weights, which belongs to the first real run rather than to CI. What is proven is that the job parses, the daemon serves, and the API the adapter calls is the API the wheel exposes.Note
Medium Risk
New long-lived daemon with model loading and file I/O, but it mirrors the proven aced worker pattern with lazy imports and a quarantined adapter boundary.
Overview
Adds
field-voiced, a new Python uv worker that plugs into the sharedfield_workerdaemon lifecycle (same NDJSON socket pattern asfield-aced).The worker defines a
VoiceJobwire shape (text,seed,variants,output_dir, optionalvoice_ref) and aPipelinethat lazily loads Chatterbox TTS 0.1.7, generates numbered WAV variants with per-variant seeds, and returns sharedGenerationOutput. Untyped Chatterbox/torch imports are quarantined inadapter.pyso pyright stays strict elsewhere and CI can run without torch.CI now runs pyright on
python/voicedalongsideworkerandaced(uv sync --only-group dev).Reviewed by Cursor Bugbot for commit ff1b2c1. Configure here.