Skip to content

fix(talk): run realtime voice consults under a fresh root admission - #202979

Open
LiuwqGit wants to merge 1 commit into
openclaw:mainfrom
LiuwqGit:feat/issue-202915-facetime-consult-admission
Open

LiuwqGit wants to merge 1 commit into
openclaw:mainfrom
LiuwqGit:feat/issue-202915-facetime-consult-admission

Conversation

@LiuwqGit

@LiuwqGit LiuwqGit commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #202915

What Problem This Solves

  • Fixes an issue where every FaceTime realtime call refused the openclaw_agent_consult tool with "Gateway is temporarily unavailable. Please try again shortly." while the gateway was healthy, so the caller never got the agent's answer (the voice model hears an error and may invent one instead).
  • The same shared helper is used by Voice Call (extensions/voice-call/src/runtime.ts) and meeting consults (src/meeting-bot/agent-consult.ts); those entry points inherit the same failure shape whenever their consult fires from a callback that outlived its creating request root.
  • Related: fix(meeting): own a fresh root admission for agent consults #142692 fixes the same admission mechanism only for meeting consults (caller-side wrap); this PR fixes it once for every realtime voice consult entry point. fix(voice): answer phone, meeting and FaceTime consults on Claude CLI agents #202209 documents this exact refusal as "Pre-existing" on main.

Why This Change Was Made

  • Intended outcome: consultRealtimeVoiceAgent now owns its root admission before any session effect (beginSessionEffect). Under a live caller root the consult nests and counts once (the browser Talk contract in src/gateway/talk/client-agent-consult.ts is unchanged); under a released or absent root it opens a fresh independent root via tryBeginGatewayRootWorkAdmission; during a genuine gateway restart drain or suspension it still refuses with GatewayDrainingError.
  • Out of scope: no change to call authorization, tool policy, consult session preparation, or delivery; the FaceTime controller and Voice Call controller are unchanged.
  • Highest-risk area: double-counting admission when a caller already holds a live root (Talk). Covered by a regression test that asserts the consult counts once under a live root.
  • The reporter's local workaround borrowed the webhook detached-work helper; per the review on the issue this keeps a dedicated consultation admission origin instead, matching the Talk contract.
  • Follow-up (clawsweeper review): the new realtime voice agent consult root admission suite now initializes the same test fixture (state via createOpenClawTestState, fork-session mock, voice-session testing reset) as the sibling runtime suite, so selecting it alone with -t no longer fails on an undefined fixture.

User Impact

  • FaceTime (and other realtime voice) callers get the configured agent's answer spoken back on openclaw_agent_consult instead of a spurious "gateway unavailable" error while the gateway is running normally.
  • Genuine gateway shutdown/restart drain and suspension still refuse consults, exactly as before.

