Skip to content

host-daemon: give unanswered user questions a ten-minute deadline - #1775

Open
DarrenTsung wants to merge 1 commit into
get-bb:mainfrom
DarrenTsung:boa-237-user-question-deadline
Open

host-daemon: give unanswered user questions a ten-minute deadline#1775
DarrenTsung wants to merge 1 commit into
get-bb:mainfrom
DarrenTsung:boa-237-user-question-deadline

Conversation

@DarrenTsung

Copy link
Copy Markdown

Problem

A native user-question request — claude-code's AskUserQuestion forwarded over interaction/request — registers with the server and then resolves only when a client answers or the provider exits. With nobody watching the thread, the registerAndWait promise 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.registerAndWait now arms a ten-minute deadline for user_question payloads (approvals keep their current behavior). On expiry the entry is dropped and rejected with interactive_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 new onTimeout option (wired in app.ts to 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.
  • Full @bb/host-daemon suite (586 tests) and typecheck pass.

…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.
@DarrenTsung

Copy link
Copy Markdown
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.

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.

1 participant