Skip to content

Check the lockfile with --locked, not --frozen - #62

Merged
ninjudd merged 2 commits into
mainfrom
voice/locked-probe
Aug 8, 2026
Merged

ninjudd merged 2 commits into
mainfrom
voice/locked-probe

Conversation

@ninjudd

@ninjudd ninjudd commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Check the lockfile with --locked, not --frozen

Follow-up to #61, which merged before this was caught.

The availability probe passed --frozen to keep itself from writing to the repo while deciding whether a worker may start. That works, but it is the wrong flag for the question: --frozen means "sync without updating the lock", which is permission to proceed on a stale one. --locked means "assert uv.lock will remain unchanged", which is a check that it is current — and it is equally read-only. So a worker whose environment matches a lockfile that no longer matches pyproject passed the gate, launched with --no-sync, and failed later on the dependency it never got, instead of being sent to field setup.

#61 recorded a deliberate cost for --frozen: staleness measured against the lockfile rather than against pyproject. That was not a cost of the goal, it was a cost of the wrong flag, and the record in ace-generation.md §6 now says so.

The regression test asks real uv, because uv's semantics are the thing under test. It syncs a project, moves pyproject past the lock without touching the environment, and asserts the probe reports stale and the lockfile is byte-identical afterwards. Two details it needs, both of which cost me four failed reproductions before I understood them: the project must be one uv does not reinstall on every pyproject edit, because that reinstall masks the divergence and makes both flags look identical, and the console script is placed by hand because the probe only asks uv anything once the worker looks installed.

CI installs uv before pnpm test now, on both lanes. It was installed after, so that test would have skipped in CI and run only on my machine — which is the failure mode this gate has already produced twice.


Note

Medium Risk
Changes worker launch gating and uv probe semantics; incorrect behavior could block valid workers or allow stale envs, but the change aligns the gate with documented “explicit setup” intent and adds CI coverage for the regression test.

Overview
The worker availability probe now passes --locked to uv sync --check instead of --frozen. Both flags keep the probe from writing uv.lock, but only --locked treats a lockfile that no longer matches pyproject.toml as out of date—so workers are refused with “run field setup” instead of starting with --no-sync and failing later on missing deps.

lockfile.test.ts exercises this against real uv (skipped when uv is absent). setup.test.ts asserts the probe argv includes --locked and never --frozen. ace-generation.md §6 is updated to record that the old “staleness vs lockfile” tradeoff was from the wrong flag, not the design goal.

CI runs astral-sh/setup-uv before pnpm test on Linux and macOS so the new test is not unconditionally skipped in CI (it was only running locally when uv was installed after tests).

Reviewed by Cursor Bugbot for commit daf9e29. Configure here.

Follow-up to #61, which merged before this was caught.

The availability probe passed `--frozen` to keep itself from writing to the repo while deciding whether a worker may start. That works, but it is the wrong flag for the question: `--frozen` means "sync without updating the lock", which is permission to proceed on a stale one. `--locked` means "assert `uv.lock` will remain unchanged", which is a check that it is current — and it is equally read-only. So a worker whose environment matches a lockfile that no longer matches pyproject passed the gate, launched with `--no-sync`, and failed later on the dependency it never got, instead of being sent to `field setup`.

#61 recorded a deliberate cost for `--frozen`: staleness measured against the lockfile rather than against pyproject. That was not a cost of the goal, it was a cost of the wrong flag, and the record in ace-generation.md §6 now says so.

The regression test asks real uv, because uv's semantics are the thing under test. It syncs a project, moves pyproject past the lock without touching the environment, and asserts the probe reports stale and the lockfile is byte-identical afterwards. Two details it needs, both of which cost me four failed reproductions before I understood them: the project must be one uv does not reinstall on every pyproject edit, because that reinstall masks the divergence and makes both flags look identical, and the console script is placed by hand because the probe only asks uv anything once the worker looks installed.

