Skip to content

fix(ios): use configured speech language for system voice - #113372

Merged
steipete merged 8 commits into
openclaw:mainfrom
metaforismo:codex/fix-ios-talk-speech-locale
Jul 28, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
metaforismo:codex/fix-ios-talk-speech-locale

Conversation

@metaforismo

@metaforismo metaforismo commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #113319

What Problem This Solves

Fixes an issue where iOS Talk/Wake users who selected a Speech Language would still hear the default system voice when ElevenLabs was unavailable or gateway speech fell back locally. Locale-specific directives such as tr-TR were also discarded before native speech playback.

Why This Change Was Made

The iOS Talk pipeline now keeps the provider's two-letter language code separate from the BCP 47 locale accepted by the system voice. Native synthesis consistently resolves language in directive, local setting, then gateway-config order across full-response and incremental playback. Each candidate is checked against voices available through Apple's API, so an unavailable directive or local locale cannot mask a valid lower-priority choice; Apple's device-default voice is used only after every candidate fails. Provider routing is unchanged.

Maintainer decision: accept the expanded talk.speechLocale contract for upgraded iOS users. A configured locale should intentionally control native system-voice fallback when a matching voice is available, while retaining the device default when none is available.

User Impact

iOS users can select a language such as Turkish and have Talk's native fallback choose the matching available system voice instead of silently reverting to the device default. Inline response directives can still override that configured locale for one response, while unavailable directives fall through safely.

Evidence

Final head: 52b4d8a543b178948ae174d2ef4047fb9e19ef06

  • the installed Xcode 27 AVSpeechSynthesis.h documents BCP 47 input, nil for an invalid language, and system-default behavior when no voice is set;
  • regression coverage includes directive, local, and gateway precedence; BCP 47 normalization; unavailable directive to local fallback; unavailable directive and local to gateway fallback; device-default fallback; and provider/system language separation;
  • prior exact-head simulator validation passed 75/75 tests across TalkSpeechLocaleTests, TalkGatewaySpeechClientTests, TalkModeIncrementalSpeechBufferTests, and TalkModeManagerTests;
  • config-help regression suite passed 24/24; SwiftFormat, SwiftLint, Oxfmt, native i18n verification, and git diff --check passed;
  • fresh Codex autoreview of the exact current-main merged 10-file tree reports no accepted/actionable findings and 0.93 confidence;
  • hosted exact-head CI for 52b4d8a543b178948ae174d2ef4047fb9e19ef06 is tracked separately by the PR checks.

The separate native-transport provider-routing and occasional-silence report remains tracked in #113321 and is intentionally not folded into this locale-only fix.

AI-assisted: yes. Codex inspected the issue, full and incremental code paths, sibling platform/shared-synth ownership, Apple dependency contract, tests, docs, and current main; then refreshed the branch and structured review. The maintainer reviewed the final diff and accepted the compatibility decision above.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios gateway Gateway runtime size: S labels Jul 24, 2026
@metaforismo
metaforismo marked this pull request as ready for review July 24, 2026 17:07
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. labels Jul 24, 2026
@clawsweeper

clawsweeper Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 10:57 AM ET / 14:57 UTC.

ClawSweeper review

What this changes

The branch makes iOS Talk’s native Apple speech fallback select an installed BCP 47 voice from response directives, local selection, or the existing Gateway talk.speechLocale setting.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for maintainer review. The branch appears to address the linked iOS locale defect with focused precedence and unavailable-voice fallback coverage, but it intentionally expands the behavior of an existing stored setting and the current head still needs a merge/CI refresh against main.

Priority: P2
Reviewed head: 52b4d8a543b178948ae174d2ef4047fb9e19ef06
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and regression-covered, with a maintainer compatibility decision and merge-head refresh remaining before it is landable.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR has the proof: sufficient label and reports exact-head iOS simulator tests covering the changed fallback behavior; a refreshed merge-head run should still be required because the branch is behind main.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR has the proof: sufficient label and reports exact-head iOS simulator tests covering the changed fallback behavior; a refreshed merge-head run should still be required because the branch is behind main.
Evidence reviewed 5 items Linked user problem: The linked report gives a concrete native-fallback scenario: configured Turkish recognition locale, no cloud TTS credentials, and Apple speech continuing with the device-default voice. This branch is explicitly the candidate fix for that report.
Locale fallback behavior: The branch adds ordered directive, local, and Gateway locale resolution and only returns the device default after no candidate has an available AVSpeechSynthesisVoice; focused tests cover unavailable higher-priority candidates falling through.
Configuration contract: The branch updates config help, exported type documentation, and user docs to state that talk.speechLocale also affects iOS system-voice fallback, making the compatibility change explicit rather than hidden.
Findings None None.
Security None None.

How this fits together

iOS Talk combines response directives, local device preferences, and Gateway Talk configuration before selecting either provider speech or Apple’s on-device synthesizer. The changed path resolves an available Apple voice locale for native fallback playback while leaving provider routing unchanged.

flowchart LR
  A[Response directive] --> D[Speech locale resolution]
  B[Local Talk setting] --> D
  C[Gateway Talk config] --> D
  D --> E[Installed Apple voice check]
  E --> F[Native system voice]
  G[Provider speech route] --> H[Talk audio playback]
  F --> H
Loading

Decision needed

Question Recommendation
Should existing talk.speechLocale values intentionally control iOS native system-voice fallback when a matching Apple voice is installed? Accept the expanded locale contract: Treat talk.speechLocale as the iOS native fallback voice preference, preserving device-default behavior only when no candidate Apple voice is installed.

Why: The branch fixes the reported speech-language defect by broadening an existing documented setting’s effect for already configured users; that upgrade behavior is a product compatibility decision, not a mechanical correction.

Before merge

  • Resolve merge risk (P2) - An existing stored talk.speechLocale value will now change iOS native fallback playback after upgrade, from the device-default voice to an installed matching voice.
  • Resolve merge risk (P1) - The branch is behind current main; required checks should validate the refreshed merge result before landing.
Agent review details

Security

None.

PR surface

Source 0, Docs 0, Other +159. Total +159 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 2 2 2 0
Tests 0 0 0 0
Docs 3 3 3 0
Config 0 0 0 0
Generated 0 0 0 0
Other 5 236 77 +159
Total 10 241 82 +159

Review metrics

Metric Value Why it matters
Config behavior 1 existing setting broadened talk.speechLocale gains iOS native system-voice fallback behavior for stored configurations, so upgrade intent must be explicit.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #113319
Summary: This PR is the implementation candidate for the reported iOS native system-voice locale defect; the related provider-routing report remains a distinct problem.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Confirm and retain the upgrade behavior (recommended)
    Approve the broadened locale contract, rebase onto current main, and require the exact-head iOS checks to cover the merge result before landing.
  2. Keep the prior recognition-only contract
    Pause or close this change and pursue a separately approved opt-in voice-locale surface if existing settings must not alter native fallback playback.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase onto current main and require the refreshed iOS build and focused locale tests to pass on the exact merge head.

Technical review

Best possible solution:

Accept the documented expansion of talk.speechLocale only if maintainers want it to be the iOS native fallback voice preference for upgraded users, then refresh the branch and land with the existing precedence and unavailable-voice regression coverage intact.

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

Yes in source, with medium confidence: the linked report supplies a concrete iOS native-fallback path and the branch adds deterministic coverage for directive, local, Gateway, unavailable-voice, and device-default selection. This read-only review did not independently run an iOS simulator.

Is this the best way to solve the issue?

Unclear until maintainer intent is confirmed: reusing the existing documented locale setting is the narrowest implementation and avoids a new option, but it deliberately changes upgraded-user fallback behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 206f989069fb.

Labels

Label justifications:

  • P2: The change addresses a bounded iOS Talk playback defect that affects users selecting non-default speech languages.
  • merge-risk: 🚨 compatibility: Existing configured locale values change Apple native fallback voice selection after upgrade.
  • 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): The PR has the proof: sufficient label and reports exact-head iOS simulator tests covering the changed fallback behavior; a refreshed merge-head run should still be required because the branch is behind main.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR has the proof: sufficient label and reports exact-head iOS simulator tests covering the changed fallback behavior; a refreshed merge-head run should still be required because the branch is behind main.

Evidence

