Skip to content

feat(tts): reintroduce Japanese TTS and read Visual Preview summaries aloud - #259

Merged
Kaikei-e merged 14 commits into
mainfrom
feat/tts-visual-preview
Oct 1, 2026
Merged

Kaikei-e merged 14 commits into
mainfrom
feat/tts-visual-preview

Conversation

@Kaikei-e

@Kaikei-e Kaikei-e commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Reintroduce Japanese TTS with Irodori-TTS v4.1-Small behind a thin tts-speaker service (ADR-000991, accepted). It runs under the opt-in compose profile tts; weights and reference voices stay local-only.
  • Read Visual Preview AI summaries aloud (ADR-000992, proposed):
    • tts-speaker streams alt.tts.v1.TTSService/SynthesizeStream, one self-contained WAV per 60-character chunk. Default speed is 1.25x, capped at 1.5x.
    • The BFF proxies it over a dedicated HTTP/1.1 mTLS transport. TTS_PROXY=enabled|disabled is required at startup.
    • The FE plays the complete summary gaplessly on one shared AudioContext once the summary has fully arrived.

Testing

  • tts-speaker: pytest, ruff, Playwright @contract suite against a fake Irodori upstream
  • BFF: go vet, go test ./...
  • FE: bun run check, bun run test, the speech browser tests, mobile E2E for Visual Preview speech
  • docdag validate
  • Contract coverage follows the streaming precedent instead of Pact (ADR-000992, Decision 6).

Before merge / deploy

  • G3 in ADR-000992 still needs a real-device check: first audio within about 3 s of the tap, with the tts profile running. ADR-000992 moves to accepted after that.
  • With the tts profile off, the button shows a retryable error. TTS_PROXY=disabled shows a fixed "Speech unavailable".

🤖 Generated with Claude Code

… profile

Add tts-speaker, a thin FastAPI gateway that normalizes and chunks text,
calls Irodori-TTS-Server with retries, and terminates inbound mTLS via the
in-process PKI copied from news-creator. Add an Alt-owned build of
Irodori-TTS-Server pinned to upstream commits, with a CUDA memory probe,
operator scripts for pinned checkpoints, local MF quantization and voice
registration, and a stdlib harness that measures VRAM and RTF for the four
candidate configurations. Both services live in compose/tts.yaml under the
tts profile, so a plain up or deploy never starts them.

Register tts-speaker in the service registry, CI, CodeQL, the ops-surface
inventory and the PKI provisioner lists, and record the decision as
proposed ADR-000991, which supersedes ADR-000900.
…expandable segments

Peak GPU memory follows the length of the synthesized audio, so 100-char
chunks overshot the budget at 1.0x for every configuration. Lower the
tts-speaker chunk default to 60 characters, enable PyTorch expandable
segments for irodori-tts, align the worst-case bench inputs, add a playback
speed option to the harness, and record the measurement progress in
ADR-000991.
… to C3

compose run rebuilt the image on every call because of pull_policy: build,
so voice registration took minutes; the scripts now use docker run on the
local image. C3 sounded most natural in listening tests, so it becomes the
default configuration, and ADR-000991 records the voice and G5 progress.
Listening tests found 1.25x the most natural and 2.0x dropping characters.
ADR-000991 records the speed policy and the G4/G5 listening verdicts.
…FF and FE

Restore alt.tts.v1.TTSService with only SynthesizeStream (public) and its
generated code, and add failing tests for the tts-speaker Connect service
and streaming usecase, the BFF dedicated TTS route (streaming pass-through,
auth, disabled failed_precondition, wiring log), the frontend player,
speech state and Visual Preview button, plus a Playwright @contract suite
for the stream framing. ADR-000992 records the decision as proposed.
…nect RPC

tts-speaker now serves alt.tts.v1.TTSService/SynthesizeStream instead of
the REST endpoint. Each 60-character chunk is sent as a self-contained
16-bit PCM WAV as soon as it is synthesized, so the first audio arrives
after one chunk instead of after the whole text. Requests take an
optional speed (0.5-1.5, default 1.25). A client disconnect cancels the
synthesis and releases the single-flight lock instead of waiting for GC.

The BFF proxies the procedure over a dedicated HTTP/1.1 mTLS transport
to tts-speaker:9443 and requires TTS_PROXY=enabled|disabled at startup.
When disabled it answers with a failed_precondition end-of-stream frame;
when enabled without a transport it panics instead of falling back.

The Visual Preview card shows "Play summary" once the summary has fully
arrived and plays the complete server text, not the typed-out prefix.
Chunks are decoded and scheduled back to back on one shared AudioContext
that is resumed inside the tap, a closed context is replaced on the next
tap, and the status is announced through a live region. A disabled proxy
latches "Speech unavailable"; other failures are retryable.

Contract coverage follows the streaming precedent: a Playwright
@contract suite against tts-speaker with a fake Irodori upstream, BFF
httptest cases, and mocked-stream FE E2E. No Pact, see ADR-000992.

Some RED tests were adjusted while going green: timing assertions in the
speech hook test were relaxed to vi.waitFor, and the FE E2E mock now
sends failed_precondition as an HTTP 200 end-of-stream frame to match
the BFF.
@gitguardian

gitguardian Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T14:04:08.590062Z d834114 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	alt-butterfly-facade/CLAUDE.md
#	alt-butterfly-facade/README.md
#	alt-frontend-sv/tests/e2e/fixtures/mockData.ts
#	proto/buf.yaml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8341140e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- PEER_IDENTITY_TRUSTED=off
- PKI_ENROLLMENT=disabled
- INBOUND_MTLS=false
- LOG_LEVEL=info

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use an accepted log level in the staging service

The tts-speaker staging container exits during configuration loading because Settings.log_level only accepts the uppercase literals defined in tts-speaker/tts_speaker/config/settings.py, while this profile supplies lowercase info. Consequently, the new tts-speaker Playwright suite never reaches its health check and fails every run; set this to INFO or normalize case in the settings validator.

Useful? React with 👍 / 👎.

@Kaikei-e Kaikei-e changed the title Feat/tts visual preview feat(tts): reintroduce Japanese TTS and read Visual Preview summaries aloud Oct 1, 2026
The staging stack passes LOG_LEVEL=info like every other service, and the
upper-case Literal rejected it, so tts-speaker exited at startup.
@Kaikei-e
Kaikei-e merged commit a445346 into main Oct 1, 2026
101 checks passed
@Kaikei-e
Kaikei-e deleted the feat/tts-visual-preview branch October 1, 2026 14:38
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.

2 participants