Evidence

  • Real environment tested: three layers on Linux.
    1. In-process vitest shards running the real consult runtime (real gateway-work-admission module, real beginSessionEffect, real FaceTime talk driver controller), including the released-root propagation the issue reports.
    2. A real Gateway child process (built from this head's dist) with the shipped Voice Call plugin enabled, mock-auth OpenAI model provider (the repo's own qa-lab e2e pattern), real state persistence, and a realtime media-stream session driven through the shipped voice-call webhook upgrade path. The consult is emitted from a continuation scheduled inside a gateway request root that has already responded (released) — the propagation shape reported in the issue: the scheduling gateway method returns immediately, its request root releases, and the carrier tool call fires 500 ms later, inheriting that released root. On this head the consult admits under a fresh root, the real embedded agent executes (reads the seeded workspace files, produces a structured answer), and the speakable answer comes back through the realtime bridge as the consult tool result. The identical driver run against a Gateway child built from origin/main (3435fb5c94f) is refused with the exact reported error.
    3. Boundary disclosure: the telephony carrier is the plugin's shipped mock carrier; the realtime provider is a debug fixture kept in /tmp (never in the repo) modeled on the repo's own qa-lab voice-call runtime fixture, differing only in where the consult tool call is emitted from (a released-root continuation instead of connect()). Everything above that boundary — the Gateway child process, admission machinery, session effects, the shipped voice-call plugin, and the embedded agent — is real code from this head.
    • FaceTime's macOS surface itself cannot be driven from this contributor's Linux machine; the FaceTime-level regression drives the real driver's onToolCall from an async continuation created inside a since-released root, exactly the propagation the issue reports.
  • Exact steps or commands run after this patch:
    # helper-level regression (released root -> fresh admission), run both isolated and with the full file:
    node scripts/run-vitest.mjs run src/talk/agent-consult-runtime.test.ts -t 'realtime voice agent consult root admission'
    node scripts/run-vitest.mjs run src/talk/agent-consult-runtime.test.ts extensions/facetime/tests/talk-driver.consult.test.ts
    skills/fix-pr/scripts/validate.sh src/talk/agent-consult-runtime.ts src/talk/agent-consult-runtime.test.ts extensions/facetime/tests/talk-driver.consult.test.ts
    # typecheck shard covering the changed test file:
    node scripts/run-tsgo.mts -b test/tsconfig/tsconfig.core.test.other.json --builders 1   # exit 0
    # real-gateway voice-call e2e (Gateway child from dist of this head; see "What was not tested"):
    OPENCLAW_BUILD_PRIVATE_QA=1 node --import ./scripts/tsx.mjs scripts/build-all.mts qaRuntime
    node --import tsx <debug driver in /tmp equivalent to test/e2e/qa-lab/runtime/voice-call-gateway.ts,
      with the consult emitted from a released-root continuation; run twice against this head's dist,
      and once against a Gateway child built from origin/main (3435fb5c94f)>
  • Evidence after fix:
    ✓ |infra| src/talk/agent-consult-runtime.test.ts > realtime voice agent consult root admission > consults under a fresh root after the calling bridge's root released 93ms
    ✓ |infra| src/talk/agent-consult-runtime.test.ts > realtime voice agent consult root admission > counts once under a live caller root 14ms
    ✓ |infra| src/talk/agent-consult-runtime.test.ts > realtime voice agent consult root admission > refuses a consult while the gateway is genuinely draining 10ms
    ✓ |infra| src/talk/agent-consult-runtime.test.ts > realtime voice agent consult root admission > releases the consultation root after a failed run 12ms
    ✓ |infra| src/talk/agent-consult-runtime.test.ts > realtime voice agent consult root admission > releases the consultation root after cancellation 13ms
    ✓ |extensions| extensions/facetime/tests/talk-driver.consult.test.ts > FaceTime talk driver consult root admission > answers a consult issued from a released plugin-service root 3636ms
    Test Files  2 passed (2)   Tests  35 passed (35)
    
    # real-Gateway run, released-root propagation (head 8fbc75de, dist buildstamp verified; two runs, same result):
    [voice-call] Webhook server listening on http://127.0.0.1:<port>/voice/webhook
    [voice-call] Outbound call initiated: callId=<uuid> providerCallId=mock-<uuid> mode=conversation
    [voice-call] Realtime bridge starting for call <uuid> (providerCallId=mock-<uuid>, initialGreeting=queued)
    [proof] streamSession: {"token":"<redacted>","streamUrl":"wss://localhost:8443/voice/stream/realtime/<redacted>","providerCallId":"mock-<uuid>"}
    [proof] consult scheduled from request-root continuation: {"scheduled":true,"delayMs":500}   # method responds first -> its request root releases
    {"event":"consult-scheduled-inside-request-root","delayMs":500}
    {"event":"carrier-tool-call-emitted-from-continuation"}                                   # 500ms after the root released
    # tool results delivered to the carrier:
    {"callId":"qa-consult-call","result":{"status":"working","tool":"openclaw_agent_consult","message":"Tell the caller briefly that you are checking, then wait for the final OpenClaw result before answering with the actual result."},"options":{"willContinue":true}}
    {"callId":"qa-consult-call","result":{"text":"Worked:\n- Read all three seeded files: repo/qa/scenarios/index.yaml, repo/extensions/qa-lab/src/suite.ts, and repo/docs/help/testing.md.\n- Extra QA scenario candidates: config restart capability flip and image generation roundtrip.\nFailed:\n- None observed in mock mode.\nBlocked:\n- No live provider evidence in this lane.\nFollow-up:\n- Re-run with a real model for qualitative coverage."}}
    [proof] OUTCOME: consult delivered an agent answer
    
  • Observed result after fix: a consult issued from a callback that inherited a released root now runs to completion — the FaceTime driver delivers the agent's answer as the tool result instead of the admission error, runEmbeddedAgent is called once, and no consultation root is left active afterwards (success, failure, cancellation, and genuine drain are each asserted). In the real-gateway Voice Call runs, the consult emitted from a released-root continuation through the shipped realtime voice path admits under a fresh root, runs the real embedded agent, and delivers the speakable answer through the realtime bridge (reproduced twice on this head).
  • Before evidence: on main, the same two in-process regressions fail: the helper-level consult rejects with GatewayDrainingError: Gateway is temporarily unavailable. Please try again shortly. from beginSessionEffect's subordinate-admission check, and the FaceTime driver submits {"error":"Gateway is temporarily unavailable. Please try again shortly."} as the tool result — the exact reported symptom. The same released-root real-gateway driver run against a Gateway child built from origin/main (3435fb5c94f) is refused:
    # identical driver, Gateway child from origin/main (3435fb5c94f):
    {"event":"consult-scheduled-inside-request-root","delayMs":500}
    {"event":"carrier-tool-call-emitted-from-continuation"}
    {"callId":"qa-consult-call","result":{"status":"working","tool":"openclaw_agent_consult","message":"Tell the caller briefly that you are checking, ..."},"options":{"willContinue":true}}
    {"callId":"qa-consult-call","result":{"error":"Gateway is temporarily unavailable. Please try again shortly."}}
    [proof] OUTCOME: consult refused -> {"error":"Gateway is temporarily unavailable. Please try again shortly."}
    
    Before the fixture fix in this follow-up, selecting the admission suite alone (-t 'realtime voice agent consult root admission') failed with TypeError: Cannot read properties of undefined (state fixture not initialized in the sibling describe).
  • What was not tested: a live FaceTime call on macOS run by this contributor (no macOS host / Apple Silicon available here); the FaceTime-level regression reproduces the reported released-root propagation against the real driver code instead. Since then @withlightsg ran one real inbound FaceTime call on macOS against a 2026.11.5 release build carrying only this PR's production change (comment): the shipped @openclaw/facetime plugin called consultRealtimeVoiceAgent exactly as released, session-effect admission settled without refusal at 0.09 s, the configured agent ran, and the tool result reached the call at 53.77 s with no Gateway is temporarily unavailable anywhere in the log — while the same build without this change refused every consult within ~0.1 s. That is a single-call smoke test of the released-root path on real hardware (it does not cover Talk nesting or drain, which this PR's tests assert). The real-gateway runs used the plugin's shipped mock telephony carrier, a /tmp realtime-provider fixture (disclosed above), and the repo's mock-auth OpenAI provider — system-boundary mocks per the repo's own qa-lab e2e pattern; the released-root failure shape is now also demonstrated end-to-end in a real Gateway (refused on main, answered on this head). The official qa-lab scenario qa/scenarios/plugins/voice-call-cli-rpc-agent-tool.yaml currently fails on main at the realtime step: its fixture issues the stream session with the internal callId while the signed-call boundary (realtime-handler.ts, providerName "twilio") compares the start frame's CallSid with the issuance callId, so the stream is always closed with 1008 "Call identity does not match stream session" (verified identical on origin/main); worth a separate test-infra fix.
  • Proof tier: L2 (real runtime modules in-process, deterministic RED/GREEN on the reported failure mode) + a real-Gateway Voice Call e2e run from this head's dist demonstrating the released-root propagation end-to-end (refused on main, answered on this head).
  • Proof limitations: this contributor has no macOS / live FaceTime hardware (the real-hardware confirmation above is @withlightsg's, on a release build carrying this PR's production change); in my runs the model provider, telephony carrier, and realtime provider are system-boundary mocks as disclosed above.
  • Review state: third follow-up. Rebased onto current main (1e6d3f9bd9e, head 080cb2c7b72): main has since split the consult into two entry points — consultRealtimeVoiceAgent (channel bridges) and the gateway-only consultRealtimeVoiceAgentInSessionRuntime (browser Talk) — both delegating to consultRealtimeVoiceAgentInternal. The root admission now lives on that shared internal owner instead of a single wrapper, so both entry points get it at the narrowest point: a live caller root still nests and counts once, a released or absent root opens a fresh independent root, and a genuine drain still refuses. The two conflicting test files re-merged cleanly; src/talk/agent-consult-runtime.test.ts + extensions/facetime/tests/talk-driver.consult.test.ts pass on the rebased head (2 vitest shards green), oxfmt/oxlint clean, pnpm tsgo:core exit 0. Earlier follow-ups: the second added a real-Gateway released-root run from this head's dist (agent answer delivered, reproduced twice) plus the identical driver refused on origin/main, answering the review of 8fbc75de; requesting re-review, including of @withlightsg's real-hardware FaceTime confirmation above.

@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The PR gives realtime voice consultations tracked Gateway root admission before they start session effects.

Example: An allowed FaceTime caller asks what events are happening in Rome after the plugin startup request has finished.

  • Before: The consultation inherits a released root and returns “Gateway is temporarily unavailable” without running the agent.
  • After: The consultation acquires fresh admission, runs the configured agent, and returns its answer to the call.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, worthwhile lifecycle repair with production-path confirmation and no identified blocking defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): withlightsg supplied a real macOS FaceTime call showing this production admission change delivered the configured agent's answer without the prior workaround; contributor logs additionally show released-root refusal before the fix and recovery through a Gateway child and shipped Voice Call path with disclosed transport/model fixtures. The rebased implementation retains the same admission operation at the shared internal owner, with focused regression results reported for the reviewed head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Callers receive a misleading Gateway-unavailable error instead of an agent-backed answer while the Gateway is healthy.
Reason: The patch restores documented consultation behavior for an observed release failure using one shared lifecycle owner.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR fixes a current shared-runtime bug, and I found no introduced correctness defects.

Reviewed head: 080cb2c7b729fc34f1fc841babe9438f7bd23190

Before merge

  • Await maintainer action - A maintainer must approve the fork workflows for head 080cb2c so required CI can run before merge.

Findings

None.

Agent review details

How this fits together

FaceTime, Voice Call, meeting bridges, and browser Talk delegate questions to the shared consultation runtime, which prepares session work, executes the agent, and returns speakable text.

flowchart TD
  A[Voice bridge callback] --> C[Shared consult owner]
  B[Browser Talk admitted turn] --> C
  C --> D[Gateway root admission]
  D --> E[Session effect admission]
  E --> F[Configured agent]
  F --> G[Speakable tool result]
Loading

Technical review

Best possible solution:

Keep admission in the shared consultation owner, preserving live-root nesting and releasing newly acquired roots on every terminal path.

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

Current-main source deterministically rejects consultations carrying a released root before agent execution, matching the affected-release report and supplied before/after evidence; this read-only review ran no target code.

Is this the best way to solve the issue?

Admission belongs at the shared consultation boundary, and this patch reuses the existing admission API while preserving the separate browser Talk lifecycle and existing sender and tool authority.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shared realtime consultation ownership keeps the original intent (e2f1395: Centralize agent consultation for browser Talk, Google Meet, and Voice Call.)
  • Bridge and Gateway session-runtime entry points keeps the original intent (966d287: Allow Gateway Talk consultations to use the typed-chat runtime while preserving the separate plugin bridge execution contract.)
  • Consultation test fixture lifecycle keeps the original intent (b75b62f: Isolate consultation test storage so parallel checkouts cannot share real SQLite state.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +35, Tests +244. Total +279 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 35 0 +35
Tests 2 258 14 +244
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 293 14 +279

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test changes Production +35/-0 lines; tests +258/-14 lines The test growth covers released-root recovery, live-root nesting, genuine drain refusal, failure and cancellation cleanup, and FaceTime result delivery.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #202915
Summary: This PR addresses the canonical FaceTime report through the shared owner and also covers the released-root mechanism reported for meetings.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-21T07:15:12.589Z sha 8a612b7 :: needs real behavior proof before merge. :: [P2] [P2] Initialize the fixture for the new admission suite
  • reviewed 2026-11-21T10:54:36.883Z sha 8fbc75d :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-22T03:37:40.255Z sha 8fbc75d :: blocked before merge. :: none

Reviewed November 27, 2026, 2:10 AM ET / 07:10 UTC (Revision 4).

@LiuwqGit
LiuwqGit force-pushed the feat/issue-202915-facetime-consult-admission branch from 8a612b7 to 8fbc75d Compare November 21, 2026 10:48
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Follow-up for the clawsweeper review of head 8a612b7b8e6689a423f2d37159ce288ae7c85bf4 — both before-merge items are addressed in head 8fbc75de348:

1. [P2] Fixture isolation for the new admission suite — fixed

The realtime voice agent consult root admission describe block now initializes the same fixture as the sibling runtime suite (createOpenClawTestState + fork-session mock + voice-session testing reset, with cleanup in afterEach). Reproduced the defect first, then verified the fix:

  • RED (before, run with the exact selection from the review):
    ✗ src/talk/agent-consult-runtime.test.ts > realtime voice agent consult root admission > consults under a fresh root after the calling bridge's root released
      → promise rejected "TypeError: Cannot read properties of undefined" instead of resolving
    ✗ ... > counts once under a live caller root → Test timed out in 120000ms
    ✗ ... > releases the consultation root after a failed run
      → got 'Cannot read properties of undefined' instead of 'provider exploded'
    
  • GREEN (after, same command plus the full file + the FaceTime driver suite): Test Files 2 passed (2) Tests 35 passed (35) (log excerpts in the PR body Evidence section). Typecheck shard covering the changed test file: tsconfig.core.test.other.json exit 0.

2. Real behavior proof through a shipped voice entry point — added

Ran a real Gateway child process built from this head's dist with the shipped Voice Call plugin enabled (its shipped mock telephony carrier), mock-auth OpenAI provider (the repo's own qa-lab e2e pattern), real state persistence, and a realtime media-stream session driven through the shipped voice-call webhook upgrade path:

[voice-call] Webhook server listening on http://127.0.0.1:<port>/voice/webhook
[voice-call] Outbound call initiated: callId=<uuid> providerCallId=mock-<uuid> mode=conversation
[voice-call] Realtime bridge starting for call <uuid> (providerCallId=mock-<uuid>, initialGreeting=queued)
# fixture carrier onToolCall(openclaw_agent_consult) → real embedded agent run → final tool result:
{"callId":"qa-consult-call","result":{"text":"Worked:\n- Read all three seeded files: repo/qa/scenarios/index.yaml, repo/extensions/qa-lab/src/suite.ts, and repo/docs/help/testing.md.\n…Follow-up:\n- Re-run with a real model for qualitative coverage."}}

The consult admitted, the real embedded agent executed (read the seeded workspace files and produced a structured answer), and the speakable answer was delivered back through the realtime bridge. Honest scope notes (also in the PR body):

  • The Voice Call realtime consult does not inherit a released root in this path, so this flow also passes on main — the released-root failure shape remains covered deterministically by the in-process regressions (shared helper + real FaceTime driver onToolCall propagation), which fail on main with the exact reported Gateway is temporarily unavailable. Please try again shortly.
  • A live FaceTime call needs macOS/Apple hardware this contributor doesn't have; the FaceTime-level regression drives the real driver's tool-call callback from a since-released root instead.

Also found while producing this evidence (not caused by this PR, verified identical on origin/main): the official qa-lab scenario qa/scenarios/plugins/voice-call-cli-rpc-agent-tool.yaml is deterministically broken at the realtime step on main — its fixture (test/e2e/qa-lab/runtime/fixtures/voice-call-runtime-plugin/index.js) issues the stream session with the internal callId, while the signed-call boundary in realtime-handler.ts (providerName "twilio") compares the start frame's CallSid with the issuance callId, so the stream is always closed with 1008 "Call identity does not match stream session" (and with the other value, 1008 "Caller rejected by policy", because the manager lookup then misses the provider-call map). Issuing with call.providerCallId per the production Twilio contract fixes the scenario. Kept out of this PR to stay in scope; happy to send the one-line test-infra fix separately.

CI note: openclaw/ci-gate is red on the previous head because the CI workflow run is in action_required state (awaiting maintainer approval for fork workflows) — it has not executed at all, so there is no code-level CI failure to fix here. The new head re-triggers the same workflows.

PR body updated (validated with the four-section template + required Evidence fields). Requesting a re-review of 8fbc75de348.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Real behavior proof added for the review item on head 8fbc75de348d1d956fe27318d118abf84610f938 — a voice consultation inherited from a released root reaching the configured agent and delivering its answer, from a real Gateway child process built from this head's dist.

Setup (all real except the disclosed system-boundary mocks): a real Gateway child process spawned from this head's dist (dist/.buildstamp head 8fbc75de…, inputsClean), shipped voice-call plugin enabled with its shipped mock telephony carrier, mock-auth OpenAI provider (the repo's own qa-lab e2e pattern), real state persistence, and a realtime media-stream session driven through the shipped voice-call webhook/stream upgrade path. The realtime provider is a debug fixture kept in /tmp (never in the repo), modeled on the repo's own qa-lab voice-call runtime fixture — differing only in where the consult tool call is emitted from: instead of connect(), the carrier emits openclaw_agent_consult from a continuation scheduled inside a gateway request root that has already responded (the scheduling method returns immediately, its request root releases, the tool call fires 500 ms later). That is the propagation shape reported in #202915.

After (this head, reproduced twice):

[voice-call] Webhook server listening on http://127.0.0.1:<port>/voice/webhook
[voice-call] Outbound call initiated: callId=<uuid> providerCallId=mock-<uuid> mode=conversation
[voice-call] Realtime bridge starting for call <uuid> (providerCallId=mock-<uuid>, initialGreeting=queued)
[proof] consult scheduled from request-root continuation: {"scheduled":true,"delayMs":500}   # method responds first -> its request root releases
{"event":"consult-scheduled-inside-request-root","delayMs":500}
{"event":"carrier-tool-call-emitted-from-continuation"}                                   # 500ms after the root released
# tool results delivered to the carrier:
{"callId":"qa-consult-call","result":{"status":"working","tool":"openclaw_agent_consult","message":"Tell the caller briefly that you are checking, then wait for the final OpenClaw result before answering with the actual result."},"options":{"willContinue":true}}
{"callId":"qa-consult-call","result":{"text":"Worked:\n- Read all three seeded files: repo/qa/scenarios/index.yaml, repo/extensions/qa-lab/src/suite.ts, and repo/docs/help/testing.md.\n- Extra QA scenario candidates: config restart capability flip and image generation roundtrip.\nFailed:\n- None observed in mock mode.\nBlocked:\n- No live provider evidence in this lane.\nFollow-up:\n- Re-run with a real model for qualitative coverage."}}
[proof] OUTCOME: consult delivered an agent answer

The consult inherited the released root, admitted under a fresh root, the real embedded agent executed (read the seeded workspace files and produced a structured answer), and the speakable answer was delivered back through the realtime bridge.

Before (identical driver, Gateway child built from origin/main 3435fb5c94f):

{"event":"consult-scheduled-inside-request-root","delayMs":500}
{"event":"carrier-tool-call-emitted-from-continuation"}
{"callId":"qa-consult-call","result":{"status":"working","tool":"openclaw_agent_consult","message":"Tell the caller briefly that you are checking, ..."},"options":{"willContinue":true}}
{"callId":"qa-consult-call","result":{"error":"Gateway is temporarily unavailable. Please try again shortly."}}
[proof] OUTCOME: consult refused -> {"error":"Gateway is temporarily unavailable. Please try again shortly."}

— the exact reported symptom, on main, through the same shipped entry point.

Redactions: stream tokens and loopback ports masked above; call ids are random uuids from the mock carrier. No external IPs, API keys, or phone numbers appear in the captured logs.

Boundary disclosure: the telephony carrier is the plugin's shipped mock carrier and the realtime provider is the /tmp fixture described above (system-boundary mocks, per the repo's own qa-lab e2e pattern); everything above that boundary — Gateway child process, admission machinery, session effects, the shipped voice-call plugin, and the embedded agent — is real code from the respective head. A live FaceTime call needs macOS/Apple hardware this contributor doesn't have; the FaceTime-level regression still drives the real driver's onToolCall from a since-released root in-process.

The PR body's Evidence section is updated with these logs (validated against the four-section template). Regarding the second before-merge item ("await maintainer action" to approve fork workflows for head 8fbc75de…): the CI/CodeQL/macOS workflow runs are in action_required awaiting first-time fork approval, which only a maintainer can grant — nothing code-side to fix there.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 22, 2026
@withlightsg

Copy link
Copy Markdown

Live FaceTime check on macOS for this PR (the PR body notes that no macOS/FaceTime hardware was available).

Setup: the 2026.11.5 release build with only this PR's production change ported into the dist. The consultRealtimeVoiceAgent body was renamed to runRealtimeVoiceAgentConsult and wrapped as in the diff, with tryBeginGatewayRootWorkAdmission and GatewayDrainingError imported from the gateway-work-admission chunk. My local plugin-side workaround from #202915 was removed for this test, so @openclaw/facetime 2026.11.5 called consultRealtimeVoiceAgent exactly as shipped.

One real inbound FaceTime call. The caller asked the assistant to look up what is on in Rome this week:

t (s) Event
0.00 openclaw_agent_consult tool call from the realtime model (talk tool.call)
0.09 session-effect admission waits and then settles; no refusal
the configured agent runs
53.77 tool result delivered to the call (talk tool.result); the assistant then read the results to the caller

There is no Gateway is temporarily unavailable anywhere in the log for that call. On the same build without this change and without the workaround, every consult during a FaceTime call was refused within about 0.1 s with "Gateway is temporarily unavailable. Please try again shortly." (#202915).

Scope: this was a single call, so it is a smoke test of the released-root path on real hardware. It does not cover the Talk nesting or the drain cases, which the PR's tests already cover. The test build has been reverted.

This comment was prepared with an AI coding assistant; the timings were read from this machine's Gateway log.

FaceTime realtime calls always refused openclaw_agent_consult with
"Gateway is temporarily unavailable. Please try again shortly." because
the consult ran under the released startup root that the plugin service's
tool-call callback inherited. The shared consult helper now owns its root
admission before any session effect: it nests under a live caller root
(the browser Talk contract), opens a fresh independent root when the
inherited root is released or absent, and still refuses the consult during
a genuine gateway restart drain or suspension.

Fixes openclaw#202915
@LiuwqGit
LiuwqGit force-pushed the feat/issue-202915-facetime-consult-admission branch from 8fbc75d to 080cb2c Compare November 27, 2026 06:56
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (1e6d3f9bd9e) — head is now 080cb2c7b72. The branch had become unmergeable because main refactored this exact helper while the PR was open.

Conflict resolution (main's newer shape preserved). Main split the consult into two entry points — consultRealtimeVoiceAgent (channel bridges: FaceTime, voice-call, meeting-bot) and the gateway-only consultRealtimeVoiceAgentInSessionRuntime (browser Talk) — both delegating to consultRealtimeVoiceAgentInternal. Rather than wrapping only the entry point the reporter hit, the root admission now lives on that shared internal owner, so both entry points get it at the narrowest point and the semantics are unchanged: a live caller root nests and counts once, a released or absent root opens a fresh independent root, and a genuine restart drain still refuses. My previous standalone wrapper (which would have shadowed main's new consultRealtimeVoiceAgent) is gone; the exported param type stays main's non-exported ConsultRealtimeVoiceAgentParams. The two overlapping test files re-merged cleanly and now exercise both entry points through the shared admission.

Verification on the rebased head: src/talk/agent-consult-runtime.test.ts + extensions/facetime/tests/talk-driver.consult.test.ts → 2 vitest shards passed (14 tests in the FaceTime driver suite, including answers a consult issued from a released plugin-service root); oxfmt --check clean; oxlint clean; pnpm tsgo:core exit 0. CI lanes stay with Actions.

Real-hardware confirmation added to the Evidence section. @withlightsg ran one real inbound FaceTime call on macOS against a 2026.11.5 release build carrying only this PR's production change (comment): the shipped @openclaw/facetime plugin called consultRealtimeVoiceAgent exactly as released, admission settled without refusal at 0.09 s, the configured agent ran, and the tool result reached the call at 53.77 s — no Gateway is temporarily unavailable anywhere in that log, while the same build without this change refused every consult within ~0.1 s. That closes the "no macOS host available to this contributor" gap I had disclosed; the PR body now records it as third-party evidence with its single-call smoke-test scope stated.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. plugin: facetime FaceTime plugin proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: FaceTime realtime calls: openclaw_agent_consult is always refused with "Gateway is temporarily unavailable" (consult runs under a released root)

2 participants