Repository navigation
fix(server): stop one wedged provider stop from stalling every queued prompt - #123
Merged
Merged
Conversation
… prompt On 2026-08-20 every new prompt on bkmain sat in "Queued" for 80+ minutes. A Claude AskUserQuestion outlived its turn; stopSessionInternal cancelled pending approvals but not pending user inputs and then waited on Fiber.interrupt(streamFiber) with no bound, while the stream fiber sat in the uninterruptible Stream.fromAsyncIterable finalizer behind the SDK's pending canUseTool promise. The session reaper wedged first (holding the per-thread lifecycle lock); the owner's later Stop request then wedged the provider command reactor's single sequential worker lane, and every turn-start wake and session-set runDue queued behind it. The durable coordinator only ever learned about work through that lane, so it parked in Queue.take with runnable rows in the table. - ClaudeAdapter.stopSessionInternal: resolve pending user inputs and bound the stream-fiber interrupt (5s); query.close() still ends the runtime. - ProviderCommandReactor.processSessionStopRequested: bound providerService.stopSession (15s) so a stuck provider cannot hold the lane. - DurableExecutionCoordinator: bound every idle wait with a safety poll (10s) so a lost wake costs one poll instead of an outage. Regression test accepts work with no wake and drives only the clock; it times out on the previous code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
bkmain outage 2026-08-20 10:41–12:02 UTC: every new prompt stayed Queued. Root cause and fix:
AskUserQuestionoutlived its turn.ClaudeAdapter.stopSessionInternalcancelspendingApprovalsbut notpendingUserInputs, then waits onFiber.interrupt(streamFiber)with no bound; the stream fiber sits in the uninterruptibleStream.fromAsyncIterablefinalizer behind the SDK's pendingcanUseToolpromise.ProviderCommandReactor's single sequential worker lane, and everyturn-start-requestedwake /session-setrunDue queued behind it.DurableExecutionCoordinatoronly learned about work through that lane → parked inQueue.takewith runnable rows in the table.Changes
query.close()still ends the runtime.providerService.stopSession(15s) inprocessSessionStopRequestedso one provider cannot hold the lane.Test plan
DurableExecutionCoordinator.test.ts9/9 green;apps/servertypecheck green.deploy-bkt3.yml) green → auto-deploy to bkmain → queue probe stays GREEN and Stop on a session with a pending question returns within seconds.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.