Repository navigation
feat: unify Talk session runtime - #77929
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: not applicable. for the feature as a whole; yes for the blockers by source inspection of current main and the downloaded PR head diff. Current main exposes the old RPCs and VoiceClaw endpoint, while the PR removes them without an adapter path visible in the changed handlers. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the unified Talk architecture direction, but preserve or version existing public RPCs and the VoiceClaw endpoint, then add live Gateway/client proof for the changed managed-room and voice paths before merge. Do we have a high-confidence way to reproduce the issue? Not applicable for the feature as a whole; yes for the blockers by source inspection of current main and the downloaded PR head diff. Current main exposes the old RPCs and VoiceClaw endpoint, while the PR removes them without an adapter path visible in the changed handlers. Is this the best way to solve the issue? No, not yet. The shared runtime may be the right end state, but the current patch needs compatibility or explicit versioning for removed public surfaces plus live behavior proof before it is a maintainable merge candidate. Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c744b2c236b2. |
e070905 to
6057d0e
Compare
4b126f1 to
bec56c5
Compare
6ff09e8 to
b1d225b
Compare
efc96b4 to
4883e39
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efc96b446f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export const talkHandlers: GatewayRequestHandlers = { | ||
| ...talkSessionHandlers, | ||
| ...talkClientHandlers, | ||
| "talk.catalog": async ({ params, respond, context }) => { |
There was a problem hiding this comment.
Preserve legacy Talk RPC aliases during migration
This handler table now exposes only talk.session.*/talk.client.* methods, so legacy RPC names (for example talk.realtime.session and talk.realtime.relay*) no longer resolve at all. Existing callers that haven't migrated yet will receive method-not-found instead of a compatibility path, which is a breaking protocol change on the gateway surface. Add alias handlers that forward old method names to the new implementation (or explicitly version-gate the break) before removing the old names.
Useful? React with 👍 / 👎.
| }); | ||
| } | ||
| forgetUnifiedTalkSession(params.sessionId); | ||
| respond(true, { ok: true }, undefined); |
There was a problem hiding this comment.
Evict unified session entries on automatic session shutdown
Unified session records are removed only in talk.session.close, but relay/transcription/handoff sessions can also terminate asynchronously (TTL expiry, provider error, disconnect-driven cleanup). In those paths, the underlying session is gone while the unified registry entry remains, so the map grows indefinitely over time and stale sessionIds keep failing with runtime errors. Wire unified-registry cleanup into non-RPC shutdown paths too, not just explicit close calls.
Useful? React with 👍 / 👎.
|
Landed via rebase onto
Thanks @steipete. |
|
Hi @steipete, I’d like to discuss something regarding mobile. If you’re free, can we connect on Telegram? |
Summary
This PR unifies the Talk/voice stack around one Gateway-owned Talk session model.
talk.session.*RPCs, provider capability metadata, browser relay/WebRTC/provider-WebSocket adapters, native managed-room handoff, and telephony/meeting adapters over the same contract.Unified Talk API
talk.session.*is the Gateway-managed API. The Gateway owns lifecycle, correlation, cancellation, and close semantics for these modes:realtimegateway-relayagent-consulttranscriptiongateway-relaynonestt-ttsmanaged-roomagent-consultstt-ttsmanaged-roomdirect-toolsCurrent RPC surface:
talk.session.create: creates a Gateway-owned session and returnssessionId, mode, transport, brain, audio/room metadata, and any handoff token needed for room join.talk.session.join: joins a managed-room session with the bearer token and establishes the active room connection.talk.session.appendAudio: appends PCM/audio frames for realtime/transcription relay sessions owned by the same connection.talk.session.startTurn,talk.session.endTurn,talk.session.cancelTurn: controls managed-room turns; these now require the active joined connection, not just knowledge of the session id.talk.session.cancelOutput: cancels realtime relay output for barge-in/output interruption.talk.session.submitToolResult: completes realtime relay tool calls.talk.session.close: stops relay sessions or revokes managed-room handoff state, broadcasts terminal close events to active clients, and forgets the unified session id.The shared event contract is the spine:
session.started,session.ready,session.replaced,session.closed,turn.started,turn.ended,turn.cancelled, speech/transcript/audio/tool/agent events all flow astalk.eventwith session/turn/correlation metadata.Compatibility / Migration
Compatibility adapters kept for this PR:
talk.realtime.sessionfor browser-owned WebRTC/provider-WebSocket sessions and existing browser relay entry points.talk.realtime.relay*for current Control UI relay clients.talk.transcription.*for transcription relay clients.talk.handoff.*for first-party/native handoff clients.Config migration is doctor-owned. Legacy speech
talk.providerremains speech/TTS config; realtime settings move through explicittalk.realtime/provider config migration rather than startup-time reinterpretation.instructionsOverrideis intentionally not preserved. Realtime instructions are server-owned policy now.Behavior Changes
session.closedevent to the active room client.Important Paths
src/gateway/server-methods/talk-session.ts,src/gateway/server-methods/talk.ts,src/gateway/talk-realtime-relay.ts,src/gateway/talk-handoff.ts,src/gateway/talk-transcription-relay.ts.src/talk/talk-events.ts,src/talk/talk-session-controller.ts,src/talk/provider-types.ts,src/plugin-sdk/realtime-voice.ts.ui/src/ui/chat/realtime-talk-shared.ts,ui/src/ui/chat/realtime-talk-gateway-relay.ts,ui/src/ui/chat/realtime-talk.ts.apps/android/app/src/main/java/ai/openclaw/app/voice/TalkModeManager.kt,apps/ios/Sources/Voice/TalkModeManager.swift,apps/macos/Sources/OpenClaw/TalkModeRuntime.swift.extensions/voice-call/src/webhook/realtime-handler.ts,extensions/google-meet/src/realtime.ts.docs/refactor/talk.md,docs/refactor/talk-api-contract.md,docs/refactor/talk-execution.md,docs/refactor/talk-surfaces.md.Real behavior proof
codex/unify-talk-session-runtimeat4883e3950fc448f45114d71217d2eb3e7d9a04a8on macOS, using the real repository command wrappers.node -e "console.log(process.cwd())",pnpm test src/gateway/server-methods/talk.test.ts src/gateway/talk-handoff.test.ts, andpnpm plugin-sdk:api:check.talk.session.startTurn,talk.session.endTurn,talk.session.cancelTurn, andtalk.session.close; all are rejected with the active-connection error, while the joined active client can start a turn and receivessession.closedon close.Verification
Latest after rebase:
pnpm test src/gateway/server-methods/talk.test.ts src/gateway/talk-handoff.test.tspnpm plugin-sdk:api:checkpnpm exec oxfmt --check --threads=1 src/gateway/server-methods/talk-session.ts src/gateway/server-methods/talk.test.ts docs/.i18n/glossary.zh-CN.json extensions/diagnostics-otel/src/service.ts docs/.generated/plugin-sdk-api-baseline.sha256git diff --checkEarlier broader proof on this branch:
pnpm test src/gateway/server-methods/talk.test.ts src/gateway/method-scopes.test.ts src/gateway/server-methods-list.test.tspnpm test src/gateway/server-methods/talk.test.ts src/gateway/server-methods-list.test.ts src/gateway/protocol/index.test.tspnpm test extensions/voice-call/src/media-stream.test.ts extensions/voice-call/src/webhook/realtime-handler.test.ts extensions/google-meet/index.test.ts src/gateway/voiceclaw-realtime/session.test.ts src/talk/talk-session-controller.test.ts src/gateway/talk-handoff.test.ts src/gateway/talk-realtime-relay.test.ts src/gateway/talk-transcription-relay.test.ts src/gateway/server-methods/talk.test.ts src/gateway/server-methods-list.test.ts src/gateway/gateway-misc.test.ts ui/src/ui/realtime-talk.test.ts ui/src/ui/realtime-talk-gateway-relay.test.ts ui/src/ui/realtime-talk-google-live.test.ts ui/src/ui/realtime-talk-webrtc.test.tspnpm build:plugin-sdk:strict-smokepnpm tsgo:corepnpm tsgo:test:uipnpm check:changelog-attributionsenv OPENCLAW_TESTBOX=0 pnpm check:changedBlacksmith Testbox
pnpm check:changedstayed queued and was stopped; this branch currently relies on the local changed-gate fallback plus targeted Talk/voice surface tests above.Risks and Mitigations
talk.providerremains speech config.