Skip to content

fix(ios): keep Watch voice replies and playback with their original turn - #135697

Merged
steipete merged 2 commits into
mainfrom
codex/watch-voice-reliability
Sep 2, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/watch-voice-reliability

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #135693

What Problem This Solves

Fixes an issue where Apple Watch voice turns could retain the wrong chat scope, attribute a reply to a neighboring turn, lose replacement speech controls, or resubmit a request that was still in flight on the iPhone.

Why This Change Was Made

Keep each voice turn and delivery attempt attached to its authoritative owner. Watch playback now uses the existing token-scoped system speech owner, chat changes retire the old turn and preview, and native input checks the scope captured when it opened. The phone matches authoritative run metadata and collected-input receipts, respects intervening user turns, and gives each pending request one active delivery owner without blocking unrelated messages behind reply observation.

History receipt requests use the existing optional Gateway contract. The old-Gateway downgrade is limited to its exact shipped unsupported-parameter error; authentication and other failures do not activate a fallback. Redundant speech delegates, metadata decoding, global flush gating, and forwarding/requeue branches are removed.

User Impact

Watch voice replies stay in the correct Gateway/chat and playback controls follow the current utterance. Queued delivery can make progress without duplicating an active send. The docs now distinguish phone-assisted Watch dictation/readback from iPhone realtime voice and the limited direct Watch node.

This PR does not add standalone Watch audio, durable terminal-reply custody, selected-agent identity, or explicit 90-second timeout outcomes; those remain separate work. Cancellation here stops local readback, not the Gateway run.

Evidence

The unchanged candidate passed 346 targeted executions:

  • 282 iPhone/model/transport and voice-tracker tests.
  • 48 shared request/codec/Watch-command tests.
  • 15 native watchOS operation tests.
  • 1 opt-in watchOS simulator speech test using actual native start/replacement/stop callbacks; the default skip is separately verified.

The pre-fix in-flight retry sequence observed A, B, B, A; the repaired test observes A, B, B while unrelated B continues to progress. The original native speech reproduction failed twice after replacement, then passed with the same driver against the shared owner. This proves duplicate submission prevention, not duplicate underlying agent execution.

Optimized generic iOS compilation succeeded with embedded Watch arm64 and arm64_32 targets. SwiftFormat passed for all 15 changed/new Swift files; canonical strict SwiftLint passed across 377 production files. Workflow checks, docs formatting/MDX, 7,205-link validation, glossary checks, and diff checks passed. Fresh Codex autoreview before commit completed with no accepted findings at the workflow's P0 threshold.

Commands

DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer xcodebuild   -project apps/ios/OpenClaw.xcodeproj -scheme OpenClaw -configuration Debug   -destination 'platform=iOS Simulator,id=044B902A-99FB-4EF6-B742-F7F4B257835B'   -derivedDataPath /tmp/openclaw-watch-voice-proof.uiRdBJ/DerivedData   -clonedSourcePackagesDirPath /tmp/openclaw-watch-voice-proof.uiRdBJ/SourcePackages   -jobs 4 CODE_SIGNING_ALLOWED=NO -parallel-testing-enabled NO   -only-testing:OpenClawTests/NodeAppModelInvokeTests   -only-testing:OpenClawTests/IOSGatewayChatTransportTests   -only-testing:OpenClawLogicTests/WatchVoiceTurnTrackerTests   -resultBundlePath /tmp/openclaw-watch-voice-proof.uiRdBJ/phone-final-green.xcresult test

Live verification and final checks

All 204 checks on head 05a9effe2d8b621b618cab4e3c4e8227f725fccd passed. The initial native-i18n failure was fixed by regenerating the native source inventory; no runtime behavior changed in that follow-up. Fresh pre-land Codex autoreview completed with no accepted findings at the workflow's P0 threshold.

The published [email protected] package was started with isolated state. Its real chat.history endpoint rejected inputRunIds with INVALID_REQUEST and exactly invalid chat.history params: at root: unexpected property 'inputRunIds'; the request without that field succeeded. This verifies the retained wire contract. Native tests separately cover the exact predicate, one-time downgrade, and scoped reply selection.

