Conversation
Reject inline task admission on an outgoing activity before it can wait for the session transition lock held by handoff. Preserve normal sibling task pause/resume and non-cancellable tool behavior. Add five regression cases covering sequential completion, both handoff windows, and concurrent shutdown, plus an agents patch changeset. Fixes livekit#2483
🦋 Changeset detectedLatest commit: c2419ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
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 |
Make every draining activity block new turns before onExit, including intermediate activities that were not current when updateAgent calls were queued. Add queued handoff and shutdown regressions, and verify that drain prevents new preemptive generation while preserving parked-reply cancellation coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2483.
Handoff holds the session transition lock while draining and closing the outgoing
activity. If an in-flight non-cancellable tool then calls
AgentTask.run(), it canwait for that same lock while activity shutdown waits for the tool to settle.
Reject late inline task admission with
ToolErrorwhen the owning activity hasblocked new turns or paused scheduling. Check after acquiring the inline-task
slot so a preceding sibling task can finish and resume the parent first. This
covers the handoff's
onExitwindow as well as the later scheduling drain, withoutchanging the tool cancellation policy or adding a public API.
Each activity also blocks admission at the start of its own drain, before
onExit. This covers queued handoffs whose earlierupdateAgent()calls bothblocked the original activity rather than the intermediate activity.
Adds a patch changeset and seven regression cases using real sessions/activities
with a fake LLM: successful sequential completion, late admission during each
handoff window, session shutdown during both windows, and two queued-handoff
cases with and without shutdown. On unmodified main, the sequential control
passes and both original late-admission cases time out. The queued-handoff cases
also time out on the initial PR commit before the drain-side admission fix.
Updates the preemptive-generation regression to assert that drain prevents new
work during
onExit, while retaining coverage for cancelling already-parked replies.Validation
(
vitest run agents/src --maxWorkers=2 --silent).including a separate run on Node 22.22.3.
checks pass.
no-explicit-anywarnings on unchangedlines of
agent_activity.ts.No live provider/audio integration tests were run.