Skip to content

Sprint 219: Fix chat continuations and TTS playback — merge feature/CODUX-219-fix-chat-continuations-and-tts-playback into dev - #3031

Merged
numnx merged 11 commits into
devfrom
feature/CODUX-219-fix-chat-continuations-and-tts-playback
Jul 13, 2026
Merged

Sprint 219: Fix chat continuations and TTS playback — merge feature/CODUX-219-fix-chat-continuations-and-tts-playback into dev#3031
numnx merged 11 commits into
devfrom
feature/CODUX-219-fix-chat-continuations-and-tts-playback

Conversation

@numnx

@numnx numnx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

🚀 Sprint Completion: Sprint 219 · Fix chat continuations and TTS playback

Automated sprint completion PR opened by Code UX.

📋 Summary

Sprint: Sprint 219 · Fix chat continuations and TTS playback Tasks: 5/5 completed

🧭 Planning

Planning provider Codex CLI
Planning model gpt-5.6-luna
Metric Value
Input tokens 285,113
Cached input tokens 4,744,704
Output tokens 24,983
Total tokens 5,054,800
Invocations 1
Tool calls 33
Active time 8m 38s

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

🎯 Original Sprint Prompt

Fix three related Chat reliability defects.

Observed production evidence (2026-07-13 16:40-16:43 UTC):

  • Agent-owned wakeups using wakeAfterReply were picked up by the scheduler timer before the originating Project Manager reply had completed. The synthetic dashboard message superseded/cancelled the in-flight worker_reply invocation, and each replacement invocation scheduled another wakeup, producing duplicate/recursive continuations.
  • The first continuations had the originating thread id, but later schedule_wakeup calls omitted threadId even though authenticated MCP request context carried the current thread. AgentSchedulerActions persisted null, and SchedulerService/ChatThreadRuntime created new "Scheduled agent wakeup" threads.
  • Chat TTS currently splits only at the backend maximum of 8,000 characters and synthesizes each chunk only after the prior audio finishes. Long replies can stop after roughly 30 seconds and time-to-first-audio is slow.

Required outcomes:

  1. Make wakeAfterReply a real delivery barrier: it must not be eligible for the generic scheduler tick until the originating reply has been durably posted/settled. Running a continuation must never supersede the turn that scheduled it.
  2. Prevent duplicate/recursive wakeups for one originating turn with a durable, narrowly scoped idempotency/claim rule that does not block legitimate later reminders. Preserve retry/restart correctness.
  3. For authenticated dashboard-chat MCP calls, default an omitted wakeup threadId to getCurrentMcpThreadId(), validate project ownership, and always append the continuation to that thread. Only create a new thread when there truly is no originating thread context.
  4. Add structured correlation logs/metadata covering originating thread/turn, scheduler entry, and continuation delivery. Add regression tests reproducing the live cancellation cascade, duplicate scheduling, missing-thread fallback, explicit thread behavior, restart safety, and validation failures.
  5. Rework Chat TTS into sentence-aware bounded chunks (with safe fallback splitting for an overlong sentence). Start playback as soon as the first chunk is ready, synthesize the next chunk with bounded one-chunk lookahead while the current chunk plays, preserve exact order, and continue through the entire reply without the ~30-second cutoff or long silent gaps.
  6. Preserve stop/mute/replay/new-message cancellation semantics: abort or ignore stale synthesis safely, stop current audio, revoke all object URLs, avoid unhandled rejections, and expose actionable errors without leaking provider details. Cover chunk boundaries, punctuation/abbreviations/long sentences, ordered playback, prefetch, full completion, cancellation, and chunk failure in dashboard tests.
  7. Update canonical docs under docs/ and matching docs-web pages for scheduler continuation guarantees and speech playback behavior. Validate with pnpm lint, relevant backend and dashboard tests, pnpm build, and a manual dashboard/TTS check on the approved local test project. Do not add dependencies.

✅ Task Checklist

  • T01: Bind agent wakeups to originating threads — codex (PR)
  • T02: Serialize scheduled continuation turns — codex (PR)
  • T03: Implement sentence-aware speech chunking — codex (PR)
  • T04: Add ordered prefetching TTS playback — codex (PR)
  • T05: Add cross-surface continuation and speech acceptance coverage — codex (PR)

👥 Provider Breakdown

5 by codex

⏱️ Sprint Timing

Started 2026-07-13 18:00:18 UTC
Finished 2026-07-13 18:38:02 UTC
Duration 37m 44s

📊 Aggregate CLI Token Usage

Metric Value
Input tokens 2,930,817
Cached input tokens 46,618,368
Output tokens 222,865
Total tokens 49,772,050
Invocations 23
Tool calls 540
Active time 1h 49m 3s

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

🕵️ QA Review Summary

Outcome: pass

Sprint integration is correct. Focused coverage, full dashboard tests, build, typechecks, and lint pass; the only backend failure requires unavailable Docker, and docs-check failures are unrelated baseline drift.

🌿 Branch Info

Base: dev
Head: feature/CODUX-219-fix-chat-continuations-and-tts-playback


🤖 Generated by Code UX

Code UX and others added 11 commits July 13, 2026 17:10
…ex-32e6d7af-mrjh2mcn

(CODUX-219) Implement sentence-aware speech chunking
…ex-a8c04fbf-mrjh2k1t

(CODUX-219) Bind agent wakeups to originating threads
…ex-10f24ecb-mrjh2l6j

(CODUX-219) Serialize scheduled continuation turns
…ex-dc59a37c-mrjht7zu

(CODUX-219) Add ordered prefetching TTS playback
…ex-9ccf5f1d-mrjicg1h

(CODUX-219) Add cross-surface continuation and speech acceptance coverage
@numnx
numnx merged commit 00e0104 into dev Jul 13, 2026
40 checks passed
@numnx
numnx deleted the feature/CODUX-219-fix-chat-continuations-and-tts-playback branch July 13, 2026 18:41
@numnx numnx mentioned this pull request Jul 14, 2026
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