Repository navigation
fix(server): stop provider handoffs from leaving threads stuck - #1085
Merged
Merged
Conversation
Switching a thread between providers could let the outgoing provider's session.exited event overwrite the newly bound session back to the old provider, causing ProviderRuntimeIngestion to drop every event from the live session and freeze the thread on Preparing turn. A concurrent listSessions() call during that same handoff window could also die on a transient provider/binding mismatch. Guard runtime session updates against stale provider instances, in-flight launches, and participant handovers in both ProviderRuntimeIngestion and the orchestration decider, rebind drifted projections when reusing a live runtime without dropping an active turn, stop leaking the outgoing providerThreadId across handoffs (and populate it on ACP sessions), and omit only the in-transition session pair in ProviderService.listSessions() while a replacement start is in flight.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
badcuban
enabled auto-merge
November 24, 2026 06:36
The handoff and rebind test checked session.status === "running" immediately after sendTurn was invoked, before the forked markProviderTurnAccepted fiber finished on slower CI runners. Wait for both sendTurn and the running projection before asserting or advancing to the next step.
This branch was previously deployed
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.
Switching a thread between providers could let the outgoing provider's
session.exitedevent overwrite the newly bound session back to the old provider. Once the projected session and live runtime disagreed,ProviderRuntimeIngestiondropped every subsequent event from the live provider as stale and left the thread stuck onPreparing turn. During the same handoff window, concurrentProviderService.listSessions()calls (such asCheckpointReactor) could also die on a transient binding mismatch.Fix
thread.session.setcommands to match the thread's current participant, provider instance, and in-flight launch target in bothProviderRuntimeIngestionand the orchestration decider (requireCurrentSession).readythreads (such as goal updates) as launching so outgoing exit events are blocked before the new bind lands.ProviderCommandReactor.ensureSessionForThreadreuses a live runtime, preserving any active turn ID.providerThreadIdonto a different provider/driver inbindSessionToThread, and includeproviderThreadIdonAcpAdapter's returnedProviderSession.ProviderService.listSessions()so concurrent callers skip only the in-transition half while genuine out-of-band binding corruption still dies.