Skip to content

Fix Tichro voice cache miss on Railway (cache dir + lock drift) - #7

Merged
Osiris-DevWorks merged 3 commits into
mainfrom
fix/claimed-voice-files
May 17, 2026
Merged

Osiris-DevWorks merged 3 commits into
mainfrom
fix/claimed-voice-files

Conversation

@Osiris-DevWorks

Copy link
Copy Markdown
Owner

Summary

  • Tichro's claimed voice was silently falling back to M3 in production. Root cause: SupertonicEngine copied voices/Tichro.json to a hardcoded ~/.cache/supertonic2/voice_styles/, but Railway's installed supertonic library had drifted to a newer 1.x release that defaults to the supertonic-3 model with cache dir ~/.cache/supertonic3/. The file landed in the wrong directory, tts.get_voice_style('Tichro') raised FileNotFoundError, and synthesis fell back to the default voice on every request from him.
  • Only Tichro was affected because M1–M5 / F1–F5 ship inside the downloaded model package — our side-loaded custom voice was the only one that depended on the copy step.
  • Two fixes: stop hardcoding the destination (use self.tts.model_dir), and start tracking poetry.lock so the Docker build can finally honor the supertonic pin (the .gitignore already had a comment intending to keep it but the file had never been git added).

Changes

  • tts/supertonic_engine.py — destination is now Path(self.tts.model_dir) / 'voice_styles', version-agnostic.
  • poetry.lock + poetry.toml — now tracked. Lock pins supertonic 1.1.2 deterministically; the in-project venv convention from poetry.toml is captured too.
  • CLAUDE.md — unrelated doc improvements riding along on this branch: clarifies migration runner picks up only create_*/migrate_* (so the referenced fix_05_… is actually dormant), documents the voice-name casing canonicalization rule, corrects that the ready observer fires on both on_connect and on_ready, and notes tts.supertonic.voice is a fallback rather than a global default.

Heads-up

Pinning to supertonic 1.1.2 will downgrade Railway's runtime from the supertonic-3 model back to supertonic-2 on the next deploy. M1–M5 / F1–F5 may sound subtly different from current production. Tichro will work either way — the engine fix is what restores his voice.

Test plan

  • Merge and let Railway redeploy.
  • Confirm boot log shows Loaded unicode indexer from /home/ttsbot/.cache/supertonic2/onnx/… (model 2, not 3).
  • Confirm boot log has no Voice style 'Tichro' not found line.
  • Have Tichro speak in a monitored channel; verify his claimed voice plays (not M3).
  • Spot-check that another user's claimed/selected M-series voice still works.

🤖 Generated with Claude Code

Osiris-DevWorks and others added 3 commits May 17, 2026 18:30
- Auxiliary docs list now mentions RAILWAY_SETUP.md (with overlap note) and
  flags DIAGNOSTIC_REPORT.md as a historical audit, not a live reference.
- Database section: explicit that only create_*/migrate_* are auto-run, and
  that fix_05_voice_claims_partial_unique.sql despite being referenced is
  dormant under the current runner.
- New voice-name casing subsection covers migrate_02 + the runtime
  case-insensitive lookup safety net.
- Bootstrap step 7 corrected: the GUI ready observer fires on both
  on_connect and on_ready.
- Configuration sources: tts.supertonic.voice is the fallback voice, not a
  global default.
- Pytest example now uses a real selector (TestDBConnect); mentions the
  shared fixtures in tests/conftest.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…a lock

SupertonicEngine was copying bundled voice JSONs to a hardcoded
~/.cache/supertonic2/voice_styles/ destination. The installed supertonic
library actually loads voice styles from its own model_dir, which is
~/.cache/supertonic2 for the supertonic-2 model and ~/.cache/supertonic3
for supertonic-3, etc. When Railway resolved a newer supertonic (because
poetry.lock wasn't tracked and ^1.1 picked the latest 1.x), the model
became supertonic-3 and the cache copy landed in the wrong directory:

  supertonic.loader - ERROR - Voice style 'Tichro' not found.
  Available voice styles: F1, F2, F3, F4, F5, M1, M2, M3, M4, M5

Tichro then failed pre-cache and synthesis fell back silently to the
default voice (M3). Only Tichro was affected because M1-M5/F1-F5 ship
inside the downloaded model package.

Two changes:

1. tts/supertonic_engine.py: resolve the destination from
   self.tts.model_dir instead of hardcoding 'supertonic2'. Works against
   whichever model the installed library actually loaded.

2. poetry.lock and poetry.toml are now tracked. The .gitignore already
   said "keep poetry.lock for reproducible builds" but the lock had never
   been git-added, so the Dockerfile's COPY pyproject.toml poetry.lock*
   was a no-op for the lock and every build re-resolved dependencies.
   Tracking the lock pins supertonic to 1.1.2 deterministically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI failed installing dependencies with "pyproject.toml changed significantly
since poetry.lock was last generated" — the previously-committed lock had
been generated before commit fa94429 added pytest-asyncio / pytest-mock /
pytest-cov to [tool.poetry.group.dev.dependencies], so the content-hash no
longer matched.

Regenerated via `poetry lock` (refreshes the hash and fills in transitive
deps; does not bump anything that was already pinned). Verified:

- supertonic stays at 1.1.2 (the whole reason we tracked the lock)
- pytest stays at 7.4.4
- Net change is the addition of TTS (Coqui) + its transitive deps, which
  pyproject's TTS = "^0.22" already required — they were missing from the
  prior lock for unknown historical reasons. No-op for production since
  TTS was already being resolved fresh on every Railway build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Osiris-DevWorks
Osiris-DevWorks merged commit 6b03614 into main May 17, 2026
1 check passed
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