Skip to content

Conversation

@jjsquillante
Copy link
Contributor

Description

Ensure tool calls are not aborted when preamble text forwarding stops. It refines the execution flow so that cleanup of preamble forwarders does not propagate an abort to in-flight tool executions. It also introduces tests around tool execution behavior.

Changes Made

agents/src/voice/agent_activity.ts

  • Adjust logic to decouple preamble forwarding cleanup from tool execution abort signals, ensuring tool calls continue and complete as expected.

agents/src/voice/generation_tools.test.ts

  • Add tests

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included

Testing

  • Automated tests added/updated (if applicable)
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes


Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.

@changeset-bot
Copy link

changeset-bot bot commented Oct 8, 2025

🦋 Changeset detected

Latest commit: a82ef4e

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

This PR includes changesets to release 12 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-silero 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

@CLAassistant
Copy link

CLAassistant commented Oct 8, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@toubatbrian toubatbrian left a comment

Choose a reason for hiding this comment

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

Nice finding! Suggest a small improvement (no need to manually create abortController as Task itself will auto spawn a new one if we do not specify inside Task.from:

    const messageOutputs: Array<[string, _TextOut | null, _AudioOut | null]> = [];
    const tasks = [
      Task.from(
        (controller) => readMessages(controller, messageOutputs),
        undefined,
        'AgentActivity.realtime_generation.read_messages',
      ),
    ];

Copy link
Contributor

@toubatbrian toubatbrian left a comment

Choose a reason for hiding this comment

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

Add some comments

@toubatbrian
Copy link
Contributor

toubatbrian commented Oct 8, 2025

One final request: could you double-check the use case you're aiming to implement with this fix? Once you're happy with it, I’ll go ahead and merge. Thanks again for helping dig into and spot this super tricky bug!

Also, please add a changeset to patch update the agent-js package. Let me know if you need any help!

@jjsquillante
Copy link
Contributor Author

absolutely -- i've been testing this morning and all is working well. (now that i updated the controller in the forwarders 🤦 ).

i'll add a changeset -- also, would you mind if i open a separate PR to update the contributing.md file? It was confusing because it asked that I commit to the next branch but when i looked at the branch it hadn't been used in over 6 months.

@jjsquillante
Copy link
Contributor Author

@toubatbrian added changeset to patch -- thank you for the quick review and help on this!

As an aside, the code is very readable and well documented -- it's been a great experience and I very much appreciate the work yall are doing at LiveKit!

@toubatbrian
Copy link
Contributor

i'll add a changeset -- also, would you mind if i open a separate PR to update the contributing.md file? It was confusing because it asked that I commit to the next branch but when i looked at the branch it hadn't been used in over 6 months.

@jjsquillante Yes, please feel free to open a separate PR for that. I got the same ask once and updated the contributing section in the README, but totally forgot to update contributing.md.

@toubatbrian toubatbrian merged commit 25b2030 into livekit:main Oct 8, 2025
5 checks passed
@github-actions github-actions bot mentioned this pull request Oct 8, 2025
@Shubhrakanti
Copy link
Contributor

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.

4 participants