The unchanged, Simulator-signed iPhone app paired with the isolated Gateway, received three exact replies from the configured public provider, cleared Writing after each, and reopened the live Control overview using saved pairing. The task-local native XCTest driver executed one real test (38.886 seconds, no failures); it changed automation only, not the app. Earlier attempts exposed test-environment problems: a LAN/loopback mismatch, retained intro state, and restarting a Gateway after its hashed build chunks changed. The existing UI helper also tapped a starter instead of dismissing the keyboard. The successful driver verified each typed draft and tapped the actual Send control.

No physical Apple Watch is available on this host. The physical-Watch rank-up is therefore explicitly skipped, not claimed complete. Native Watch Simulator speech callbacks plus the live iPhone/Gateway/provider flow are the available behavior proof; they do not establish hardware dictation, WatchConnectivity radio delivery, wrist-down, roaming, or endurance. Local red/green logs and xcresults remain retained, not public artifact links.

Visual inspection also recorded an independent shared-chat follow-up: an extra unmetered first-reply bubble remains below later correct replies. This PR does not change that projection and does not claim to fix it. The screenshots below demonstrate actual phone replies and saved-pairing reconnect, not before/after Watch voice-race or hardware evidence.

Scope and risk

Production +299/-243 (net +56); tests +600/-52 (net +548); docs +50/-4; CI +3 selectors; generated native-i18n inventory +3/-1. Production growth buys the existing receipt contract and exact lifecycle ownership; the native-input helper extraction is primarily a move. No new configuration keys, persistent representation, or database schema changes. Existing persistence, deadlines, and the old-Gateway public compatibility contract remain unchanged.

Native phone proof

Real provider reply in the native iPhone app; stale first-reply bubble recorded separately

Live Control overview after app relaunch with saved pairing

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios size: XL maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete
steipete marked this pull request as ready for review September 2, 2026 00:11
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 8:34 PM ET / September 2, 2026, 00:34 UTC.

ClawSweeper review

What this changes

The PR ties Apple Watch dictation, reply matching, speech playback, and queued iPhone delivery to the original Gateway chat turn.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this maintainer-owned PR open for human review. The receipt-based matching and turn-scoped delivery address behavior still absent from current main, but the prior physical-Watch and old-Gateway compatibility rank-up evidence remains incomplete.

Priority: P2
Reviewed head: 05a9effe2d8b621b618cab4e3c4e8227f725fccd
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has focused owner-boundary coverage and no discrete correctness finding, while physical-device and old-Gateway proof remain outstanding.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-owned PR is exempt from the external-contributor proof gate; it supplies claimed simulator/native and focused regression results, but no public physical Watch-to-iPhone-to-Gateway after-fix artifact, which remains a merge-readiness risk rather than contributor action.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned PR is exempt from the external-contributor proof gate; it supplies claimed simulator/native and focused regression results, but no public physical Watch-to-iPhone-to-Gateway after-fix artifact, which remains a merge-readiness risk rather than contributor action.
Evidence reviewed 7 items Current main does not contain this repair: Current main retains the earlier reply-selection logic based on idempotency and timestamp/text fallback; the PR introduces input-consumption receipt matching and prevents crossing later user turns.
Delivery owner is repaired at the iPhone boundary: The new per-message in-flight owner prevents a retry drain from resending an active Watch request while allowing unrelated queued messages to proceed.
Gateway receipt contract exists in the target: The target protocol accepts bounded optional input run IDs and returns consumed-input receipts, which the PR projects into the native chat history payload.
Findings None None.
Security None None.

How this fits together

Apple Watch sends a one-turn dictation through its paired iPhone to Gateway chat, then displays and speaks the matching response. The iPhone delivery owner and Watch state store decide whether a response still belongs to the selected Watch chat.

flowchart LR
  A[Watch native dictation] --> B[Paired iPhone relay]
  B --> C[Gateway chat turn]
  C --> D[History input receipts]
  D --> E[Watch turn matcher]
  E --> F[Watch display and speech]
