fix(session): resume loop when user message arrives during question prompt - #46139
Open
TheMrClaus wants to merge 1 commit into
Open
fix(session): resume loop when user message arrives during question prompt#46139TheMrClaus wants to merge 1 commit into
TheMrClaus wants to merge 1 commit into
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #46135
Type of change
What does this PR do?
Repro: run the agent until it blocks on an interactive
questiontool prompt, then submit a new message instead of answering inline. The message gets persisted, but the session never resumes — the engine just hangs with no error.Root cause: the
questiontool parks the session run insideQuestion.ask()on a pending deferred. A new prompt is persisted before the loop is invoked, but because the session is already running the freshrunLoopwork is ignored — so the existing run stays stuck in the question wait forever, and nothing ever consumes the new message. Nostep-finish, no abort, no error event.Fix: when a fresh prompt is persisted, reject any pending questions for that session. The processor's
Question.RejectedErrorhandler then checks whether a newer user message exists; if one does, the loop is allowed to continue — the tool settles, history reloads, and the queued message is processed as the next turn. Dismissing the prompt without a newer message still stops the run, same as before.How did you verify your code works?
Added a regression test: submit a prompt while a
questiontool is pending, then submit a second prompt. It asserts both prompt fibers complete, the second user message reaches the next LLM input, the question tool settles to an error state, and the pending-question list drains. Before the fix it hung with "timed out waiting for loop to resume"; after the fix it passes (~3s).Typecheck (
tsgo --noEmit) is clean. I also ran the full package suite: 3353 pass, 43 fail — the failures are pre-existing environment issues on this machine (subprocess tests can't find barebunon PATH; a host-umask assertion expects 0644 vs 0664), unrelated to this change.Screenshots / recordings
N/A — not a UI change.
Checklist