@@ -299,18 +299,19 @@ export class StreamingMessageAggregator {
299299 * Used to show "Awaiting your input" instead of "streaming..." in the UI.
300300 */
301301 hasAwaitingUserQuestion ( ) : boolean {
302- // Scan displayed messages for an ask_user_question tool in "executing" state
302+ // Only treat the workspace as "awaiting input" when the *latest* displayed
303+ // message is an executing ask_user_question tool.
304+ //
305+ // This avoids false positives from stale historical partials if the user
306+ // continued the chat after skipping/canceling the questions.
303307 const displayed = this . getDisplayedMessages ( ) ;
304- for ( const msg of displayed ) {
305- if (
306- msg . type === "tool" &&
307- msg . toolName === "ask_user_question" &&
308- msg . status === "executing"
309- ) {
310- return true ;
311- }
308+ const last = displayed [ displayed . length - 1 ] ;
309+
310+ if ( last ?. type !== "tool" ) {
311+ return false ;
312312 }
313- return false ;
313+
314+ return last . toolName === "ask_user_question" && last . status === "executing" ;
314315 }
315316
316317 /**
@@ -1095,10 +1096,18 @@ export class StreamingMessageAggregator {
10951096 if ( part . state === "output-available" ) {
10961097 // Check if result indicates failure (for tools that return { success: boolean })
10971098 status = hasFailureResult ( part . output ) ? "failed" : "completed" ;
1098- } else if ( part . state === "input-available" && message . metadata ?. partial ) {
1099- status = "interrupted" ;
11001099 } else if ( part . state === "input-available" ) {
1101- status = "executing" ;
1100+ // Most unfinished tool calls in partial messages represent an interruption.
1101+ // ask_user_question is different: it's intentionally waiting on user input,
1102+ // so after restart we should keep it answerable ("executing") instead of
1103+ // showing retry/auto-resume UX.
1104+ if ( part . toolName === "ask_user_question" ) {
1105+ status = "executing" ;
1106+ } else if ( message . metadata ?. partial ) {
1107+ status = "interrupted" ;
1108+ } else {
1109+ status = "executing" ;
1110+ }
11021111 } else {
11031112 status = "pending" ;
11041113 }
0 commit comments