feat(meet-agent): Flow A second brain — orchestrator + tools + pre-roll + cache + barge-in
Summary
- Meet bot ("Flow A") now answers with the user's full orchestrator agent + connected integrations — calendar, Slack, Gmail and all 119 Composio tools available in-call.
- Pre-roll "On it." ack covers 30–60s tool-call dead air on long queries; skipped on short prompts (greetings / time / checks).
- Per-meet Agent cache preserves cross-turn memory and eliminates 5–10s rebuild cost on every turn after the first.
- Real barge-in: JS audio-bridge flush + relaxed wake gate let the user interrupt a wrong-direction reply by re-asking.
- Layered wake dedup (60s caption cooldown + 60s wall-clock min-turn-gap + per-speaker normalised text dedup) stops the "ask once, hear 5 replies" pattern.
- CC auto-enable broadened to substring matchers across 8 label variants; attempt budget doubled to ~120s.
- Time/date answers without a tool dispatch — current local time injected per-turn into the orchestrator's user-message prefix.
Problem
The pre-revival Flow A baseline could put the mascot into a Meet but:
- Hit a bare
/openai/v1/chat/completionsendpoint with no tools → could not answer "what's on my calendar", "what did Alice say on Slack", "remember Friday is busy". - Reasoning-style models leaked chain-of-thought as plain text into TTS — user heard
"We need to generate a single sentence…"spoken aloud. - 20–60s of silence while tools ran → users assumed broken, re-asked, spawning ~20 parallel calendar queries.
- Echo / wake loops: bot's own TTS captioned back as
speaker="You"re-fired wake; cooldown and dedup were too narrow. - Audio queue couldn't be flushed — old reply kept playing through the JS bridge after Rust cancellation.
- CC matchers were prefix-only and missed Meet variants, forcing the user to enable captions manually each call.
Solution
- Route through
Agent::from_config_for_agent_with_profile(&config, "orchestrator", None, Some(MEET_VOICE_DIRECTIVE))— same canonical path the chat UI uses. Inherits 119 integrations + memory tree + MCP. - New
MEET_VOICE_DIRECTIVEsystem-prompt suffix splits two contracts: TOOL USE (encouraged, invisible to user, doesn't count toward word budget) vs FINAL SPOKEN REPLY (one sentence ≤25 words, plain English, no markdown).RIGHT-NOW CONTEXTblock injects local date/time so time questions answer without a clock tool. AGENT_CACHE: OnceLock<TokioMutex<HashMap<request_id, Arc<TokioMutex<Agent>>>>>per-meet Agent built once, locked acrossrun_single().await, dropped onstop_session. Eliminates 5–10s per-turn rebuild and restores cross-turn memory.- Per-turn unique transcript filename keeps disk-resume from hitting the corrupt-
tool_calls-pair 400 error after a kill mid-tool-call; in-memory history survives via the cache. AGENTIC_TURN_TIMEOUT_SECS = 90covers slow Composio fetches + iteration-2 synthesis. On agentic failure: speak"Let me get back to you on that."— honest deflection — instead of falling back to a toolless LLM that hallucinates.- Pre-roll
"On it."synthesised + enqueued withdone=falseimmediately after wake. Skipped when prompt ≤ 50 chars (greetings / time / hear-me checks). - Barge-in plumbing: new
window.__openhumanFlushAudio()inaudio_bridge.jstracks every startedAudioBufferSourceand stops in-flight on flush.session.flush_pendingset bycancel_outbound, returned inpoll_outboundJSON, consumed byspeak_pumpwhich callsinject::flush_audio_bridgebefore the next feed.note_captiongate relaxed to only block during LLM-in-flight (not during TTS playback). - Per-speaker
last_caption_by_speakerHashMap with normalised dedup key (lowercase + drop non-alphanumeric + collapse whitespace) catches Meet's punctuation/case jitter between observer ticks. last_turn_done_at_mswall-clock backstop +MIN_TURN_GAP_MS=60srefuses wake within 60s of prior turn done regardless of caption content. Caption cooldown also 60s.- CC auto-enable: 8 patterns (
turn on captions,turn on live captions,turn on subtitles,turn on closed captions,captions on,captions (c),show captions,enable captions) with substring match + negative-OFF guard, budget 30→60 attempts.
Submission Checklist
If a section does not apply to this change, mark the item as
N/Awith a one-line reason. Do not delete items.
- [x] N/A: Tests added or updated — live-meeting integration surface; unit-test coverage for session.rs gate + dedup logic to follow before un-drafting. Manual smoke is the gold standard for the voice path.
- [x] N/A: Diff coverage ≥ 80% — draft PR for architecture review; coverage matrix to be brought to 80% before un-drafting.
- [x] N/A: Coverage matrix updated — behaviour-only change to existing meet-agent feature row.
- [x] N/A: All affected feature IDs from the matrix are listed under
## Related— will add when coverage matrix row is updated. - [x] No new external network dependencies introduced (mock backend used per Testing Strategy)
- [x] N/A: Manual smoke checklist updated — draft, not release-cut surface yet.
- [x] N/A: Linked issue closed via
Closes #NNN— no tracking issue opened yet; will add before un-drafting.
Impact
- Runtime: desktop only (Tauri CEF). Flow A bot path; no chat UI behaviour change.
- Performance: first wake in a meet is ~5–10s slower (Agent cold-build). Every subsequent wake skips the rebuild + memory-tree load (cached). Tool-heavy turns (Slack / Gmail) run 30–90s end-to-end; pre-roll ack covers user perception. Time-only questions answer in 2–5s (no tool dispatch).
- Security: bot inherits the same agent surface the chat UI already exposes — no new attack surface. Per-meet event-context scoping prevents the meet transcript from colliding with the chat UI thread on disk.
- Compatibility: backwards-compatible at the RPC layer;
poll_outboundJSON gained an optionalflush_pending: boolfield. Older shells ignore it; new shell consumes it.
What's working today (achievements)
- Bot joins Meet, mascot tile shows, CC auto-enables.
- Wake-word fires on
"hey openhuman" / "hi openhuman" / "openhuman"etc. (8 variants), speaker=You bot-echo filtered. - Full orchestrator with 119 connected integrations available on every turn (verified:
delegate_to_integrations_agent→integrations_agent completed iterations=3 output_chars=329 success=true). - Calendar / Slack / Gmail queries actually resolve via Composio.
- Time / date questions answered directly from injected
RIGHT-NOW CONTEXTblock (no tool needed). - Per-meet cache preserves in-memory history across turns; bot recalls earlier dialogue ("still no singing", "still not a singer" — verified in live test 02:33–02:35).
- Pre-roll "On it." cue masks tool latency on slow queries; skipped on short prompts so greetings don't get the redundant ack.
- Barge-in: new wake mid-reply triggers JS audio-bridge flush (verified:
sources_stopped=1when bot was mid-playback). - English-only TTS enforced in the directive after observing model locale drift.
- Honest "Let me get back to you" ack on agentic timeout instead of a toolless hallucination.
Still to conquer (follow-ups)
- Sliding-window prompt trim — rolling-events history grows unbounded across long calls (saw 4800+ char prompts). Need a per-turn token budget.
- Caption residue / repeat-wake hardening — 60s windows masked it for now, but a true fix is to track recently-fired wake prompts and suppress fuzzy-matching residues for a longer window.
- Audio bridge JS flush is best-effort —
sources_stopped=0shows we sometimes flush after playback has already drained naturally; instrument JS-side to record pending-schedule depth for tighter diagnostics. - Multilingual support — currently forces English-only because ElevenLabs voice model is English; pluggable voice + locale-aware directive would lift this.
- Vendored CEF
set_audio_mutedfor the bot — currently the bot CEF window is fully audible to the host machine; should be muted at the OS level so only the Meet wire hears the synthesised PCM. - MascotFrameProducer encode bottleneck (~1fps observed in smoke) — Y4M producer pipeline is single-threaded; needs profiling.
- Unit-test coverage for session.rs gate + dedup logic before un-drafting.
AI Authored PR Metadata
Keep this section for AI-authored PRs. For human-only PRs, mark each field
N/A.
Linear Issue
- Key: N/A
- URL: N/A
Commit & Branch
- Branch:
feat/mascot-meet-flowA - Commit SHA: 257646cf
[!WARNING]
Review limit reached
@M3gA-Mind, we couldn't start this review because you've reached your PR review rate limit.More reviews will be available in 33 minutes and 26 seconds. Learn how PR review limits work.
Your organization has run out of usage credits. Purchase more in the billing tab.
⌛ How to resolve this issue?
After more reviews become available, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.
Please see our Fair Usage Limits Policy for further information.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID:
929c0bad-83c2-4681-8b7c-6755b0991b47📥 Commits
Reviewing files that changed from the base of the PR and between 1ea0ddeac7bea006e07c6a06917f647cbddfda62 and 2b3d42ae9b9eb5e445c27f84a3ba541e0d5bc48b.
📒 Files selected for processing (26)
app/src-tauri/src/lib.rsapp/src-tauri/src/meet_audio/audio_bridge.jsapp/src-tauri/src/meet_audio/captions_bridge.jsapp/src-tauri/src/meet_audio/inject.rsapp/src-tauri/src/meet_audio/mod.rsapp/src-tauri/src/meet_audio/speak_pump.rsapp/src-tauri/src/meet_call/mod.rsapp/src-tauri/src/meet_scanner/mod.rsapp/src/components/intelligence/IntelligenceCallsTab.test.tsxapp/src/components/intelligence/IntelligenceCallsTab.tsxapp/src/components/skills/MeetingBotsCard.tsxapp/src/components/skills/__tests__/MeetingBotsCard.test.tsxapp/src/features/human/HumanPage.test.tsxapp/src/features/human/HumanPage.tsxapp/src/features/meet/MascotFrameProducer.tsxapp/src/lib/i18n/chunks/en-5.tsapp/src/lib/i18n/en.tsapp/src/services/__tests__/meetCallService.test.tsapp/src/services/meetCallService.tssrc/openhuman/meet_agent/brain.rssrc/openhuman/meet_agent/mod.rssrc/openhuman/meet_agent/rpc.rssrc/openhuman/meet_agent/schemas.rssrc/openhuman/meet_agent/session.rssrc/openhuman/meet_agent/store.rssrc/openhuman/meet_agent/types.rs
Comment @coderabbitai help to get the list of available commands and usage tips.