Skip to content

fix(google): skip context replay on resumed realtime sessions - #2462

Open
rosetta-livekit-bot[bot] wants to merge 2 commits into
mainfrom
banter-entry-ravines
Open

rosetta-livekit-bot[bot] wants to merge 2 commits into
mainfrom
banter-entry-ravines

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • skip full chat context replay when Gemini Live reconnects with a resumption handle
  • diff against the context snapshot represented by the latest handle, including disconnected tool results and unsent queued items
  • add caller-provided sessionResumption configuration and a Google plugin patch changeset

Authoritative source: livekit/agents#6000

Source diff coverage
  • Adapted livekit-plugins/livekit-plugins-google/livekit/plugins/google/realtime/realtime_api.py to plugins/google/src/realtime/realtime_api.ts. Python channel event subclasses and async session flow are represented by TypeScript queue metadata, pending context state, handle snapshots, and async context diffing. The target lacked the existing Python caller-provided session resumption option, so that prerequisite was added and reflected in plugins/google/etc/agents-plugin-google.api.md.
  • Adapted tests/test_plugin_google_realtime.py to plugins/google/src/realtime/realtime_api.test.ts. All eight tests added by source PR #6000 were ported using Vitest and fake Google Live sockets; no additional behavioral scenarios were added.
  • Not applicable: None. Every source diff file has a target counterpart and was ported.

Validation

  • pnpm test plugins/google (84 passed, 2 skipped)
  • pnpm build
  • pnpm --filter @livekit/agents-plugin-google lint (passes with 3 existing warnings)
  • pnpm --filter @livekit/agents-plugin-google api:check
  • Prettier check for changed source, tests, and changeset

Root pnpm lint was also run, but the repository baseline currently fails on the unrelated existing plugins/openai/src/ws/llm.ts:127 no-misused-promises error.

cue-cli runtime validation could not be run because this environment has LiveKit credentials but no GOOGLE_API_KEY or workspace .env. The ported fake Live socket tests validate reconnect, tool-result, queued-send, and failed-send behavior without provider credentials.

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner September 9, 2026 10:07
@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a9d30e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 38 packages
Name Type
@livekit/agents-plugin-google Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-azure Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-krisp Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-protoface Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from longcw September 9, 2026 10:07

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

super(realtimeModel);

this.options = realtimeModel._options;
this.sessionResumptionHandle = this.options.sessionResumption?.handle;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Transparent resumption never activates

When sessionResumption.transparent is enabled, the constructor retains only handle. buildConnectConfig therefore omits the flag, so reconnects cannot use server consumption indexes.

Prompt for agents
Preserve the complete caller-provided sessionResumption configuration in RealtimeSession instead of extracting only its handle. buildConnectConfig must forward fields such as transparent while replacing or adding the latest server-issued handle. Also account for transparent mode's lastConsumedClientMessageIndex contract if the plugin claims transparent reconnect behavior.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants