Skip to content

fix(phonic): reuse realtime session across handoffs#1838

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
1.5.0from
chid-mortared-breaches
Open

fix(phonic): reuse realtime session across handoffs#1838
rosetta-livekit-bot[bot] wants to merge 1 commit into
1.5.0from
chid-mortared-breaches

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reuse the existing Phonic realtime websocket across agent handoffs via mid-session reset
  • share config/tool payload construction between initial config and reset
  • close any active generation before replacing handoff chat context

Testing

  • pnpm --filter @livekit/agents build
  • pnpm --filter @livekit/agents-plugin-phonic build
  • pnpm exec prettier --check "plugins/phonic/src/realtime/realtime_model.ts" ".changeset/reuse-phonic-handoff-ws.md"

Ported from livekit/agents#6163

Original PR description

already supported in JS

@changeset-bot

changeset-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4f2eea2

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

This PR includes changesets to release 35 packages
Name Type
@livekit/agents-plugin-phonic Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai 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-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld 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-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-plugin-trugen Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test 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

@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.

Open in Devin Review

}),
audio_speed: this.options.audioSpeed,
tools: toolsPayload,
...(toolsPayload.length > 0 && { tools: toolsPayload }),

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.

🚩 Conditional tools field omission changes reset semantics

In the new buildConfigOptions at line 860, tools is only included when toolsPayload.length > 0. The old code always sent tools (even as []) in both the initial config and reset messages. This is a semantic change: when an agent with no tools takes over during a handoff, the reset config will omit the tools field entirely rather than sending tools: []. Whether this correctly clears old tools depends on how the Phonic server interprets a reset with a missing tools field — as "no tools" (full replacement) vs "keep existing tools" (partial update). Since the message type is reset and the config includes all other fields unconditionally, full replacement seems intended, but this should be verified against the Phonic API docs.

Open in 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