Repository navigation
fix: rehydrate an unanswered user question the surface never received - #2086
Merged
Merged
Conversation
A run that parks on AskUserQuestion could become unanswerable. The session view only subscribes to the session it shows, so a request raised while another session was active — or before the window existed — never reached the surface, and nothing read it back. Sandbox-boundary requests already held this invariant through a kernel registry the shell reads on session change. Generalize that one path to both request kinds instead of adding a second mechanism: RuntimeKernel now registers `user_question_request` alongside `sandbox_boundary_request` and drops each on its settlement ack, and `listActiveSandboxBoundaryRequests` becomes `listActiveInteractions` through SessionManager, IPC, and preload. The composer queue reconciles against the full live set rather than passing questions through untouched. Closes #2072
…ing the read-back Three follow-ups from review, all in the same seam the read-back created. The renderer left an answered question in the composer queue until its tool result arrived, while its boundary sibling already dequeued on the ack. The ack is where the runtime drops its owner — the point the request stops being answerable — so both kinds settle there now, and the two identical request cases fold into one. The IPC read-back returned only the E2E fixture request when one was present. That was harmless while questions passed through reconciliation untouched; now that the live set owns the whole queue, shadowing the runtime's list would drop a real unanswered request. Concatenate instead. Cover the two registry contracts the tests left open: a stopped turn releases the question it abandoned (verified by mutation — commenting out the turn-end release turns the test red), and a boundary response aimed at a question's requestId settles nothing and leaves the entry intact.
Astro-Han
force-pushed
the
fix/2072-user-question-rehydration
branch
from
August 4, 2026 06:23
37ba26c to
96ac14b
Compare
Astro-Han
marked this pull request as ready for review
August 4, 2026 06:34
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
A run that parks on
AskUserQuestioncould become permanently unanswerable. The session view subscribes only to the session it shows, so a request raised while another session was active — or before the window existed — never reached the surface, and nothing read it back. The prompt was gone for good; the run stayed parked on a question the UI could not answer.Sandbox-boundary requests already hold this invariant: RuntimeKernel keeps every unanswered request in a registry, and the shell reads it back whenever the active session changes.
AskUserQuestionwas the one exception. This generalizes that single path to both request kinds rather than adding a parallel mechanism:RuntimeKernelregistersuser_question_requestalongsidesandbox_boundary_requestand drops each on its settlement ack (user_question_answer_ack/sandbox_boundary_decision_ack); the existing per-turn cleanup already covers both.listActiveSandboxBoundaryRequestsbecomeslistActiveInteractionsthroughSessionManager, IPC, and preload, returning the sharedActiveInteractionRequestEventunion now exported from@maka/core.reconcileInteractionsreconciles against the full live set instead of passing questions through untouched, and the renderer's hydration epoch is now bumped by question events too, so an in-flight read-back cannot resurrect a settled prompt.Hosted sessions are unaffected: the kernel registry stays an embedded-side in-memory index, and the Question fact remains owned by the Host's
interactionAuthority.Closes #2072
Verification
The new E2E is red before the fix and green after — reload discards every event the surface saw while the runtime keeps the turn parked:
All green locally:
npm run build,npm run lint,npm run format:check,@maka/desktop typecheckscripts/audit-alignment.mjs: all fixtures cleanNew coverage: a runtime test asserting a question is listed until its answer ack lands, and two
reconcileInteractionsunit tests (order preservation + a question the surface never saw live).Review follow-ups
Three external review passes (first-principles / correctness / test-quality) returned no P0–P1. Handled in
37ba26cf2:tool_result, while the boundary sibling dequeued on the ack. The ack is where the runtime drops its owner, so both kinds settle there now; the two identical request cases fold into one.sessions:listActiveInteractionsreturned only the E2E fixture request when one was present — harmless while questions passed through reconciliation untouched, but now that the live set owns the whole queue it would drop a real unanswered request. Concatenated instead. Probed against the running fixture app: the fixture session'sreadHeadersucceeds, so the added runtime call is safe.requestIdsettles nothing and leaves the entry intact.Deferred with reason:
respondToUserQuestionfans out to non-terminated generations only). This window predates the change and applies equally to sandbox-boundary requests; closing it means releasing owners onabort/complete, which is its own intent. Not in scope here.tssort.Re-verified after the follow-ups: runtime 3099 pass, desktop main 1585 pass, full E2E 64 passed,
format:checkandlintclean.