Skip to content

fix: bound system TTS Speak with a process deadline - #10

Merged
steipete merged 3 commits into
openclaw:mainfrom
SebTardif:fix/tts-speak-deadline
Oct 7, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
SebTardif:fix/tts-speak-deadline

Conversation

@SebTardif

@SebTardif SebTardif commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

A hung system TTS child blocks later queued speech while the bridge stays connected. Add the opt-in -tts-system-timeout flag to bound one child and release the queue. The default remains 0 (unlimited), so healthy long utterances continue without a fixed cutoff. Queue/shutdown cancellation and the -- separator for spoken text remain in place.

The README documents the flag, its default, and how to choose a duration; the Unreleased changelog credits @SebTardif. Sebastien's original commit is retained.

Runtime proof

At head 9a8236dc760d183bbbf852071541b5fa4b362fd3, built and ran the production CLI on Linux amd64 / Go 1.27.1 against a synthetic loopback TCP bridge. The peer accepted hello, observed chat.subscribe, and sent two real chat-final frames. A synthetic -tts-system-command logged each child's start/completion without producing audio.

With -tts-system-timeout 200ms, the first child attempted a 60-second wait. It was killed, the CLI logged a TTS error, and the next queued utterance completed. With no timeout flag, a healthy 31-second child completed before the next utterance began, without a TTS error. Both clients exited successfully on SIGTERM. Temporary synthetic state was used throughout; no live account or speech hardware was involved.

CLI timeout=200ms: long child=60s; speech events=['start long', 'start next', 'done next']; next utterance complete after 0.22s; SIGTERM exit=0
CLI timeout=default 0: long child=31s; speech events=['start long', 'done long', 'start next', 'done next']; next utterance complete after 31.04s; SIGTERM exit=0

Validation: go mod verify, go test ./..., go test -race ./..., go build ./cmd/clawgo, and deadcode -test ./... using the CI-pinned v0.49.0 all passed. Independent Codex autoreview of the complete branch, with the production source supplied as context, found no actionable P0–P2 findings. Exact-head CI is green.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 10:42 PM ET / October 6, 2026, 02:42 UTC (Revision 11).

ClawSweeper review

What this changes

Adds an optional per-utterance deadline for system speech commands, with CLI documentation and regression coverage, while preserving unlimited playback by default.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main cannot time out a hung speech child while connected. The earlier healthy-speech cutoff concern is resolved, runtime proof covers recovery and default compatibility, and no actionable merge blocker was found.

Priority: P2
Reviewed head: 9a8236dc760d183bbbf852071541b5fa4b362fd3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, compatible implementation has convincing production-path proof and no blocking findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Exact-head Linux CLI output exercises the real bridge client, chat subscriber, speech queue, and subprocess owner: timed-out speech releases the next utterance, while default playback completes a healthy 31-second command. The synthetic executable targets process lifetime directly; audio hardware is unnecessary for this claim. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Exact-head Linux CLI output exercises the real bridge client, chat subscriber, speech queue, and subprocess owner: timed-out speech releases the next utterance, while default playback completes a healthy 31-second command. The synthetic executable targets process lifetime directly; audio hardware is unnecessary for this claim. No stored-data contract changes.
Evidence reviewed 6 items Introduced change: The pinned main-to-head delta adds the duration flag, passes it into the system speech engine, and derives a timeout context only for positive durations. Existing cancellation, argument separation, and subprocess wait handling remain intact.
Current-main necessity: Current main synchronously runs each speech child using the queue cancellation context, without a per-utterance deadline. Disconnect cancellation therefore does not resolve a hung child while the connection remains healthy.
After-fix production-path proof: The captured PR body identifies head 9a8236d and Linux amd64 / Go 1.27.1. The production CLI used its real TCP bridge client, received two chat-final frames, and launched a synthetic speech executable. A 200ms deadline interrupted a 60-second child and allowed the next utterance to complete after 0.22 seconds; default configuration completed a healthy 31-second child before advancing. Both runs exited successfully on SIGTERM. This proves queue recovery and unchanged default playback without requiring speech hardware.
Findings None None.
Security None None.

How this fits together

Clawgo is a headless node client that receives chat replies from a gateway bridge and queues them for local speech. Its system speech engine launches an external command for each utterance.

flowchart TD
 A[Gateway chat replies] --> B[Chat subscriber]
 B --> C[Speech queue]
 D[Operator timeout setting] --> E[System speech command]
 C --> E
 E --> F{Completed or timed out}
 F --> G[Next queued utterance]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +15/-4; tests +44/-1 The small production increase implements the opt-in deadline, with focused subprocess coverage.

Technical review

Best possible solution:

Keep unlimited speech as the default and let operators explicitly bound individual system speech commands without cancelling the queue.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the failure path: while the bridge remains connected, a nonterminating system speech child blocks the synchronous queue worker. The supplied after-fix CLI transcript demonstrates recovery; this review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes, the opt-in child deadline is a narrow solution that preserves healthy long playback and existing shutdown cancellation.

AGENTS.md: not found in the target repository.

Codex review notes: model internal, reasoning medium; reviewed against 9d0188637d96.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded reliability improvement for local speech playback, with existing default behavior preserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Exact-head Linux CLI output exercises the real bridge client, chat subscriber, speech queue, and subprocess owner: timed-out speech releases the next utterance, while default playback completes a healthy 31-second command. The synthetic executable targets process lifetime directly; audio hardware is unnecessary for this claim. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Exact-head Linux CLI output exercises the real bridge client, chat subscriber, speech queue, and subprocess owner: timed-out speech releases the next utterance, while default playback completes a healthy 31-second command. The synthetic executable targets process lifetime directly; audio hardware is unnecessary for this claim. No stored-data contract changes.

Evidence

What I checked:

  • Introduced change: The pinned main-to-head delta adds the duration flag, passes it into the system speech engine, and derives a timeout context only for positive durations. Existing cancellation, argument separation, and subprocess wait handling remain intact. (cmd/clawgo/main.go:1039, 9a8236dc760d)
  • Current-main necessity: Current main synchronously runs each speech child using the queue cancellation context, without a per-utterance deadline. Disconnect cancellation therefore does not resolve a hung child while the connection remains healthy. (cmd/clawgo/main.go:1034, 9d0188637d96)
  • After-fix production-path proof: The captured PR body identifies head 9a8236d and Linux amd64 / Go 1.27.1. The production CLI used its real TCP bridge client, received two chat-final frames, and launched a synthetic speech executable. A 200ms deadline interrupted a 60-second child and allowed the next utterance to complete after 0.22 seconds; default configuration completed a healthy 31-second child before advancing. Both runs exited successfully on SIGTERM. This proves queue recovery and unchanged default playback without requiring speech hardware. (9a8236dc760d)
  • Review continuity and compatibility: The earlier fixed-cutoff finding is resolved by the zero default and positive-duration guard. README documents choosing a duration long enough for healthy speech and using exec in custom wrappers. The latest completed review at this same head contains no findings; supplied validation reports full tests, race tests, build, module verification, and pinned deadcode checks passing. Those checks were not rerun during this read-only review. (README.md:72, 9a8236dc760d)
  • Canonical and release checks: The repository-wide PR listing identifies no merged replacement for the deadline capability. fix: stop treating TTS text as espeak flags #11 is merged but addresses leading-dash argument handling, a distinct behavior already preserved here. The release endpoint returned no releases, so no shipped timeout implementation was established.
  • Area history and routing: Current-main history records Sebastien Tardif's merged speech cancellation and argument-handling changes and Peter Steinberger's recent chat-subscription work. GitHub commit metadata verifies their handles as SebTardif and steipete. Historical blame and patch inspection encountered unavailable older blobs, so no source-line introduction attribution is asserted. (cmd/clawgo/main.go, 9d0188637d96)

Likely related people:

  • SebTardif: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-05T19:58:27.729Z sha e8df603 :: blocked before merge. :: [P1] Preserve healthy long speech instead of a fixed cutoff
  • reviewed 2026-09-17T12:57:01.526Z sha e8df603 :: blocked before merge. :: [P1] Preserve healthy long speech instead of a fixed cutoff
  • reviewed 2026-09-20T23:16:07.970Z sha 3878f65 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-30T05:01:57.681Z sha 9a8236d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-30T05:13:25.211Z sha 9a8236d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T17:14:25.476Z sha 9a8236d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T18:28:34.835Z sha 9a8236d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T23:45:47.176Z sha 9a8236d :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. and removed P2 Normal priority bug or improvement with limited blast radius. labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. and removed P1 Urgent regression or broken agent/channel workflow affecting real users now. labels Sep 17, 2026
Keep Speak(ctx) and espeak --. Default timeout 0 leaves healthy
speech unlimited. -tts-system-timeout bounds a hung child only
when the operator sets it.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif
SebTardif force-pushed the fix/tts-speak-deadline branch from e8df603 to 3878f65 Compare September 20, 2026 23:12
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper

Preserve healthy long speech instead of a fixed cutoff

Replay is on current main. Speak(ctx) and espeak -- stay. Default timeout is 0 (unlimited). -tts-system-timeout is opt-in. A 200ms timeout still kills a hung sleep 2 child. Timeout 0 lets sleep 0.15 finish.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. proof: sufficient Contributor real behavior proof is sufficient. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 20, 2026
@steipete
steipete requested a review from vincentkoc September 30, 2026 05:09
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: bound system TTS Speak with a process deadline This is item 1/1 in the current shard. Shard 0/1.

This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 69893d1 into openclaw:main Oct 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants