openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Meet response-latency audit — 9 findings across simple queries and integration queries

Open Al629176 opened this issue 5 months ago • 1 comments

Summary

A response-latency audit of the Meet voice loop identified 9 concrete bottlenecks across two query types. Simple queries (greetings, time, "can you hear me") take 2.8–4.3s but can be cut to <1.2s. Integration queries (Slack/Gmail/calendar) take 30–90s with several removable serial steps.


Type 1 — Simple queries (target: 2.8–4.3s → <1.2s)

Finding 1 — Preroll "On it." TTS awaited before LLM starts

File: turns.rs:233 · Cost: ~1–1.5s · Confidence: High

The acknowledgement TTS is awaited serially before the LLM starts. Fix: spawn concurrently or pre-synthesize the fixed ack once at session start (~10KB PCM cache) → ~1–2ms.

Finding 2 — TTS fully buffered — streaming thrown away

Files: speech.rs:29–68, reply_speech.rs:223 · Cost: ~0.3–1.2s to first audio · Confidence: High

TTS audio is fully buffered before playback begins despite the streaming infrastructure already existing. Fix: use the backend streaming endpoint + bytes_stream() → enqueue chunks with done=false. bytes_stream is already used elsewhere; enqueue_outbound_pcm(done) already supports it.

Finding 3 — load_config_with_timeout() reloaded per STT and per TTS call

File: speech.rs:14,32 · Cost: ~0.1–0.5s ×N/turn · Confidence: High

Config is reloaded on every STT and TTS call within a turn. Fix: load once per turn/session and pass down. Per-call cache was previously rejected for test races; session-scoped is safe.

Finding 4 — CAPTION_TURN_DELAY_MS fixed at 1500ms

Files: turns.rs:152, constants.rs:81 · Cost: 1.5s wake→LLM · Confidence: Medium

A hard 1500ms sleep separates caption receipt from LLM dispatch. Fix: trim to 800–1000ms after measuring caption inter-arrival CDF.


Type 2 — Integration queries (Slack/Gmail/calendar, target: 30–90s → significantly lower)

Finding 5 — delegate_to_integrations_agent spawns a nested sub-agent (double LLM round-trip)

Files: skill_delegation.rs:283, dispatch.rs:151 · Cost: +2–8s · Confidence: High (critical)

The orchestrator delegates to a sub-agent which then spawns another — two full LLM round-trips before any tool is called. Fix: early-route by sending routing + toolkit in a single call instead of orchestrator → delegate → subagent.

Finding 6 — Composio list_tools re-fetched on every delegation

File: runner.rs:357–380 · Cost: 2–8s/delegation · Confidence: High

cached_integration.tools is already in memory but used only as a fallback. Fix: use the in-memory cache as primary source; refresh async on a 10-min TTL or OAuth change event.

Finding 7 — Connected-integrations list re-fetched at every sub-agent spawn

File: runner.rs:223–263 · Cost: 0.1–5s · Confidence: Medium-High

The connected integrations list is fetched fresh for every sub-agent spawn. Fix: reuse the parent session's frozen list; live-fetch only if empty.

Finding 8 — Tool execution is serial within an iteration

File: engine/core.rs:778–790 · Cost: 5–15s → ~5s · Confidence: High

Independent tool calls are executed one after another. Fix: join_all independent calls with a shared rate-limit guard.

Finding 9 — 90s agentic timeout (comment claims 20s)

Files: constants.rs:33, llm.rs:116 · Cost: up to 90s silence · Confidence: High

The actual timeout is 90s despite a comment saying 20s. For live voice this is unacceptable — the user hears nothing for up to 90s. Fix: cap at 30–40s for live voice contexts; surface a graceful "couldn't reach it in time" response.


Acceptance criteria

Type 1 — simple queries:

  • [ ] Finding 1 fixed — Preroll ack spawned concurrently or pre-cached; no serial TTS await before LLM start.
  • [ ] Finding 2 fixed — TTS streamed to playback as chunks arrive, not fully buffered.
  • [ ] Finding 3 fixed — Config loaded once per turn/session, not per STT/TTS call.
  • [ ] Finding 4 fixed — CAPTION_TURN_DELAY_MS reduced to 800–1000ms based on CDF measurement.
  • [ ] Simple query p50 latency ≤ 1.2s measured end-to-end.

Type 2 — integration queries:

  • [ ] Finding 5 fixed — Routing + toolkit sent in one LLM call; nested sub-agent spawn eliminated.
  • [ ] Finding 6 fixed — cached_integration.tools used as primary; async TTL refresh on 10-min / OAuth change.
  • [ ] Finding 7 fixed — Connected-integrations list reused from parent session.
  • [ ] Finding 8 fixed — Independent tool calls executed in parallel via join_all.
  • [ ] Finding 9 fixed — Agentic timeout capped at 30–40s for live voice; graceful timeout message surfaced.
  • [ ] Regression safety — No regressions in voice accuracy, tool correctness, or non-Meet agent flows.
  • [ ] Diff coverage ≥ 80% — All fix PRs meet the changed-lines coverage gate.

Related

Meet epic: #3505 Agent hang: #4269 Agent timeout: #4270 Staging latency investigation: #3491

Al629176 avatar Jun 30 '26 05:06 Al629176

This plan is outdated as meet path is changed, will test and create a new plan based on final code.

YellowSnnowmann avatar Jul 07 '26 08:07 YellowSnnowmann