Skip to content

feat(talk): add macOS realtime Gateway relay - #128204

Merged
vincentkoc merged 5 commits into
mainfrom
stack/realtime-relay-macos-l6c
Aug 23, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
stack/realtime-relay-macos-l6c

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Related: #71195
Related: #116201
Replaces: #118499

What Problem This Solves

macOS Talk could not use the bounded shared Apple Gateway realtime relay now landed on main. The original contributor PR #118499 was automatically closed when its stacked base branch was deleted, and its fork head does not allow maintainer edits, so it cannot complete the repository landing workflow.

This is the narrow macOS-only C layer. It deliberately does not reuse broader draft #119321, which combines additional settings and localization surfaces outside this layer.

Why This Change Was Made

The macOS app receives one pinned Gateway lease for config lookup, relay creation, and event subscription; explicit capture and output-route handling; bounded recovery; and a guarded native fallback. Realtime remains local-opt-in and activates only for a complete compatible provider/model/transport tuple. Native Talk remains the default.

The bootstrap request omits secret-bearing config. If the pinned realtime attempt fails, native fallback fetches the full Talk configuration lazily and commits it only after rechecking lifecycle, recognition, relay, startup, and session ownership. If native recognition also cannot start, the same owner boundary now publishes an idle terminal state and localized visible status instead of returning silently.

No Gateway protocol, shared Apple relay, iOS, Android, Web, dependency, SQLite, generated locale JSON, or .xcstrings contract changes are included.

User Impact

macOS users who explicitly enable Gateway realtime Talk get route-pinned microphone capture, bounded terminal recovery, and visible native fallback. Stale startup, route, recognition, and fallback work cannot overwrite the current Talk owner. The documented opt-in path names the actual Voice & Talk settings tab.

Evidence

Exact artifact

  • Base: 3a50b7a448c64472b956986d1bf23493595dc954
  • Head: 50cd2d0d134cf6dd527b1c757133959915cde9ab
  • Tree: 031b5dfc56ee2a030a98b9f62f6faf519ce49403
  • Aggregate patch ID: 272f9d33395fdf76de66da482358a9f15bbf0617
  • Binary diff SHA-256: b4116e475bc3fc07d05c4602e98147fa2ced13734840f92cf5e798ce137aa613

Source mapping from the closed contributor PR:

  • 6667f43c77ce9a003770e173ad751721598a03a4 -> e80c5a4050026b6f6eded063442a36e230e975eb
  • f983fb0e73672bbb1913a9ab7408842f5e4a9591 -> 3a7cf53cb214101f3fd12c484d9e8242debc2c82
  • b5aa4be8c157d06398f57679cdd7ad4539351ff2 -> 1251b54891b344d63bd91d23c54a983ac0097180
  • Exact-head review repair: 43bb10c7fd24dfd9e958300076ec32283d7ce6cf
  • Exact-head CI isolation repair: 50cd2d0d134cf6dd527b1c757133959915cde9ab

All five commits are signed and preserve Co-authored-by: Zhilong Zheng <[email protected]>.

Scope and LOC

  • macOS release runtime/source: +2401/-225
  • DEBUG-only capture-factory test support: +22/-2
  • substantive macOS tests: +2036/-102
  • docs: +69/-0
  • native source inventory: +110/-0

Verification

  • Exact-head focused macOS Gateway/capture/config/runtime suites: 82/82
  • Full Talk runtime suite after deterministic capture injection: 30/30 parallel, 30/30 serial, and 3 consecutive 30/30 runs
  • Native-fallback regression mutation: restoring the old silent return fails on the missing terminal transcript
  • SwiftFormat: clean
  • SwiftLint: clean
  • Native source inventory: 4,234 entries, changed=false
  • Docs config examples: 1,184 validated
  • Changed-scope classification: apps, docs
  • git diff --check: clean
  • Fresh exact-diff autoreview against current main: no actionable findings

The mechanical restack conflict regression initially failed Swift parsing because current-main recovery tests and C realtime tests shared an insertion point; the resolved tree preserves both suites. Hosted CI then exposed three full-bootstrap runtime tests constructing the physical microphone on a headless runner; the DEBUG-only runtime capture factory keeps release behavior unchanged while those tests now exercise the real bootstrap/lifecycle owner deterministically. Exact-head CI https://github.com/openclaw/openclaw/actions/runs/32644369167 passed on attempt 2 after rerunning only the unrelated src/agents/workspace.bootstrap-cache.test.ts shard; macos-swift passed on attempt 1. The exact-head ClawSweeper refresh is queued; the prior fresh review had no findings, and repository policy does not block landing on a queued publisher refresh.

