Skip to content

Fix draining behaviour - #1180

Merged
lukasIO merged 12 commits into
mainfrom
lukas/fix-draining
Apr 1, 2026
Merged

Fix draining behaviour#1180
lukasIO merged 12 commits into
mainfrom
lukas/fix-draining

Conversation

@lukasIO

@lukasIO lukasIO commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Description

  • reject job requests if the worker is draining
  • ensure the worker stay in WS_FULL status when draining
  • adopt Throws type for job executor and handle exceptions instead of throwing unhandled exceptions

Changes Made

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
  • Video demo: A small video demo showing changes works as expected and did not break any existing functionality using Agent Playground (if applicable)

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.

@lukasIO
lukasIO requested a review from toubatbrian March 30, 2026 10:44
@changeset-bot

changeset-bot Bot commented Mar 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3b1a7b8

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

This PR includes changesets to release 22 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-livekit 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-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

devin-ai-integration[bot]

This comment was marked as resolved.

lukasIO and others added 4 commits March 30, 2026 13:38
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Comment on lines +13 to +17
start(): Promise<Throws<void, Error>>;
join(): Promise<Throws<void, Error>>;
initialize(): Promise<Throws<void, Error>>;
close(): Promise<Throws<void, Error>>;
launchJob(info: RunningJobInfo): Promise<Throws<void, Error>>;

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.

Maybe we can make a dedicated Error class for these operations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, that would be nice, just didn't want to blow this PR out of scope

Comment thread agents/src/utils.ts
return await abortFuture.await;
}

export async function rejectOnAbort(signal: AbortSignal): Promise<never> {

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.

Can we annotate this with Throws?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the annotation to be accurate we'd have to ensure that controller.abort can only be called with a certain type of error, which means we'd need a more strictly typed version of AbortSignal as well

lukasIO and others added 3 commits March 31, 2026 11:50
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@lukasIO
lukasIO requested a review from toubatbrian March 31, 2026 10:32
@lukasIO
lukasIO merged commit 3fee5c2 into main Apr 1, 2026
8 checks passed
@lukasIO
lukasIO deleted the lukas/fix-draining branch April 1, 2026 11:30
@github-actions github-actions Bot mentioned this pull request Apr 1, 2026
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.

2 participants