What I checked:

  • Linked user problem: The linked report gives a concrete native-fallback scenario: configured Turkish recognition locale, no cloud TTS credentials, and Apple speech continuing with the device-default voice. This branch is explicitly the candidate fix for that report. (apps/ios/Sources/Voice/TalkModeManager.swift:2914, 52b4d8a543b1)
  • Locale fallback behavior: The branch adds ordered directive, local, and Gateway locale resolution and only returns the device default after no candidate has an available AVSpeechSynthesisVoice; focused tests cover unavailable higher-priority candidates falling through. (apps/ios/Sources/Voice/TalkSpeechLocale.swift:46, 52b4d8a543b1)
  • Configuration contract: The branch updates config help, exported type documentation, and user docs to state that talk.speechLocale also affects iOS system-voice fallback, making the compatibility change explicit rather than hidden. (src/config/types.gateway.ts:109, 52b4d8a543b1)
  • Prior review continuity: The previous completed ClawSweeper review found no actionable patch defects after the unavailable-voice and config-comment review threads were resolved; the current head is a subsequent synchronization commit by steipete. (apps/ios/Tests/TalkSpeechLocaleTests.swift:38, 52b4d8a543b1)
  • Current review gate: The supplied PR state reports the branch as mergeable but behind main, with ios-build still in progress and two prior macOS/iOS jobs cancelled after useful native build or test work. Refreshing the exact merge result and required checks remains appropriate before landing. (52b4d8a543b1)