Codex boundary

Personally checked current sibling openai/codex@e1831db7c31ec3ec3a88f29e95cc336858038bad:

  • codex-rs/app-server-protocol/src/protocol/v2/turn.rs:206-212 carries thread and turn identity.
  • codex-rs/app-server/src/request_processors/turn_processor.rs:1409-1453 treats an empty turn ID only as startup interruption; a non-empty ID must match the active turn and is acknowledged after TurnAborted.

Remaining proof

Rank-up moves: current Codex source inspection is complete. Exact-head physical Mac proof is explicitly skipped for this landing: no completed relay turn, audible microphone/speaker operation, clean restart, or speaker/headphone route change is claimed. Tests and hosted CI are not live-device proof. The maintainer accepts this scoped opt-in availability gap as follow-up evidence.

Release Note

macOS: add opt-in Gateway realtime Talk with pinned transport ownership, redacted bootstrap configuration, bounded recovery, visible terminal fallback failure, and native fallback. Thanks @zhilong1115.

@vincentkoc vincentkoc self-assigned this Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 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: macos App: macos size: XL maintainer Maintainer-authored PR labels Aug 23, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Replacement PR at exact head 1251b54891b344d63bd91d23c54a983ac0097180; the body contains the current artifact mapping, focused proof, and accepted physical-Mac proof gap. Tests and hosted CI are not represented as live-device proof.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 9:55 AM ET / 13:55 UTC.

ClawSweeper review

What this changes

Adds a default-off macOS Talk path that streams audio through a Gateway realtime relay, with native speech fallback and documented configuration.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer proof-sufficiency review. Static review found no discrete patch defect, but physical-Mac and directly inspected Codex-protocol evidence remain necessary for a merge decision.

Priority: P2
Reviewed head: 43bb10c7fd24dfd9e958300076ec32283d7ce6cf
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has substantial source and focused-test coverage, with unresolved protocol-source and physical-device evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate, though physical-Mac behavior remains a maintainer-visible availability gap.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate, though physical-Mac behavior remains a maintainer-visible availability gap.
Evidence reviewed 6 items Pinned relay ownership: The macOS bootstrap acquires one Gateway lease, reads redacted Talk config through that lease, and binds subsequent relay requests and events to it.
Fallback regression coverage: Focused tests cover stale fallback configuration, transition to native fallback, and the visible terminal state when native fallback cannot start.
Gateway contract: Current Gateway code accepts realtime sessions only with gateway-relay transport and agent-consult brain, matching the client tuple gate.
Findings None None.
Security None None.

How this fits together

macOS Talk captures speech and plays responses locally while the Gateway owns agent and realtime sessions. This adds an opt-in pinned relay between Mac audio I/O and the Gateway, falling back to native Talk when relay startup or recovery fails.

flowchart LR
  A[Voice and Talk toggle] --> B[Talk configuration]
  B --> C{Compatible realtime tuple}
  C -->|yes| D[Pinned Gateway relay]
  C -->|no| E[Native Talk]
  D --> F[Mac capture and playback]
  D -->|failure| E
  E --> G[Visible Talk state]
Loading

Decision needed

Question Recommendation
Is the available focused-test evidence sufficient to land this opt-in macOS relay before direct Codex-source and physical-Mac proof are available? Require source and device proof: Keep the PR open until direct Codex contract inspection and redacted physical-Mac relay, restart, and route-change evidence are available.

Why: The native fallback limits blast radius, but the changed path owns real audio hardware recovery and consumes a provider path explicitly tied to Codex realtime v3.

Before merge

  • Resolve merge risk (P1) - No exact-head physical-Mac evidence demonstrates microphone capture, audible playback, restart, and a speaker/headphone route transition.
  • Resolve merge risk (P1) - The Codex realtime-v3 contract is applicable but could not be directly inspected because the required sibling source checkout is unavailable.
  • Complete next step (P2) - A maintainer must decide whether the remaining Codex-contract and physical-device proof gaps are acceptable for this opt-in path.
Agent review details

Security

None.

PR surface

Docs +69, Other +4217. Total +4286 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 69 0 +69
Config 0 0 0 0
Generated 0 0 0 0
Other 17 4544 327 +4217
Total 18 4613 327 +4286

