Skip to content

fix(generation): preserve LLM-supplied call_id instead of overwriting with item id#1524

Open
toubatbrian wants to merge 2 commits into
mainfrom
brian/fix-test
Open

fix(generation): preserve LLM-supplied call_id instead of overwriting with item id#1524
toubatbrian wants to merge 2 commits into
mainfrom
brian/fix-test

Conversation

@toubatbrian
Copy link
Copy Markdown
Contributor

Summary

voice/generation.ts was overwriting the LLM-supplied callId with the generation's per-item UUID. Python keeps these two identifiers distinct (id = framework item id, call_id = the LLM's identifier that pairs function_callfunction_call_output). This change restores that separation, matching livekit-agents/.../generation.py:170-176.

// before
const toolCall = FunctionCall.create({
  callId: `${data.id}/fnc_${data.generatedToolCalls.length}`,
  name: tool.name,
  args: tool.args,
  ...
});

// after
const toolCall = FunctionCall.create({
  id: `${data.id}/fnc_${data.generatedToolCalls.length}`,
  callId: tool.callId,
  name: tool.name,
  args: tool.args,
  ...
});

Also fixes examples/src/testing/basic_task_group.test.ts > summarizeChatCtx, which was failing because its FakeLLM mock used the old pre-XML prompt format and [history summary] literal. Updated to match what ChatContext._summarize actually emits; now deterministic since fake_call_0 survives end-to-end.

Why this matters

Downstream providers (OpenAI, Anthropic, Gemini, etc.) emit their own tool_call_id that we must echo back in function_call_output so the provider can correlate the call. Overwriting it silently inverted the invariant from Python.

Test plan

  • pnpm build:agents && pnpm vitest run examples/src/testing examples/src/frontdesk/test_agent.test.ts examples/src/drive-thru/test_agent.test.ts — 75/75 pass (was 74/75)
  • Full pnpm test — no new regressions; remaining failures (AMD logic, plugin TTS VAD setup, missing API keys) reproduce on main

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 17, 2026

🦋 Changeset detected

Latest commit: a6fa864

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

This PR includes changesets to release 31 packages
Name Type
@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-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-phonic 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-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

@toubatbrian toubatbrian requested a review from a team May 17, 2026 08:00
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6fa86460f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/src/testing/basic_task_group.test.ts
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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.

1 participant