Repository navigation
Description
Context
On a hosted 0.44.0 install, one governed Claude session shows a pending question card lost when its turn ended, followed by provider error text rendered as the agent's reply:
- The first turn called
ask_userabout 85 s after it started. The card stayed pending for about 29 minutes. The turn's lifecycle record then ended with outcometimeout, and the server loggedturn timed out. - When the turn ended, the call's result was
The tool call was interrupted before a result was received. It may or may not have completed on the server. Within one second the runtime logged threeapi_errorentries,Unable to connect to API (ENOENT), because the turn's relay socket was already gone. - When the user next wrote in the session, about 90 minutes later, the transcript gained a synthetic assistant message, model
<synthetic>, with the textNo response requested.. The user then typed the answer to the lost question by hand. - Later in the same session a turn was cancelled four seconds after the user sent a message. Its transcript holds a synthetic assistant message reading
API Error: 499 Inference request cancelled. The user re-sent a corrected message.
The 0.43.x sessions in the same retained history show the same No response requested. message seven more times. Each followed an aborted or interrupted turn.
packages/ui-backend-claude/src/history.ts:276 already recognises "No response requested." as a fallback notice when reading history. What the user sees for such turns, and what happens to a pending card when its turn ends, is the gap.
Scope
- Apply selected A to
ask_user,ask_user_list,ask_user_rankandask_user_form: after the owning turn ends, retain the question and available answer/draft with a truthful ended state and an explicit Send as message recovery action. Do not silently lose the answer or automatically start a continuation merely because a late answer was entered/submitted to the old card. The recovery action sends an ordinary new message carrying the relevant question and user's answer under current session/principal admission; it does not settle the ended tool call. - A turn that ends by timeout while a card is pending says so in the conversation. The user should not have to discover it.
- Apply selected A to confirmed runtime-authored synthetic SDK notices: show a concise system/turn status rather than agent reply prose. Use actual lifecycle/SDK evidence for timed out, cancelled, interrupted or connection-failure wording; otherwise show a generic runtime notice without inventing a cause. Consolidate repeated observations of the same turn/outcome while preserving distinct actionable failures and the partial model answer. Do not broadly hide diagnostics or classify genuine user/model text by matching these phrases alone.
- Keep the current hard elapsed-time timeout, including time waiting for a user answer. Do not pause/reset/extend it for a pending question or introduce a separate execution/waiting allowance. Retain configured timeout values and all other authorization/resource/worker cleanup guards. When it expires, make the actual timeout visible and preserve the selected ended-card recovery.
Out of scope
- The causes of the
ENOENTandECONNRESETerrors; the relay is torn down with the turn, and that is expected. - WebFetch refusals in the same session (ui-server: the Claude runtime's own api.anthropic.com traffic taints every governed turn, blocking WebFetch and reranking #3244).
- Voice-mode cards.
Acceptance criteria
- A test drives a turn to timeout with a pending question, including typed but not submitted data. The ended card retains its question and available answer/draft; the answer remains recoverable through explicit Send as message. Exercise all four ask kinds. The test must fail on the current loss/hidden-recovery behavior before the fix.
- Entering/submitting data against an ended card never marks its old request accepted or silently triggers a continuation. Only explicit Send as message starts an ordinary newly admitted message carrying the relevant question and answer once. Preserve original principal/session/request identity, answer queue receipts/status checks and idempotency; unknown delivery is not permission to duplicate an accepted answer. Do not route recovery into another visible chat/principal or a retired/deleted identity.
- Provider history remains append-only: relevant question/answer recovery is new tail content only; never replace the old interruption/tool result or change earlier tools/system/messages. UI receipts/status/diagnostics remain internal. No automatic resend of an unsubmitted draft.
- Confirmed runtime-authored synthetic
No response requested.,API Error: 499 Inference request cancelledand interrupted/API-error variants render as concise system/turn status, never authored agent answer prose, both live and after history/reconnect/reload. Preserve an actual partial answer and its tool timeline. An existing correctly classified failure remains correct; add failing-first witnesses for the actual remaining gap rather than claiming every API error currently fails. - Use observed lifecycle/SDK facts for the cause: actual timeout says timed out; actual cancellation says cancelled; observed connection failure says connection failure. A generic fallback without that evidence remains a generic runtime notice. Status/code text alone does not prove who cancelled, whether prior effects occurred or that nothing was sent/written. Repeated observations of the same terminal cause produce one coherent status, not duplicate assistant replies/alerts; distinct actionable auth/billing/usage failures remain available through existing approved recovery.
- Negative controls preserve genuine assistant/user text quoting “No response requested.” or “API Error: …”. Classification uses authoritative runtime provenance plus the installed SDK evidence, not a global text scrubber. A live/replayed status for one turn/session must not relabel a different turn, a successful parent after a subagent failure or a different principal's history.
- Reuse the existing answer-delivery footer and D51 in-turn failure/status presentation, with accessible names, keyboard activation, 44px targets, focus preservation, 320px/200% wrapping and both themes. A live terminal update announces politely once without stealing answer/composer focus; history/reload replay does not repeat live alerts. Synthetic provider text is safe text/redacted detail under the existing diagnostics policy, never markup or a source of action authority.
- The existing configured hard deadline still expires while any of the four ask kinds is pending, counting user-wait time. Test expiry at the original elapsed-time deadline, not a reset from question arrival or a later user interaction. Preserve actual timeout lifecycle outcome, pending-request drain and cleanup ownership; do not turn a timeout into successful completion.
- The timeout decision/rationale is recorded in the PR and relevant existing decision guidance: resource lifetime remains bounded, and users returning late recover through explicit Send as message instead of keeping a worker open indefinitely. Test that a timely answer remains normally receipt-confirmed and that timeout/answer races settle only the winning outcome.
Verification
Use keyless/offline runtime and actual pinned-browser fixtures; no real provider credentials, production access or relay-root-cause experiment is needed. Inspect the cited anchors against the implementation base and update moved citations in the PR.
- Extend the real turn coordinator/bridge test path with a short configured timeout and an admitted pending ask. Assert timeout at the original elapsed-time deadline, pending drain and genuine cleanup settlement, then exercise retained card state and explicit new-message recovery. Cover all four ask kinds, typed/unsubmitted and queued/unconfirmed answers, timely receipt, answer/timeout races, duplicate delivery, reload/reconnect and session/principal switches. Keep prior accepted answers and unrelated drafts/cards intact.
- Start from
packages/ui-backend-claude/tests/history-api-failure.test.ts,history.test.tsandstream-adapter.test.tsfor known runtime synthetic/provenance fixtures. Pair live/replay assertions with genuine quoted-text and successful-parent/subagent negative controls. Test actual rendered status/partial answer preservation and one-time announcements, not only a classifier predicate. - Extend
packages/ui-react/tests/answer-delivery-runtime.test.ts,answer-delivery.test.ts,chat-store-history.test.tsand the existing render/browser harness as applicable. Run a real browser through pending card → timeout → retained typed answer → explicit Send as message → newly admitted message, with no send before the explicit action and no false acceptance of the old request. Include keyboard/focus, 320px/200% text and replay without duplicate alerts. Restore complete browser globals/mocks. - Preserve relevant provider-history guards for both backends when touching new-message/tail assembly; use local scripted endpoints only. Do not change native transcript bytes or old tool results to obtain a passing UI test.
- Record a failing-first loss/hidden-recovery witness and restored meaningful mutations for clearing answer data/hiding Send as message, false old-request acceptance or unintended automatic continuation, and synthetic-as-agent rendering. Each named assertion must fail for the claimed reason and pass restored. Existing passing error classifications are regression controls, not failing-first receipts.
Run the affected suites through bun run test, relevant typecheck/lint, pinned browser checks and bun run check:pr --base origin/main before the implementation PR. No runtime/test completion is claimed by this issue triage.
Contract impact
Reuse the shipped ended/closed request receipts and recovery presentation where possible; no new expired-state/event is assumed necessary. If live/history status provenance requires an additive supported frame, history field or package API, update the relevant authoritative integration-contract component and API report in the same CONTRACT-prefixed implementation commit, apply contract labeling and an appropriate minor changeset. No broader breaking change, answer-tool schema/name change, queue-bound expansion, timeout-number change or rewritten provider prefix is approved. Pure presentation fixes still need their appropriate changeset under existing policy.
All three choices are recorded below. Remove needs: decision; add agent-ready because no other needs: prerequisite remains. Reuse the existing reviewed answer-delivery and D51 status/error patterns rather than requiring another generic design. Implementation and proof remain work to do; no release commitment is selected.
Selected late-answer recovery — maintainer, 2026-11-02
A — ended card with explicit Send as message. Preserve the question and available answer/draft when the owning turn ends. Show that the old request ended and offer the already established explicit new-message recovery; do not automatically start a continuation or claim that a late submission answered the ended tool call. This costs an extra action but keeps the new-message intent clear.
This follows docs/decisions/answer-delivery.md's existing Closed/Expired recovery ruling, including exact identities, receipts/status reconciliation, original-principal persistence/admission and no automatic sending of an unsubmitted draft. Preserve structured list/rank/form meaning in the new message without inventing answers or crossing the original chat binding. Keep previous provider history byte-identical; only the selected new-message content goes in the new tail. Runtime implementation must reuse the existing recovery path rather than introduce a second answer queue or silently expand its retention/bounds.
The source-backed gap is how turn timeout/terminal handling reaches that existing recovery: run-session.ts drains pending requests at timeout, while the UI terminal path and answer-delivery Closed/Expired state must keep content and controls recoverable. At inspected main 0dab179b1bc393b44f6749b74cb1ca01804c1666, the cited synthetic fallback anchor remains valid (SYNTHETIC_MODEL, packages/ui-backend-claude/src/history.ts:270-288); inspect live/history/error paths together and do not rewrite the native transcript to fix presentation.
The later rulings below also settle timeout accounting and synthetic-status presentation. No implementation, successful runtime reproduction or release commitment is claimed by this late-answer ruling.
2026-11-02 interactive late-answer ruling: selected A, preserve ended-card answers and offer explicit Send as message under the existing answer-delivery policy. Folded this branch into scope/acceptance criteria. Retain needs: decision for timeout and diagnostic-presentation choices.
Selected timeout accounting — maintainer, 2026-11-02
A — keep the existing elapsed-time hard limit, including user waits. Pending questions do not pause, reset or extend the timeout. Keep configured values and independent authorization/resource/worker-lifetime guards unchanged; do not add a separate waiting allowance. This retains bounded resource lifetime and the current hard-timeout contract, accepting that a question can end while the user is away. The selected explicit Send as message recovery covers that return path instead of indefinitely retaining a worker.
At inspected main 0dab179b1bc393b44f6749b74cb1ca01804c1666, the timeout callback in packages/ui-server/src/ws/run-session.ts:388-402 aborts and drains pending requests, and the SDK's existing hard-timeout description includes paused time in packages/ui-sdk/src/server/worker-sandbox.ts:656. Preserve this governing rule and actual cleanup ownership; make the timeout visible in the conversation and keep answer data recoverable rather than hiding the question or inferring it was answered.
The later status-presentation ruling below completes the review. No changed timeout number, new budget, implementation/proof or release commitment is selected by this timeout ruling.
2026-11-02 interactive timeout ruling: selected A, user-wait time continues to count against the existing hard elapsed-time deadline. Folded the choice and rationale into scope/acceptance criteria. Retain needs: decision for the diagnostic-presentation choice only.
Selected synthetic SDK presentation — maintainer, 2026-11-02
A — concise system/turn statuses, not agent replies. Runtime-authored synthetic notices explain a stopped turn without impersonating model prose. Prefer the established D51 in-turn status/error presentation; consolidate duplicate observations of the same outcome without suppressing distinct actionable failures. Keep whatever partial answer the model actually gave. This preserves useful context at the accepted cost of status entries.
Use actual evidence for cause wording. No response requested. alone does not prove cancellation or connection loss; present a generic runtime notice when no more specific lifecycle/SDK evidence exists. Preserve genuine authored quotations unchanged. Keep ordinary timeout/failed-turn feedback, auth/billing/usage recovery and unknown-delivery controls; showing a notice cannot trigger retry, mark an answer accepted or infer no prior effects. Do not rewrite the provider's retained history to alter display.
Source and existing design to hold
Inspected source is main 0dab179b1bc393b44f6749b74cb1ca01804c1666; this pass reads that ref without changing this worktree. endTurnQuestions, packages/ui-react/src/stores/chat-state.ts:1824-1833, currently terminalizes exchanges. SEND_AS_MESSAGE_NOTE, packages/ui-react/src/lib/answer-delivery/copy.ts:19, already names explicit new-message recovery, and AnswerDeliveryStatus's action dispatch calls its explicit recovery callback. Reuse this path and preserve its receipt/persistence/queue rules.
apiErrorFailure, packages/ui-backend-claude/src/history.ts:296-328, already recognizes some synthetic API failures; the assistant-entry branch at packages/ui-backend-claude/src/history.ts:176-189 attaches them as failures rather than model text. The live assistant branch at packages/ui-backend-claude/src/stream-adapter.ts:136-157 likewise captures known SDK errors. Review both paths and their fallbacks; do not undo existing classification or guess that every reported case still fails identically on current main.
Read docs/decisions/answer-delivery.md, docs/decisions/provider-history.md and D51 in docs/decisions/design-kit/components-and-interactions.md, plus the native parent epic #734. Preserve existing failure attribution, in-turn partial-answer composition, safe/redacted diagnostics, once-only live announcements and replay behavior. Record the applied choice/gap repair in the relevant existing guidance during implementation; no new generalized error service, UI kit component or answer queue is needed by this brief.
2026-11-02 final interactive ruling: selected A for synthetic statuses. Together with A explicit ended-card Send as message and A unchanged elapsed-time timeout, all current policy/scoping questions are answered and folded into scope/acceptance/verification. Remove needs: decision and add agent-ready: no other needs label or actual external prerequisite remains. This tracker edit does not implement the repair, claim a successful reproduction/mutation/browser run or commit a release.
Activity
schlessera commentedon Nov 2, 2026
Decision needed before this is
agent-ready: what happens to an answer given on a question card after its turn has ended?Either way, rendering synthetic SDK messages as status lines rather than agent replies is independent. It can be split out and made
agent-readynow if preferred.schlessera commentedon Nov 2, 2026
Decision (maintainer, 2026-11-02): late-answer recovery A — retain an ended card and its available answer/draft, with explicit Send as message. Apply to all four ask kinds. The recovery action sends an ordinary new message carrying the relevant question and answer; it never marks the ended tool call accepted or automatically starts a continuation from a late card submission. The accepted cost is an extra action, preserving clear new-message intent.
This follows the existing Closed/Expired recovery ruling in
docs/decisions/answer-delivery.md. Preserve exact principal/session/request identity, receipts/idempotency and unsubmitted drafts without auto-send. Recovery must not duplicate an already accepted answer, cross into another chat/principal or revive a deleted identity. Only new question/answer content reaches the provider tail; old tools/system/messages/tool results stay unchanged and UI diagnostics remain internal.Folded the branch into the current issue body and checkable acceptance criteria. Timeout accounting and synthetic SDK status-versus-hidden presentation remain open, so retain
needs: decisionfor now. No implementation, successful runtime reproduction/proof or release commitment is implied.schlessera commentedon Nov 2, 2026
Decision (maintainer, 2026-11-02): timeout accounting A — keep the existing hard elapsed-time limit, including time waiting for the user. A pending question does not pause, reset or extend the deadline. Preserve configured timeout values and existing authorization/resource/worker cleanup guards; no separate execution/waiting allowance is added.
This retains bounded resource lifetime and the current hard-timeout contract. The accepted tradeoff is that questions can expire while the user is away; the already selected ended-card/explicit Send as message path preserves recovery. Show the actual timeout in the conversation without claiming successful completion, and keep timely answers receipt-confirmed under the existing rules.
Folded the decision/rationale and original-deadline, timely-answer and race proof obligations into the body. Synthetic SDK notice presentation is the only remaining interactive choice, so retain
needs: decisionfor now. No implementation, completed proof, changed numeric limit or release commitment is implied.schlessera commentedon Nov 2, 2026
Decision (maintainer, 2026-11-02): synthetic SDK presentation A — show concise system/turn status, not agent reply prose. Use actual lifecycle/SDK evidence for timed out, cancelled, interrupted or connection-failure wording; otherwise keep the notice generic. “No response requested.” alone is not a cause. Consolidate duplicate observations of one outcome while preserving distinct actionable failures and the partial model answer. Genuine user/assistant quotations remain unchanged.
Reuse established D51 in-turn status/error presentation and answer-delivery recovery. Keep safe diagnostics, receipt/unknown-delivery controls, once-only live announcements and replay without fresh alerts. No text-matching scrubber, new retry authority, inferred no-effects claim or native provider-history rewrite is approved.
All three decisions are complete: A explicit Send as message for ended cards, A hard elapsed-time timeout including user waits, and A synthetic system statuses. Folded them into the current body with source-qualified implementation boundaries, checkable criteria and offline/runtime/browser/mutation proof obligations. Remove
needs: decisionand addagent-ready; no other needs label or external prerequisite remains. No generic design interview is required for reusing these existing reviewed patterns. No implementation, completed reproduction/test proof or release commitment is implied.schlessera commentedon Nov 3, 2026
Claimed by an implementation agent (token
claim-3356-11274). Branch:fix/3356-ended-question-recoveryfromorigin/maind142e997b. Collision report for the cited files: closure/path overlaps with several open drafts touching ui-react/ui-backend-claude tests (e.g. #3056, #3293); detection only, no lock.schlessera commentedon Nov 3, 2026
Draft implementation PR: #3484 (head
0f9c4bd). Local focused, failing-first, mutation and pinned-Chromium browser receipts are in the PR, andcheck:prpasses. Hosted candidate confirmation and merge remain. The claim stays with this worker while the PR is live.CONTRACT: fix(ui-react): keep an ended question's answer recoverable …
test(ui-react): assert #3356's ended card in the voice terminal scene (…
test(ui-react): assert #3356's ended card in the voice terminal scene (…