Loading

Decision needed

Question Recommendation
Is the available simulator and focused regression evidence sufficient to merge this maintainer-owned Watch workflow before physical-Watch and pre-v2026.8.2 fallback proof is attached? Require the two remaining proofs: Verify the exact old-Gateway fallback and attach a sanitized physical Watch-to-iPhone-to-Gateway voice-turn result before merge.

Why: The patch is source-consistent, but the PR itself records both evidence gaps and the previous review requested those same rank-up items.

Before merge

  • Resolve merge risk (P2) - The fallback for Gateways that reject inputRunIds relies on one exact validation message; its claimed pre-v2026.8.2 behavior has not been demonstrated against that Gateway version.
  • Resolve merge risk (P1) - The PR body documents that physical Watch-to-iPhone-to-Gateway evidence is still pending, so hardware dictation, paired relay, and lifecycle behavior are not yet independently demonstrated.
  • Resolve merge risk (P1) - Production code is net +56 lines in a bug fix; the added owner boundary appears justified, but it should remain limited to the receipt and lifecycle responsibilities demonstrated here.
Agent review details

Security

None.

PR surface

Docs +46, Config +3, Other +606. Total +655 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 50 4 +46
Config 1 3 0 +3
Generated 0 0 0 0
Other 16 902 296 +606
Total 19 955 300 +655

Review metrics

Metric Value Why it matters
Production versus regression coverage production +299/-243 (net +56); tests +600/-52 (net +548) The production growth replaces global queue gating and heuristic reply attribution with owner-bound receipt and lifecycle handling; the expanded tests cover the reported order and scope failures.
Gateway compatibility surface 1 optional history parameter added; 1 exact legacy fallback Existing remote Gateways can reject the new request field, so the fallback contract matters before merge.

Merge-risk options

Maintainer options:

  1. Prove the retained Gateway fallback (recommended)
    Exercise a pre-v2026.8.2 Gateway that rejects the added history parameter and show the Watch path retries without it while preserving scoped reply selection.
  2. Accept the legacy-Gateway limit
    Merge with the exact-error fallback as written and explicitly accept that the claimed legacy error contract was not demonstrated.

Technical review

Best possible solution:

Retain the receipt-based turn owner and single-message delivery model, then land only after the old-Gateway fallback and a physical Watch-to-paired-iPhone voice turn confirm the documented compatibility boundary.

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

Yes, source-reproducible: the linked report gives deterministic speech replacement, chat-switch, retry-order, and receipt-attribution sequences, and focused tests cover those boundaries. This read-only review did not execute them.

Is this the best way to solve the issue?

Yes for the source boundary: state is retired at chat identity changes, receipts replace heuristic attribution, and delivery ownership is per message rather than globally serialized. The remaining question is proof sufficiency for the old Gateway and physical Watch paths, not an identified alternative implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR fixes bounded Apple Watch turn ownership and duplicate-submission behavior without evidence of a broad runtime outage.
  • merge-risk: 🚨 compatibility: A newly sent optional Gateway history parameter depends on an exact legacy validation-error fallback for older remote Gateways.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-owned PR is exempt from the external-contributor proof gate; it supplies claimed simulator/native and focused regression results, but no public physical Watch-to-iPhone-to-Gateway after-fix artifact, which remains a merge-readiness risk rather than contributor action.

Evidence

What I checked:

Likely related people:

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

Rank-up moves

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

  • Capture a sanitized physical Watch-to-paired-iPhone-to-Gateway voice turn that includes either a chat switch or speech replacement.
  • Record the pre-v2026.8.2 chat.history rejection and the one-time fallback result.

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 (1 earlier review cycle)
  • reviewed 2026-09-02T00:21:15.717Z sha 9fdee17 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 942efd4 into main Sep 2, 2026
220 checks passed
@steipete
steipete deleted the codex/watch-voice-reliability branch September 2, 2026 01:22
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

[Bug]: Watch voice turns lose chat, playback, or delivery ownership

1 participant