[Bug]: Pending user-input popup can never be dismissed after the provider session dies (e.g. server restart) #5454
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web + apps/server
Summary#
If the provider session for a thread dies while a request_user_input / AskUserQuestion popup is pending — e.g. the user restarts the server, or the provider process exits — the popup becomes permanently stuck:
- The message can't be submitted. Submitting appends a
provider.user-input.respond.failedactivity whose detail is"No active provider session is bound to this thread.", but the box stays open. Every submit just adds another failure. - The popup can never be dismissed. The client only closes a pending user-input request on a
user-input.resolvedactivity or when a failure detail matches the "stale pending request" pattern. That detail does not match, so the request stays open indefinitely.
Related but distinct issues: #4060 (desktop, stuck on user input GUI) and #5119 (Claude adapter leaking pending requests on teardown). This one is provider-agnostic and also triggers on a plain server restart.
Steps to reproduce#
- Have an agent call
request_user_inputso the question card renders in the composer. - Restart the T3 server (or let the provider process exit) while the card is pending — the thread session becomes
stopped. - Type an answer and submit → error
No active provider session is bound to this thread., and the card stays open. - The card can never be closed, and the thread stays unsettleable.
Expected behavior#
Once the provider session is gone, the pending request is unanswerable and should be treated as terminal (like the existing Unknown pending user-input request stale path), so the popup closes and the thread can be settled or restarted.
Fix#
PR https://github.com/pingdotgg/t3code/pull/5453 treats the "No active provider session is bound to this thread." respond-failure detail as a stale pending request in the matchers shared by the web, mobile, server decider, and projection pipeline.
Same bug on t3 v0.0.40, remote SSH environment (desktop app 0.0.40 on Windows 11,
t3 serveon Ubuntu over SSH, Claude Agent provider). Adding the server-side evidence, since it pins down where the resolution is lost and shows there is currently no in-UI recovery.Timeline from
state.sqlite(orchestration_events) andlogs/provider/events.<thread>.log:UTC Event 09-12 21:32:45 user-input.requestedactivity appended (AskUserQuestion, 3 questions, request155e3af1…)09-12 22:49:55 Server going down for a restart. Provider log has CANON {"type":"user-input.resolved", "requestId":"155e3af1…", "payload":{"answers":{}}, "raw":{"method":"canUseTool/AskUserQuestion/resolved"}}followed byturn.completed {"state":"interrupted","errorMessage":"Session stopped."}andsession.exited09-12 22:50:02 New server Listening. Thread auto-continued (continueThreadsAfterServerUpdate: true), ran two more turns, ended 09-13 01:24 with a final assistant message. Idle session reaped 01:25:04.09-13 04:20 → 04:33 9 × thread.user-input-response-requestedfrom the client, each answered byprovider.user-input.respond.failed/No active provider session is bound to this thread.The
user-input.resolvedcanonical event at 22:49:55 was written to the provider log but never appended toorchestration_events. The lastuser-input.resolvedactivity for that thread in the event store is from 18:28 (an earlier request). SincederivePendingUserInputCountFromActivitiesonly closes a request onuser-input.resolvedor on the specific "stale/unknown pending user-input request" detail strings,pending_user_input_countstayed at 1 through two further server restarts.Why the user is locked out (0.0.40):
- While a card is pending, the composer sends the typed text as
thread.user-input.respond(answers keyed by question), not asthread.turn.start. A normal message therefore never reachesensureSessionForThread. processUserInputResponseRequestedreturns the "No active provider session" failure whenthread.session.status === "stopped"and never starts a session, so the respond path can never succeed once the reaper has run.thread.user-input.dismissrejects with "This question needs an answer. Answer it or stop the turn." unlessresponseMode === "message", so question cards cannot be dismissed.thread.turn.interrupthits the same "No active provider session" guard.
Workaround that worked (no DB edits, no restart): issue a token with
t3 auth session issue --base-dir … --ttl 20m --json, POST athread.turn.startcommand to/api/orchestration/dispatchfor the thread (this spawns a fresh provider session with--resume), then POST athread.user-input.respondfor the stale request id while the session is live. The adapter answersStale pending user-input request: … Provider callback state does not survive app restarts or recovered sessions., which the projection counts as resolved, and the card disappears. Revoke the token afterwards.Two fixes would each be enough: treat the "No active provider session" detail as terminal in the projection matchers (as #5453 proposed), or have the respond path call
ensureSessionForThreadlike a normal turn start does.- While a card is pending, the composer sends the typed text as
Confirmed on macOS desktop
0.0.43-nightly.20260916.1811with OpenCode.A valid
user-input.requestedactivity remained pending afterprovider.stopAllleft the projected sessionstopped. Three answer attempts each produced:No active provider session is bound to this thread.Each attempt appended another
thread.user-input-response-requestedandprovider.user-input.respond.failedpair.pending_user_input_countremained1, so the composer stayed blocked.The documented recovery of starting a resumed turn and then answering the stale callback worked, with one timing detail:
Dispatching
thread.turn.startchanged the session tostarting.Answering immediately failed with:
OpenCode is still loading this question. Try again.The request remained pending.
Waiting until the session reached
runningand answering again produced:Stale pending user-input request: <requestId>. Provider callback state does not survive app restarts or recovered sessions.pending_user_input_countthen became0, the card closed, and the resumed turn continued with the user’s answers.
This supports the approach in #10586. Native questions should be resolved when their provider session exits. If the manual resume workaround remains necessary, it must wait until the adapter is fully running rather than only
starting.Investigated with GPT-5.6 Sol via Codex in T3 Code.
Confirmed another occurrence on macOS T3 Code Nightly
0.0.43-nightly.20260929.2428with OpenCode1.18.33, this time after the OpenCode run was aborted while a blocking two-questionquestioncall was open (not just a server restart).Observed sequence in the local event store:
user-input.requestedat 13:27:07 UTC.thread.session-set→error(lastError: "Aborted") at 13:27:45; the question tool completed asfailed/Tool execution aborted; session →stoppedat 13:27:47.- Answer attempts from 13:27:52 through 13:36:42 each appended
provider.user-input.respond.failedwithNo active provider session is bound to this thread.The thread projection remainedpending_user_input_count = 1and the composer would not allow a new message. - The underlying OpenCode session still answered HTTP 200 and its resume cursor was intact, but the adapter had no live callback. T3’s
thread.user-input.dismisspath rejects a blocking question unlessresponseMode === "message"(This question needs an answer. Answer it or stop the turn.); the turn was already stopped.
The user was unblocked only by recording a
user-input.resolvedactivity for the orphaned request in the local event store/projection. No project files were changed. This is the same no-session stale-request handling gap described here, withAbortedas an additional trigger. It would help if stopping/aborting a provider run also terminally resolved its pending blocking question, or if the UI offered a recovery path when the session is stopped.Still reproduces on 0.0.45-nightly.20260930.2468 (macOS, desktop, Claude Agent provider). Two details that may be new:
1. The trigger was the restart continuation, and it stacked two orphaned cards. Timeline (UTC):
- 09-30 03:53: AskUserQuestion opens request A in turn T1. The session then dies with A open; T1 never gets a terminal event.
- 09-30 13:37: restart continuation sends "Continue where you left off." as a new turn T2 (no
thread.turn-start-requestedevent). The model sees its interrupted tool call and asks again: request B in T2. - 10-01 03:09: same again, turn T3. The model gives up on the tool and asks in plain text. T3 completes normally, but the terminal-turn cleanup only resolves requests whose
turnIdequals T3, so A and B both stay pending (pending_user_input_count = 2). - 10-01 03:44: session ->
stopped. Four answers to A at 05:03-05:04 each fail withNo active provider session is bound to this thread.
2. No startup reconciliation in this build. The bundled
apps/server/dist/bin.mjshas noreconcileOrphanedNativeUserInputsand nostartup:user-input-resolvedcommand ids (#14190 found them in 0.0.43-nightly.20260927, not firing). The only automatic cleanup left isterminal-user-input-resolved, keyed on the terminal turn's id, which a continuation turn never matches.Workaround from @letherman255's comment worked unchanged:
thread.turn.startvia/api/orchestration/dispatch, wait forrunning, then respond to each stale id ->Stale pending user-input request, count 0.Side note if the fix converts orphaned native questions to
responseMode: "message": that branch ofthread.user-input.respondrequires every answer to be a string, but the web client sendsmultiSelectanswers as arrays, so a converted multi-select AskUserQuestion would fail with "Answer each question before sending."Investigated with Claude Code (Opus 5.5).
juliusmarminge closed this
Sign in to join this conversation.
Hit the same stuck-composer failure on a pending approval (not user-input) with the Cursor provider.
What happened#
T3 Code 0.0.33 on Linux. Thread was Cursor
auto-smartin Full access. An MCP approval fort3-code-preview_navigatestayed in the composer after the Cursor ACP session died (provider.stopAllon server restart; projected sessionstopped).Cancel / Approve both fail with:
The composer stays locked on that card, so a new prompt cannot be sent. Cancel does not emit
approval.resolved. The failure detail is not treated as stale, sohasOpenBlockingRequest/derivePendingApprovalskeep the request open. This thread accumulated 50+provider.approval.respond.failedactivities on the samerequestId.projection_pending_approvalscan already showresolvedwhile the UI still blocks, because the web client derives the open card from activities (approval.requestedwith noapproval.resolvedand no matching stale-failure detail).Workaround that unblocked it#
Starting a live provider session (a new
thread.turn.start) and then responding again produced:That string does match the stale matcher, and the composer unlocked.
Why this comment#
#5454 is titled around user-input, but the same short-circuit and matcher gap applies to approvals. PR #5453 already says it covers both; this is a Cursor + approval repro of that path. Please consider broadening the issue title so approval-blocked composers are searchable.
Happy to provide more logs if useful.