host-daemon: give unanswered user questions a ten-minute deadline - #1775
Open
DarrenTsung wants to merge 1 commit into
Open
host-daemon: give unanswered user questions a ten-minute deadline#1775DarrenTsung wants to merge 1 commit into
DarrenTsung wants to merge 1 commit into
Conversation
…A-237) A native user-question request (claude-code's AskUserQuestion via interaction/request) registered with the server but answered by nobody resolves only when a client answers or the provider exits, so an unattended thread hangs for hours and the human's replies queue behind a turn that never ends. registerAndWait now arms a ten-minute deadline for user-question payloads (the same default bb.ui.requestInput already uses for plugin interactions). On expiry the entry is dropped and rejected with interactive_request_timeout, which propagates to the provider bridge as an RPC error and resolves the tool call as a denial telling the model to ask in prose instead; onTimeout lets app.ts push the interrupt to the server so the still-pending row does not leave the thread stuck "already awaiting user interaction". Approvals keep their existing no-deadline behavior.
Author
|
Oops, I didn't even realize my agent would create this. But yeah I've had a few bb threads stuck behind a AskUserQuestion that never resolved and got interrupted for some reason. So I couldn't even answer the question when I realized the thread was waiting for me, needed a manual stop and new message to bump the thread. |
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.
Problem
A native user-question request — claude-code's
AskUserQuestionforwarded overinteraction/request— registers with the server and then resolves only when a client answers or the provider exits. With nobody watching the thread, theregisterAndWaitpromise never settles: the turn never ends and the human's typed replies queue behind it (measured: a question pending 2h30m, the reply delivered 13 minutes later as an abort).The plugin interaction path (
bb.ui.requestInput) already defaults to a ten-minute timeout; the native path has none (expiresAt: null).Fix
InteractiveRequestRegistry.registerAndWaitnow arms a ten-minute deadline foruser_questionpayloads (approvals keep their current behavior). On expiry the entry is dropped and rejected withinteractive_request_timeout, which propagates to the provider bridge as a JSON-RPC error and resolves the tool call as a denial telling the model to ask in prose instead — one wasted turn instead of a multi-hour hang. A newonTimeoutoption (wired inapp.tsto the existing interactive-interrupt push) marks the server row interrupted so the thread is not left stuck "already awaiting user interaction".Tests
interactive-request-registry.test.ts: rejects an unanswered user question at the deadline (fails on the old code — the promise never settles), applies no deadline to approvals, clears the deadline when answered in time, and does not time out a question whose registration failed.@bb/host-daemonsuite (586 tests) and typecheck pass.