Skip to content

Voice: first-come-first-served speech queue, keep endings whole (0.33.0) - #44

Merged
DowLucas merged 1 commit into
mainfrom
fix/voice-queue-and-endings
Oct 8, 2026
Merged

DowLucas merged 1 commit into
mainfrom
fix/voice-queue-and-endings

Conversation

@DowLucas

@DowLucas DowLucas commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Why

Two reports: voices of several sessions overriding each other when sessions finish at the same time, and the end of the audio being cut off.

Bugs found

Queueing

  1. Speech silently dropped. _ds_voice_with_lock gave up after 120 s (flock -w 120 … || exit 0; the macOS loop after 400 × 0.3 s). Each turn holds the lock for a Gemini summary (up to 10 s) plus the speech itself, so with 3–4 sessions finishing together the later replies were lost without a trace.
  2. Talked over on macOS. The mkdir lock was taken over when its directory was older than 2 minutes. A long explanation (up to ~3 min) reaches that, so a waiter started speaking on top of it. Reproduced in a test: an old-but-live holder was taken over immediately (waited=0s).
  3. Summaries fetched while holding the lock. speak.sh asked for the reply summary inside its turn, so every waiting session also waited on the others' API calls (which made bug 1 worse).
  4. No ordering. flock wakes waiters in no particular order.

Endings
5. Partial downloads played. _ds_voice_server_fetch only looked at %{http_code}, which arrives with the headers. A transfer cut short by --max-time still reported 200 and the truncated WAV was played. Reproduced with a fake curl that exits 28 after a 200.
6. No margin at the end for outputs that close the stream early. The server now pads (DowLucas/devscope#92); here every piece but the last asks for pad_ms: 0, so long speech runs on with no added pauses.

What changed

  • Ticket queue: each speaker writes queue/<ns>-<pid>. The oldest ticket whose process is alive speaks next, under the lock, so overlap is impossible. There is no fixed timeout: a turn is dropped only after 15 minutes (DS_VOICE_QUEUE_MAX_WAIT) or if its process died, and dead tickets are pruned.
  • macOS lock: the holder's pid is written into speak.lock.d, and the lock is taken over only when that pid is gone (or no pid appeared within a minute). stop now removes the directory with rm -rf.
  • Reply summaries are fetched before queueing. The voice bar no longer shows a "summarizing" phase; the mod copes.
  • curl must exit 0 as well as return 200 audio/*; otherwise the fetch is retried, then falls back as before.
  • Version 0.33.0 in both manifests; CHANGELOG and CLAUDE.md updated.

Testing

tests/voice/run.sh: 166 passed, 0 failed (12 new):

  • 4 sessions finishing 0.3 s apart with 1.5 s of speech each: all 4 spoken, never two at once, in finish order. Run with flock and with the macOS lock (DS_VOICE_NO_FLOCK=1).
  • A dead process's ticket doesn't block.
  • macOS lock: an old but live holder is waited for; a dead one is taken over.
  • A complete download plays; a 200 cut short is rejected.
  • Long speech: pad_ms: 0 on every piece but the last.

Against the old scripts (only the test hooks grafted on), the macOS talk-over, the partial download and the padding checks fail as expected. The ordering check fails there too, but because the old code summarised late, not because of flock order, so I don't count it as proof of bug 4.

Other suites (agents, errors, hints, queue, recall, usage, hooks consistency) pass.

Not changed

Announcements (timer path) still request their sentence inside the turn. They are short, and batching three or more into one sentence keeps that bounded.

🤖 Generated with Claude Code

…(0.33.0)

- Speakers take a ticket and the oldest live one speaks next; no 120 s
  give-up, so sessions finishing together are all heard, in order. A turn is
  dropped only after 15 minutes or when its process died.
- macOS mkdir lock is taken over only when its holder is dead, never by age,
  so long explanations are no longer talked over.
- Reply summaries are fetched before waiting for a turn.
- A download cut short after its 200 headers is not played.
- pad_ms 0 for all but the last piece of long speech.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 70461a8e-3a84-4dd5-8182-b6e371e6e6bb
📥 Commits

Reviewing files that changed from the base of the PR and between f22d750 and 26ed364.

📒 Files selected for processing (8)
  • .claude-plugin/marketplace.json
  • .claude-plugin/plugin.json
  • CHANGELOG.md
  • CLAUDE.md
  • scripts/voice/cli.sh
  • scripts/voice/lib.sh
  • scripts/voice/speak.sh
  • tests/voice/run.sh
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DowLucas
DowLucas merged commit 2a43fb6 into main Oct 8, 2026
12 checks passed
@DowLucas
DowLucas deleted the fix/voice-queue-and-endings branch October 8, 2026 12:51
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