Likely related people:

  • steipete: steipete is assigned to this PR and authored the current head synchronization commit, making them the clearest available routing contact for the current iOS Talk decision. (role: recent area contributor; confidence: medium; commits: 52b4d8a543b1; files: apps/ios/Sources/Voice/TalkModeManager.swift, apps/ios/Sources/Voice/TalkSpeechLocale.swift)
  • Solvely-Colin: Their resolved review identified the unavailable-voice masking case and requested the testable availability-based fallback now present in the branch. (role: reviewer; confidence: medium; commits: 253e4d5cbd60; files: apps/ios/Sources/Voice/TalkSpeechLocale.swift, apps/ios/Tests/TalkSpeechLocaleTests.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm that existing talk.speechLocale settings should control iOS native fallback voices after upgrade.
  • Refresh the branch onto current main and verify required iOS checks on the exact merge head.

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 (7 earlier review cycles)
  • reviewed 2026-07-24T17:11:55.036Z sha cb2936097c87682a28737034792fa8a505706be3 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-25T21:45:02.650Z sha 4943e5a695e03915e68c3f73fda1a0700beb30e9 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T01:08:19.738Z sha 8ffee47 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T01:59:03.773Z sha 8ffee47 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T13:38:35.279Z sha 9c7698f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-27T22:08:43.694Z sha 477f549 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-28T02:26:48.472Z sha 477f549 :: needs maintainer review before merge. :: none

@metaforismo
metaforismo force-pushed the codex/fix-ios-talk-speech-locale branch from cb29360 to fe490ce Compare July 24, 2026 20:14

@Solvely-Colin Solvely-Colin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two author-actionable findings from the maintainer pass.

Comment thread src/config/schema.help.core.ts Resolved
@metaforismo
metaforismo force-pushed the codex/fix-ios-talk-speech-locale branch from 4943e5a to 8ffee47 Compare July 27, 2026 01:02
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jul 27, 2026
@metaforismo

Copy link
Copy Markdown
Contributor Author

Final-head CI update for 8ffee473e:

ios-build passed, including release screenshot generation and artifact upload.

macos-swift passed all 1,489 Swift tests; GitHub cancelled only the post-test cache upload at the 20-minute job limit.

The remaining shared Node failure is unrelated to this PR: src/secrets/runtime.auth-migration-isolation.test.ts timed out at 120 seconds after 709 other tests passed. This PR does not touch src/secrets.

I attempted a targeted rerun, but GitHub requires repository admin rights. A maintainer rerun should clear the two infrastructure-only conclusions.

CI run: https://github.com/openclaw/openclaw/actions/runs/30228829400

…eech-locale

# Conflicts:
#	apps/.i18n/native-source.json
@metaforismo

Copy link
Copy Markdown
Contributor Author

Refreshed once onto current main at 9c7698f24. The intended 10-file diff is unchanged; native i18n verification and git diff --check pass, and final whole-branch Codex autoreview reports no findings with 0.91 confidence. Fresh exact-head CI is running and replaces the earlier unrelated timeout conclusions. The remaining gate is the maintainer compatibility decision for existing talk.speechLocale settings.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 27, 2026
@metaforismo

metaforismo commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Exact-head CI update for 9c7698f:\n\nThe iOS app build and focused lifecycle simulator tests passed. GitHub cancelled the job later during release screenshot capture. The macOS release build and OpenClawKit tests also passed; GitHub cancelled the job during the broader Swift test step.\n\nThe red CI gate only reflects those two cancellations. I attempted a failed-job rerun, but GitHub requires repository admin rights. A maintainer rerun is the remaining CI action.\n\nRun: https://github.com/openclaw/openclaw/actions/runs/30270769815

…eech-locale

# Conflicts:
#	apps/.i18n/native-source.json
@metaforismo

metaforismo commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Refreshed the conflict-resolved branch onto current main at head 477f549fd. The intended 10-file feature diff is unchanged. The regenerated native i18n inventory verifies clean with 5,317 entries, git diff --check and the secret scan pass, and exact final-branch Codex autoreview reports no findings with 0.88 confidence.

Completed exact-head CI evidence:

  • 87 checks passed
  • the iOS app build and focused lifecycle simulator tests passed
  • the only cancelled step was release-screenshot capture after a watch simulator stalled during boot; the screenshot evidence artifact still uploaded successfully
  • the overall openclaw/ci-gate is red only because that job was cancelled

The branch has no compile or test failure. A maintainer rerun and the compatibility decision on using the existing talk.speechLocale setting for iOS native fallback voice selection are the remaining gates.

@clawsweeper clawsweeper Bot removed the rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. label Jul 27, 2026
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Jul 27, 2026
@steipete steipete self-assigned this Jul 28, 2026
@metaforismo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete
steipete merged commit 430de22 into openclaw:main Jul 28, 2026
261 of 267 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
…224005-host

* origin/main: (72 commits)
  fix: macOS-only Parallels smoke harness regression (#75293)
  fix(ios): use configured speech language for system voice (#113372)
  refactor: centralize isolated agent test ownership (#115340)
  test(ui): stabilize browser route readiness (#115320)
  fix(cron): clear automation after failed scheduler shutdown (#115316)
  fix: keep isolated gateway workspaces and skills inside state dir (#114487)
  docs: document local TTS on macOS, Linux, and Windows (#110230)
  fix(tasks): clone only the requested task page (#114277)
  fix(agents): prevent Code Mode resume loss and unbounded preparation (#115314)
  fix(process): preserve the first process cancellation reason (#115317)
  fix(nostr): report unavailable ingress when queue open fails (#115313)
  fix: prevent Slack and Feishu ingress startup leaks (#115295)
  fix(slack): avoid unsafe emphasis boundaries (#111575)
  fix: prevent changed checks from expanding into full lint (#115322)
  fix(codex): stabilize prompts and expose real cache regressions (#115238)
  refactor(ui): derive page route specs from the route table (#115214)
  fix(compaction): plan cut points in trigger units (#111886) (#115309)
  fix: prevent cron and gateway stress-run timeouts (#115241)
  fix(ci): validate frozen Matrix QA targets (#115298)
  test(macos): block real process fallthrough (#113337)
  ...

# Conflicts:
#	CHANGELOG.md
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
…13372)

* fix(ios): honor speech locale for system voice

* chore(ios): refresh talk locale i18n inventory

* fix(ios): fall through unavailable system voices

* chore(ios): refresh talk locale i18n inventory

---------

Co-authored-by: Colin Johnson <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
…afea23-host

* origin/main: (72 commits)
  fix: macOS-only Parallels smoke harness regression (openclaw#75293)
  fix(ios): use configured speech language for system voice (openclaw#113372)
  refactor: centralize isolated agent test ownership (openclaw#115340)
  test(ui): stabilize browser route readiness (openclaw#115320)
  fix(cron): clear automation after failed scheduler shutdown (openclaw#115316)
  fix: keep isolated gateway workspaces and skills inside state dir (openclaw#114487)
  docs: document local TTS on macOS, Linux, and Windows (openclaw#110230)
  fix(tasks): clone only the requested task page (openclaw#114277)
  fix(agents): prevent Code Mode resume loss and unbounded preparation (openclaw#115314)
  fix(process): preserve the first process cancellation reason (openclaw#115317)
  fix(nostr): report unavailable ingress when queue open fails (openclaw#115313)
  fix: prevent Slack and Feishu ingress startup leaks (openclaw#115295)
  fix(slack): avoid unsafe emphasis boundaries (openclaw#111575)
  fix: prevent changed checks from expanding into full lint (openclaw#115322)
  fix(codex): stabilize prompts and expose real cache regressions (openclaw#115238)
  refactor(ui): derive page route specs from the route table (openclaw#115214)
  fix(compaction): plan cut points in trigger units (openclaw#111886) (openclaw#115309)
  fix: prevent cron and gateway stress-run timeouts (openclaw#115241)
  fix(ci): validate frozen Matrix QA targets (openclaw#115298)
  test(macos): block real process fallthrough (openclaw#113337)
  ...

# Conflicts:
#	CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

iOS native Talk/Wake TTS ignores configured Speech Language — Turkish read with en-US voice (AVSpeechSynthesizer locale not set)

3 participants