CI installs uv before `pnpm test` now, on both lanes. It was installed after, so that test would have skipped in CI and run only on my machine — which is the failure mode this gate has already produced twice.
@ninjudd

ninjudd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Starting review of daf9e29.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of daf9e29. The flag change itself is right and I verified it against real uv 0.11.30 rather than taking the description on trust: sync a project at requires-python = ">=3.11", move pyproject to >=3.12 without touching the environment, and uv sync --check --frozen --no-python-downloads exits 0 while --locked exits 1 with "The lockfile at uv.lock needs to be updated". That is exactly the gap the PR describes, and --locked leaves the lockfile byte-identical, so nothing about the read-only promise is given up. pnpm vitest run src/workers/lockfile.test.ts passes here in 194ms and leaves no python/.test-lock-* behind. The ace-generation.md §6 citation checks out — line 120 is ## 6, and the new paragraph lands inside it.

Three findings, all about the regression test and the CI move rather than the production change.

Comment thread .github/workflows/ci.yml Resolved
Comment thread src/workers/lockfile.test.ts Resolved
Comment thread src/workers/lockfile.test.ts Resolved
Three review findings on #62, all about a test that could be green while proving nothing — the same failure this PR's CI change exists to remove, reproduced inside the test itself.

The setup bail is gone. `uv sync` failing returned early, which vitest reports as a pass with no assertions run and nothing to distinguish it from a real one. `uvUsable` now asks both halves of the question — uv present, and an interpreter satisfying the constraint — with `uv python find --no-python-downloads`, so an unusable machine skips visibly and a failed sync is a failure.

The staleness lever widens instead of narrowing. Narrowing `requires-python` is a lock/pyproject divergence and an interpreter demand at once, so on a machine without the newer interpreter the probe failed for the wrong reason and the assertion still passed. Verified: against a constraint nothing satisfies, `--frozen` and `--locked` both exit 2 — identical, so the test would no longer detect a revert to `--frozen`, which is its entire purpose. Widening cannot fail that way, since anything satisfying the lock satisfies the wider constraint, and it leaves the lockfile just as out of date.

And the comment above `environmentVerdict` justified its purity by saying CI has no uv when `pnpm test` runs, which this branch's own CI change made false in the same commit. The reason purity was chosen outlives the justification, so it is reworded rather than dropped.
@ninjudd

ninjudd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Starting review of f385b5f.

@ninjudd

ninjudd commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed f385b5f — no findings. All three from the daf9e29 review are fixed, and I checked the fixes rather than the diff's description of them.

The uvUsable guard is real: uv python find '>=3.11' --no-python-downloads exits 0 here and exits 2 against a constraint nothing satisfies, so a machine with uv but no interpreter now produces a visible skip instead of the green zero-assertion pass. expect(sync.status).toBe(0) is then safe to make loud, because the guard has already established both halves.

The widening is the part worth confirming end to end, so I mutated PROBE_CHECK_ARGS back to --frozen and reran: the test fails, expected true to be false. That is the property the file exists for — with >=3.12 it would have passed on a 3.11-only machine — and it now holds without depending on which interpreters are installed. Checkout restored; pnpm typecheck clean and src/workers/ green, 19 tests, including this one at 199ms.

One observation, not a finding, since the outcome is now honest either way: setup-uv installs uv but not an interpreter, so whether this test runs in CI still rests on the runner image shipping a discoverable system Python. Today's ubuntu-latest and macos-latest both do. If that ever stops being true the report says "skipped" rather than "passed", which is the whole improvement — but the ci.yml comments read as though installing uv is sufficient, and it is uv plus the runner's Python.

MIN_PYTHON is read inside uvUsable above its own const, which is fine as written — the module body initialises it before describe.skipIf calls the function — and would fail loudly rather than silently if that ever stopped being true.

@ninjudd
ninjudd merged commit 4c7ce30 into main Aug 8, 2026
2 checks passed
@ninjudd
ninjudd deleted the voice/locked-probe branch August 8, 2026 06:04
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 -->
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