Skip to content

feat(perception): live-call video ingest → cognition (#192 see path) - #1963

Merged
joelteply merged 2 commits into
canaryfrom
feat/perception-live-ingest
Jul 19, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/perception-live-ingest

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

Wires the live-call video ingest into perception (#192): a speaker's decoded frame now lands in every AI-persona-viewer's PerceptionBuffer on a live call. This is the see half of the headless two-persona-call proof. Read side was already wired (supervisor → MediaPerceptionSource); this closes the write side.

Path (guide-compliant — no new thread, no parallel manager)

bridge reader thread  (BridgeEvent::VideoFrame — already JPEG @ ~1fps)
  → perception_ingest::try_enqueue   non-blocking post onto a process-global mpsc
                                      (the CONCURRENCY-STYLE-GUIDE "here is work"
                                      boundary; drops silently until drain is up)
  → drain task  (spawned in VoiceModule::initialize, on the runtime)
  → VoiceService::video_viewers(call_id)   all AI Persona|Agent in the session
                                           (NOT gated on is_audio_native — vision
                                           is universal; humans excluded)
  → FrameIngest::fan_out   compute-once/share-many; a persona never sees its own frame

Commits

  1. FrameIngest core — pure fan-out, decoupled from LiveKit, 3 unit tests (fan-out lands in every viewer, self-skip, empty-roster no-op).
  2. Transport wiring — IngestFrame + mpsc OnceLock boundary; the bridge_client.rs:731 VideoFrame TODO-drop becomes a try_enqueue; video_viewers roster query; VoiceState gains a LateBound<CommandExecutor> (the Muted AI Spam Bug #224 slot) filled by install_executor, and initialize() spawns the drain. The vision describer builds lazily once the executor is installed, then is reused — so N viewers of one frame share ONE describe.

Human frame rate is protected by construction

The point you flagged. The ingest never touches the human display plane:

  • It reads a JPEG copy the bridge already made — the LiveKit video track is untouched.
  • The bridge already caps upstream at ~1 fps; the mpsc post is non-blocking (unbounded send from the reader thread — the audio path in the same loop is never blocked).
  • PerceptionBuffer coalesces-to-latest and gates warms to ~2 Hz per participant, so 1fps in never becomes a describe storm.
  • describe runs on the served VL model's lane; compute-once means one inference per distinct frame regardless of viewer count.

Tests

51 green (fan-out ×3, video_viewers policy ×1, existing orchestrator + perception::look suites). cargo check clean.

Acceptance = live validation (the see path)

Deploy + a two-persona (or human+persona) video call. Confirm: (1) human video stays smooth, (2) audio unaffected, (3) each persona's perception surfaces the other's frames (buffer populated, describe warms) — watch perception_ingest fanned-N logs + the persona cognition log. #193 (call_id==room_id unify) is adjacent, not a blocker.

🤖 Generated with Claude Code

joelteply and others added 2 commits July 18, 2026 22:00
…ry viewer's perception (#192 core)

The WRITE side of live-call perception, decoupled from LiveKit so it's testable
without a live call. One decoded frame from a speaker fans out to each AI
persona-viewer's PerceptionBuffer, keyed by the speaker's airc identity:

  - compute-once/share-many: builds the MediaFrame once; describe/scale run once
    per content-hash on the shared cache even across N viewers (the vision moat).
  - a persona never observes its OWN outbound avatar frame (self-skip on identity).
  - stateless: holds only the shared describer, never call/roster state — the
    live-call lifecycle owns "who is in the call" (not a parallel manager).

3 tests green (fan-out lands in every viewer, self-skip, empty-roster no-op).
The transport wiring (bridge VideoFrame → mpsc → drain task → fan_out) lands
next; its acceptance is a live two-persona call.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
The transport that feeds FrameIngest: a speaker's decoded frame now lands in
every AI-persona-viewer's PerceptionBuffer on a live call.

Path (all guide-compliant, no new thread, no parallel manager):
  bridge reader thread (BridgeEvent::VideoFrame, already JPEG @ ~1fps)
    → perception_ingest::try_enqueue  [non-blocking post onto a process-global
      mpsc — the guide's "here is work" boundary; drops silently until the drain
      is up]
    → drain task (spawned in VoiceModule::initialize, on the runtime)
    → VoiceService::video_viewers(call_id)  [all AI Persona|Agent in the session;
      NOT gated on is_audio_native — vision is universal; humans excluded]
    → FrameIngest::fan_out  [compute-once/share-many; self-skip]

Seams:
- perception_ingest.rs: IngestFrame + INGEST_SINK OnceLock<mpsc Sender> +
  install_channel() (drain owns the receiver) + try_enqueue() (bridge-thread safe).
- bridge_client.rs:731: the VideoFrame TODO-drop becomes a try_enqueue; the
  human display plane (the LiveKit track) is untouched — this reads a copy.
- orchestrator/voice_service: video_viewers(session) roster query.
- modules/live.rs: VoiceState gets LateBound<CommandExecutor> (the #224 slot),
  VoiceModule::install_executor fills it, initialize() spawns the drain. The
  vision describer is built lazily once the executor is installed, then reused —
  so N viewers of one frame share ONE describe.

Human frame rate is protected by construction: the ingest is a non-blocking
sample of a copy; PerceptionBuffer coalesces-to-latest + gates warms to ~2Hz, so
1fps in never becomes a describe storm and the display track never stalls.

51 tests green (fan-out ×3, video_viewers policy ×1, existing orchestrator/look
suites). cargo check clean. Acceptance = live two-persona call (see path).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 3292382 into canary Jul 19, 2026
4 checks passed
@joelteply
joelteply deleted the feat/perception-live-ingest branch July 19, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant