Repository navigation
ACE generation chunk 1: bloom-aced worker, bloom ace generate end to end - #17
Conversation
Starts the ACE phase (ace-generation.md, decisions in section 3). The big structural decision recorded there: ACE lives OUTSIDE the build graph - a fixed seed reproduces on the same machine but not across GPU/framework versions, so outputs are committed, never cached, and take-pinning machinery stays deferred until the recording era gives it real consumers. python/aced is a uv project pinning ACE-Step 1.5 by commit (MIT; MLX for the LM side, MPS for diffusion - first-class Apple Silicon). bloom-aced is the audiod lifecycle translated to Python: flock-owned root-relative socket, versioned NDJSON (hello/generate/progress events/quit), one-generation-at-a-time with busy as an honest answer, idle-exit that never fires mid-generation, SIGTERM unlinking the socket (a pkill race found live). Pyright strict gates every module in CI (dev-group-only sync - the model env is too heavy for CI); the one untyped boundary, ACE-Step's package, is quarantined in adapter.py behind a single file-level pragma. The adapter was wired by reading the installed package's source: generate_music with llm_handler=None (no LM in v1), batch_size as the variants knob, per-variant seeds, wav output; weights live machine-global under ~/.bloom/models/acestep (~10 GB, downloaded on first generate, announced by progress events). bloom ace generate <name> --song --prompt --seed with --bars projected through the song's tempo map CLI-side (bpm hint from the map; the worker never learns what a bar is). Variants land as songs/<song>/generation/<name>/<name>-N.wav plus a provenance recipe YAML (model, prompt, bpm, duration, seeds, per-variant sha256). Verified live from field: 4 bars at creek's 96 bpm -> exactly 10.0 s, two variants at 48 kHz stereo, ~15-20 s per generation with the model warm. Chunk 2: the recipe schema formalized, bloom ace choose promoting a variant to a committed asset, field's demo committed.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default 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 e1ed78d. Configure here.
Bugbot: adapter dropped path-less audios entries but returned the full seeds list, letting variant WAVs pair with wrong seed metadata. Now the daemon raises unless all requested variants materialize, the TS schema rejects misaligned paths/seeds, and the client's seed fallback (which could fabricate wrong values) is gone.
ninjudd
left a comment
There was a problem hiding this comment.
Reviewed at head e1ed78d (local checkout matches). TS typecheck clean, all 166 tests pass, pyright strict re-run locally: 0 errors, CI green. I couldn't re-run the model itself (by design — that verification was yours, twice, on hardware), but I probed everything short of it: the daemon's concurrency behavior with a stubbed pipeline, the CLI error paths against a real spawned worker, and the protocol shapes. Three P3s, all verified by execution; the architecture itself is right and the §3 decision record is exactly what AGENTS.md wants.
- P3 — the single-flight gate is check-then-set and can admit two concurrent generations. Inline on
main.py. Confirmed with a stubbed-pipeline probe; details and honest caveats in the thread. - P3 — the four new numeric options regress to bare
Number(v)parsers — the exact class #7 fixed for--seed(which correctly reusesparseSeedone line up). Inline oncli.ts, with the confusing user-visible error captured. - P3 —
BLOOM_ACED_PYTHONis recorded in §3.4 as decided ("mirroringBLOOM_AUDIOD") but appears nowhere in the code. Inline on the client. Either implement it or amend the record — a decision doc promising an escape hatch that doesn't exist is the §3.4-of-#7 story in reverse.
Verified by execution:
- Stubbed-pipeline daemon probe: under normal scheduling the busy path answered correctly in 200/200 simultaneous-pair rounds; the race needed adversarial scheduling to show itself (finding 1).
- CLI error paths against a real spawned (model-less) worker:
--bars abcand sub-floor durations both fail with'duration_seconds' must be in [10, 600]— legible but bars-blind (finding 2 covers the fix). - Protocol details: hello answers before any model import (the lazy-import quarantine in
adapter.pyis what makes that true), unknown ops and malformed JSON produce protocol errors, and the spawn poll's 60 s budget with the uv hint is the right failure message.
Verified by reading, no issues found:
- The lifecycle translation from audiod is faithful including the lessons: lifetime flock never unlinked (the #12 Bugbot fix), the flock loser exits without touching the winner's socket, SIGTERM → quit → socket unlink (the recorded pkill race), idle-exit can never fire mid-generation because
_generatingrefreshes the activity clock, and the TS client carries the #12 JSON.parse guard and #13-style listener hygiene from birth. - The structural decision — ACE outside the build graph, outputs committed, recipes as provenance-not-cache-keys — is the right reading of the reproducibility caveat, and deferring take-pinning to the recording era with a named forcing function is exactly how this repo defers things.
- The musical-time boundary holds for a second daemon: bars project CLI-side through the tempo map, the worker sees seconds and a bpm hint (
Math.roundof the opening tempo for ramped songs — reasonable and recorded in the recipe). - Per-variant seed provenance (
base+i, recorded per file with sha256) makes the recipe genuinely audit-grade;use_random_seed=Falsewith explicit seeds matches the adapter's source-read claim. - CI's dev-group-only sync is the right cost line, and quarantining the untyped boundary behind one file-level pragma keeps the strict gate meaningful.
Two body-level notes, no threads: the 10 s duration floor means short loops (1–2 bars at common tempos) can't generate — your own live test (4 bars @ 96 bpm = exactly 10.0 s) sits right on it, and 4 bars at 97 bpm would fail; if the floor is ACE-Step's, a CLI-side error naming bars and the floor (or generate-then-trim later) would spare the next person the puzzle. And quit/SIGTERM mid-generation silently kills the generation thread (daemon threads die with the process) — fine for an explicit kill, just worth knowing the half-written variant directory can exist; the recipe-write ordering (CLI-side, after success) already means no recipe ever points at missing files.
Merging is Justin's checkpoint.
Three P3s from review. The single-flight gate becomes a Lock.acquire(blocking=False) — an Event's is_set()/set() pair spans two reader threads with parsing in between. --bars/--duration/--variants/ --bpm get real parsers (bare Number let 'abc' surface as a daemon range error about a field the user never typed). BLOOM_ACED_PYTHON now exists as §3.4 records: an interpreter override that runs 'python -m bloom_aced', which also brings live daemon protocol tests to CI — the lazy ACE-Step imports mean spawn/handshake/validation/quit all work from a bare interpreter with sources on PYTHONPATH.
ninjudd
left a comment
There was a problem hiding this comment.
Scoped follow-up review at head 331ddf7, covering everything my e1ed78d review never saw — which turns out to be two commits: the review-fix commit and 76d7670 (the Bugbot partial-batch fix) that landed between them. No findings. All three P3 fixes verified by execution against this head; the thread resolutions are accurate.
Fix 1 — atomic gate, verified by re-running the original probe. The same 1000-round adversarial-scheduling probe (setswitchinterval(1e-6), stubbed pipeline) that showed 638/1000 double-accepts on e1ed78d now shows:
rounds: 1000, busy answers: 1000, max concurrent generations observed: 1, total runs: 1000
Exactly one accept and one busy per round, zero double-runs. The parse-before-gate reorder is an improvement beyond the fix: I walked the exception path — _handle_line wraps _dispatch, so a malformed request raises before acquire and can never strand the gate, and a busy daemon still reports malformed as malformed. Release-in-finally from the generation thread is legal for a Lock (unlike RLock), and run_until_idle's locked() read keeps the idle-never-mid-generation property.
Fix 2 — parsers, all six error paths smoked against the real CLI. --bars abc and --bars 0 → bars must be a positive integer; --variants 3.7 and --variants 9 → variants must be an integer in [1, 8] (the silent int() truncation is dead — 3.7 dies at the flag); --bpm 500 → bpm must be in [30, 300]; --duration abc → the reused parseDurationSeconds message. Every error now names the flag the user actually typed.
Fix 3 — the override, probed on both sides. The set-but-missing path hard-errors with BLOOM_ACED_PYTHON points at a missing interpreter: … before any spawn (the BLOOM_SCLANG/BLOOM_AUDIOD precedent, correctly resolved to absolute before the cwd changes). The happy path is the new client.test.ts, which I ran in isolation (3/3) and as part of the suite: live spawn → handshake with model_loaded: false → unknown-op error with the connection still serving → param validation rejected before any model work → quit. That these run from a bare interpreter is the lazy-import quarantine paying off exactly as designed, and it converts the previously local-only protocol coverage into CI coverage — the outcome I was hoping for when leaning implement. One micro-nit, not a finding: afterEach deletes PYTHONPATH rather than restoring a pre-existing value; harmless under vitest's per-file process isolation, just worth knowing if the pool config ever changes.
76d7670, reviewed by reading plus its test. The chain is sound end to end: the adapter's all-or-nothing check (len(paths) != job.variants raises) guarantees the daemon never returns a misaligned batch, the schema refine (paths.length === seeds.length) enforces it at the protocol boundary with a test, and that's what licenses the seeds[i]! non-null assertion replacing the old fabricating fallback (files maps 1:1 from paths, and seeds is built as variants explicit values). Recipe seed provenance can no longer silently lie.
Suite state confirmed locally: typecheck clean, 170/170 tests, pyright strict 0 errors, CI green on this head. The two body-note dispositions (10 s floor stays with the generate-10-use-less rationale; quit-mid-generation accepted given the recipe-write ordering) are reasonable and I'm glad they're headed into the chunk-2 plan text.
Ready for Justin's merge.
…#18) Chunk 2 of [ace-generation.md](docs/projects/all/ace-generation.md) §4: variants as takes. ## What's here - **Recipe schema** (`generationRecipeSchema` + KeyOrder): `songs/<song>/generation/<name>.yaml` is now a validated project file. `loadProject` loads it, `validate` enforces filename-is-key, normalized/safe/existing variant paths, and `chosen` in range; `bloom check` hash-verifies variant content; `bloom fmt` covers recipes. `bloom ace generate` writes through the same schema + canonicalizer, so a fresh recipe can never be one the loader rejects. - **Variants are addressable**: `//songs/<song>/generation:<name>-<n>` — a new graph node kind, playable via `bloom play` for audition and explainable, but deliberately **not** referenceable by clips or rules. Promotion is the only path from variant to input. - **`bloom ace choose <name> --song <s> --variant <n> [--as <asset>]`**: verifies the variant's bytes still hash to what the recipe recorded (drifted output is diagnosed, never promoted), then declares it in `assets.yaml` **in place** — no bytes copied, per build-graph.md's "promotion is a reference to a content-addressed artifact — cheap, and reversible". Records `chosen` in the recipe (written second, so a crash between writes understates rather than lies). Re-choose moves the reference; it only ever replaces an entry a previous choose created, and refuses name collisions with unrelated assets (`--as` routes around them). - **Fix in `canonicalizeDocument`**: pairs added via `Document.setIn` carry plain-string keys, which `keyName` didn't rank — programmatic edits ended up appended instead of in canonical position. One-line fix, caught by the new fmt-idempotence test. - The PYTHONPATH restore nit from the #17 re-review. - Docs: project-model.md "Generation recipes" concretized; ace-generation.md gets a §5 Follow-ups (duration floor, mid-generation quit, ACE-Step's cwd cache). ## Verified - 180/180 tests (10 new: loader validation, drift detection, playability, choose/re-choose/collision/drift-refusal, fmt idempotence after both writes). - Live against field: the chunk-1-written `still-water-keys` recipe loads, checks clean, and both variants appear in `bloom query //songs/creek/...` and explain with their recipe hashes. Field's demo commit (promote a variant into creek + a keys track) follows after this merges. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes project loading, validation, and mutable `assets.yaml` promotion logic; safeguards (hash checks, collision rules) limit but do not eliminate risk to referential integrity. > > **Overview** > ACE **chunk 2** turns `songs/<song>/generation/<name>.yaml` into a validated project file: load, `bloom check` (variant hashes), and `bloom fmt` all apply. **`bloom ace generate`** now emits recipes through the same schema and canonicalizer so fresh output cannot disagree with the loader. > > Numbered variants are graph nodes at `//songs/<song>/generation:<name>-<n>` — **auditionable** via `bloom play` and explainable, but **not** clip or rule inputs until promoted. > > **`bloom ace choose`** promotes a variant by declaring it in `assets.yaml` **in place** (no file copy), verifies bytes against the recipe SHA, records `chosen` on the recipe (written after assets so a crash understates rather than lies), supports re-choose and `--as`, and refuses unrelated name collisions or drifted content. > > The build graph treats generation nodes like committed sources (hash identity, no execution). **`canonicalizeDocument`** now ranks keys from `Document.setIn` (plain strings), so programmatic YAML edits stay in canonical order. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit edeaaaf. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Docs only. ace-generation.md status → Complete (2026-08-05, #17 + #18) — field demonstrates the full loop (generate → audition variants in the mix → choose → clip the promoted asset into creek), meeting §2's definition of done. The plan's further verbs (extend, repaint) are future phases. Removes the plan from now.md (work genuinely over) and the stale duplicate line from next.md that should have left when the work started. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation and project-list edits only; no code or runtime behavior changes. > > **Overview** > **ACE generation** is marked **Complete** in `ace-generation.md` (2026-08-05, #17 + #18): both chunks shipped, with field exercising generate → audition variants → `choose` → clip into creek; verbs like `extend`/`repaint` stay future work, with follow-ups in §5. > > Project tracking matches that closure: the **ACE generation** line is removed from `now.md` (work genuinely over) and the stale duplicate entry is removed from `next.md`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 72e7530. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->

Starts the ACE phase — the decisions are in ace-generation.md §3, headlined by the structural one: ACE lives outside the build graph. A fixed seed reproduces on the same machine, not across GPU/framework versions, so outputs are committed, never cached; take-pinning machinery stays deferred until the recording era gives it real consumers.
What this adds
python/aced/— a uv project pinning ACE-Step 1.5 by commit (MIT; MLX for the LM side, MPS for diffusion — first-class Apple Silicon).uv.lockcommitted;.venvignored; weights live machine-global at~/.bloom/models/acestep(~10 GB, pulled on first generate, announced via progress events).bloom-aced— the audiod lifecycle translated to Python: flock-owned root-relative socket at.bloom/aced.sock, versioned NDJSON (hello/generate/ streamingprogress/quit), one-generation-at-a-time withbusyas an honest answer, idle-exit (10 min — an idle model worker holds GBs of unified memory) that never fires mid-generation, and SIGTERM unlinking the socket (a pkill race found live during bring-up).adapter.pybehind a single file-level pragma. CI syncs only the dev group — the model environment is far too heavy for runners, which is also why the daemon's protocol tests are local-only (they ran, twice, against the real model).generate_musicwithllm_handler=None(no LM in v1; the source honors it whenthinkingis off),batch_sizeas the variants knob, explicit per-variant seeds (base+i), wav output.bloom ace generate <name> --song --prompt --seed—--barsprojects through the song's tempo map CLI-side and the bpm hint comes from the map (the worker never learns what a bar is — the audiod precedent holds). Variants land assongs/<song>/generation/<name>/<name>-N.wavplus a provenance recipe (model, prompt, bpm, duration, seeds, per-variant sha256).bloom ace setupis the explicit environment step.Verified
bloom ace generate still-water-keys --song creek --bars 4 --seed 90210→ exactly 10.0 s at creek's 96 bpm, two 48 kHz stereo variants, named files + recipe. Justin auditioned the output: it works.Chunk 2 next: the recipe schema formalized in zod,
bloom ace choosepromoting a variant to a committed asset clips can reference, and field's generated part committed as the demo.Note
Medium Risk
New long-lived daemon and multi-GB model download path add operational surface; CI intentionally skips full model tests, so protocol/runtime regressions rely on local verification.
Overview
Introduces
python/aced/as a uv-managedbloom-aceddaemon: flock-owned Unix socket at.bloom/aced.sock, NDJSON ops (hello,generate, streamingprogress,quit), single-flight generation, idle shutdown (default 10 min) that does not interrupt an active run, and SIGTERM handling that unlinks the socket.ACE-Step 1.5 is pinned by git commit; weights live under
~/.bloom/models/acestep(override viaBLOOM_ACE_MODELS). Untyped ACE-Step calls are isolated inadapter.py(pyright: basic);protocol.pyvalidates generate jobs (seconds, seeds, variants, optional lyrics/BPM).CI adds
uv+ pyright strict onpython/aced/srcusing only the dev dependency group (no torch/model stack on runners)..gitignoreignorespython/aced/.venv/and__pycache__/.Docs mark ACE generation in progress, record §3 decisions (committed outputs, deferred graph take-pinning, daemon lifecycle, uv/strict Python), and shift now.md from effects to ACE.
Reviewed by Cursor Bugbot for commit e1ed78d. Configure here.