fix(questions): cancel interactive ask-user prompts on agent abort - #70
Open
imMamdouhaboammar wants to merge 7 commits into
Open
fix(questions): cancel interactive ask-user prompts on agent abort#70imMamdouhaboammar wants to merge 7 commits into
imMamdouhaboammar wants to merge 7 commits into
Conversation
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
Make
ask_user_questioncancellation propagate through the tool callback andAskUserQuestionManager, so aborting an agent run also clears the interactive TUI request.Root cause
The tool checked
signal.abortedbefore and after awaiting the host callback. If the agent was aborted while the callback was waiting for the user, the callback promise itself remained unresolved, so the post-callback abort check was never reached.AskUserQuestionManagerstored only a resolver and had no cancellation path, leaving its current request visible in the UI after the agent stream had already stopped.Changes
AbortSignalinto the ask-user callback as an optional second argumentAskUserQuestionManager.askUserQuestion()accept the signalAbortErrornullwhen no request remainsRegression coverage
createAskUserQuestionTool()to the real manager and verifies abort both rejects the tool and clears the displayed requestThis makes Esc/Ctrl-C release the interactive question flow instead of leaving a stale prompt after session cancellation.