Skip to content

(CODUX-219) Implement sentence-aware speech chunking - #3020

Merged
numnx merged 1 commit into
feature/CODUX-219-fix-chat-continuations-and-tts-playbackfrom
task/feature-codux-21-t03-codex-32e6d7af-mrjh2mcn
Jul 13, 2026
Merged

(CODUX-219) Implement sentence-aware speech chunking#3020
numnx merged 1 commit into
feature/CODUX-219-fix-chat-continuations-and-tts-playbackfrom
task/feature-codux-21-t03-codex-32e6d7af-mrjh2mcn

Conversation

@numnx

@numnx numnx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Implement sentence-aware speech chunking

Automated task PR opened by Code UX for T03.

📋 Summary

Sprint: Sprint 219 · Fix chat continuations and TTS playback · Task: T03

Keep agent-owned Project Manager continuations bound to their originating chat thread without cancellation cascades or duplicate turns, and deliver long Chat replies through a fast, sentence-chunked, ordered TTS pipeline.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.6-sol

⏱️ Timing

Started 2026-07-13 17:04:24 UTC
Finished 2026-07-13 17:11:56 UTC
Duration 7m 32s

📊 Token Usage

Metric Value
Input tokens 92,610
Cached input tokens 1,544,960
Output tokens 16,542
Total tokens 1,654,112
Invocations 1
Tool calls 28
Active time 6m 55s

Included usage estimate (subscription/local login): $1.73

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

📝 Full Task Prompt
## Objective
Create a deterministic speech-text chunker that lets long Project Manager replies begin with a complete sentence quickly while preserving every speakable word in order and respecting the backend synthesis limit.

## Scope
- `dashboard/src/v2/lib/speech-playback.ts`
- `dashboard/src/v2/lib/__tests__/speech-playback.test.ts` (create)
- Existing Markdown/widget speech filtering in `speechTextFromMarkdown`

## Implementation Requirements
1. Split normalized spoken text at sentence boundaries, including punctuation and common closing quotes/brackets, while retaining punctuation needed for natural speech.
2. Group or fallback-split chunks so every request stays within `MAX_SPEECH_PLAYBACK_CHARS`; handle long unpunctuated text, a single oversized sentence, repeated whitespace, empty Markdown, code fences, and dashboard-only widget fences without dropping or duplicating content.
3. Add tests proving chunk order, exact normalized-content reconstruction, fast first-sentence availability, punctuation handling, maximum-length enforcement, and preservation of the existing code/widget suppression behavior.

## Constraints
- Keep the 8,000-character request ceiling compatible with `POST /api/speech/synthesis`.
- Do not send Markdown decoration, ordinary fenced code, or `codeux:*` widget payloads to a speech provider.
- Keep the helper pure and independent of browser audio, network calls, React/Preact state, or external packages.

## Verification
- Run `pnpm exec vitest run dashboard/src/v2/lib/__tests__/speech-playback.test.ts`.
- Run `pnpm run typecheck:dashboard`.
- Confirm all chunks are non-empty, ordered, bounded, and reconstruct the filtered spoken text exactly.
🌿 Branch Info

Base: feature/CODUX-219-fix-chat-continuations-and-tts-playback
Head: task/feature-codux-21-t03-codex-32e6d7af-mrjh2mcn


🤖 Generated by Code UX

@numnx
numnx merged commit 3687306 into feature/CODUX-219-fix-chat-continuations-and-tts-playback Jul 13, 2026
20 checks passed
@numnx
numnx deleted the task/feature-codux-21-t03-codex-32e6d7af-mrjh2mcn branch July 13, 2026 17:16
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