Review metrics

Metric Value Why it matters
Production versus test delta production +2,176/-225; tests +2,033/-102; docs/inventory +179/-0 A substantial new native audio lifecycle makes end-to-end device evidence material before merge.

Merge-risk options

Maintainer options:

  1. Add protocol and device proof (recommended)
    Verify the Codex protocol source and demonstrate the exact-head relay, restart, and output-route behavior before merge.
  2. Accept opt-in availability risk
    Land with native Talk still the default and retain explicit follow-up ownership for the proof gaps.

Technical review

Best possible solution:

Validate the GPT-Live contract against the Codex source and attach a redacted physical-Mac relay, restart, and route-transition run before landing the opt-in path.

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

Not applicable as a defect report; this is a new capability, and the open evidence gap is an after-fix physical-Mac demonstration.

Is this the best way to solve the issue?

Unclear; the implementation follows the existing Gateway and shared Apple relay seams, but direct protocol and device evidence is still needed to establish it as the best safe landing path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is an explicitly opt-in macOS capability rather than a default-path regression.
  • merge-risk: 🚨 availability: The relay takes ownership of capture, playback, restart, and output-route recovery without exact-head physical-Mac proof.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate, though physical-Mac behavior remains a maintainer-visible availability gap.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Authored the current integration and the shared Apple relay lifecycle precursor on current main. (role: recent area contributor; confidence: high; commits: 057ed79f96e0, 43bb10c7fd24; files: apps/shared/OpenClawKit/Sources/OpenClawKit/RealtimeTalkRelaySession.swift, apps/macos/Sources/OpenClaw/TalkModeRuntime+Realtime.swift)
  • Peter Steinberger: Current-main blame attributes the OpenAI GPT-Live Codex realtime-v3 handshake declaration to this area’s recent history. (role: adjacent provider-protocol contributor; confidence: medium; commits: 2175a1502099; files: extensions/openai/realtime-quicksilver-wire.ts)

Rank-up moves

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

  • Inspect the corresponding Codex protocol source directly.
  • Attach redacted physical-Mac proof of a completed relay turn, restart, and output-route transition.

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 (3 earlier review cycles)
  • reviewed 2026-08-23T12:01:37.669Z sha 1251b54 :: needs changes before merge. :: [P1] Surface native fallback startup failures | [P3] Correct the macOS settings path
  • reviewed 2026-08-23T12:09:45.115Z sha 1251b54 :: found issues before merge. :: [P1] Publish a terminal state when native fallback cannot start | [P3] Use the actual Voice & Talk settings path
  • reviewed 2026-08-23T12:29:07.145Z sha 43bb10c :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 23, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head moved to 43bb10c7fd24dfd9e958300076ec32283d7ce6cf. The prior P1 now publishes a localized idle terminal state when relay and native recognition both fail, with a mutation-backed regression; the P3 settings path now names Voice & Talk. The body contains current proof and the explicitly accepted physical-Mac proof gap.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. 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 P1 High-priority user-facing bug, regression, or broken workflow. 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 23, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 23, 2026 13:44
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 23, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head moved to 50cd2d0d134cf6dd527b1c757133959915cde9ab. Hosted CI exposed the three full-bootstrap tests constructing a physical microphone on a headless runner; the narrow DEBUG-only capture factory leaves release behavior unchanged and the full runtime suite is now 30/30 in parallel, serial, and three consecutive focused runs. The PR body contains current artifact/proof data and the explicitly accepted physical-Mac proof gap; tests and hosted CI are not represented as live-device proof.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit 000db97 into main Aug 23, 2026
265 of 267 checks passed
@vincentkoc
vincentkoc deleted the stack/realtime-relay-macos-l6c branch August 23, 2026 14:30
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
* feat(talk): add macOS realtime relay transport

Co-authored-by: Zhilong Zheng <[email protected]>

* feat(talk): integrate realtime relay with macOS Talk

Co-authored-by: Zhilong Zheng <[email protected]>

* fix(talk): keep realtime bootstrap config redacted

Co-authored-by: Zhilong Zheng <[email protected]>

* fix(talk): surface failed native fallback

Co-authored-by: Zhilong Zheng <[email protected]>

* test(talk): inject deterministic relay capture

Co-authored-by: Zhilong Zheng <[email protected]>

---------

Co-authored-by: Zhilong Zheng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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.

1 participant