@@ -589,13 +589,18 @@ export const dispatchTelegramMessage = async ({
589589 let streamToolProgressLines : string [ ] = [ ] ;
590590 let lastAnswerPartialText = "" ;
591591 let activeAnswerDraftIsToolProgressOnly = false ;
592- const noteAnswerToolProgressDraft = ( ) => {
593- activeAnswerDraftIsToolProgressOnly =
594- ! answerLane . hasStreamedMessage || activeAnswerDraftIsToolProgressOnly ;
595- } ;
596- const resetAnswerToolProgressDraft = ( ) => {
592+ function resetAnswerToolProgressDraft ( ) {
597593 activeAnswerDraftIsToolProgressOnly = false ;
598- } ;
594+ }
595+ async function prepareAnswerLaneForToolProgress ( ) {
596+ if ( activeAnswerDraftIsToolProgressOnly ) {
597+ return ;
598+ }
599+ if ( answerLane . hasStreamedMessage ) {
600+ await rotateLaneForNewMessage ( answerLane ) ;
601+ }
602+ activeAnswerDraftIsToolProgressOnly = true ;
603+ }
599604 const renderProgressDraft = async ( options ?: { flush ?: boolean } ) => {
600605 if ( ! answerLane . stream || streamMode !== "progress" ) {
601606 return ;
@@ -609,7 +614,7 @@ export const dispatchTelegramMessage = async ({
609614 if ( ! streamText || streamText === answerLane . lastPartialText ) {
610615 return ;
611616 }
612- noteAnswerToolProgressDraft ( ) ;
617+ await prepareAnswerLaneForToolProgress ( ) ;
613618 answerLane . lastPartialText = streamText ;
614619 answerLane . hasStreamedMessage = true ;
615620 answerLane . finalized = false ;
@@ -649,7 +654,7 @@ export const dispatchTelegramMessage = async ({
649654 seed : progressSeed ,
650655 formatLine : formatProgressAsMarkdownCode ,
651656 } ) ;
652- noteAnswerToolProgressDraft ( ) ;
657+ await prepareAnswerLaneForToolProgress ( ) ;
653658 answerLane . lastPartialText = streamText ;
654659 answerLane . hasStreamedMessage = true ;
655660 answerLane . finalized = false ;
@@ -1302,6 +1307,9 @@ export const dispatchTelegramMessage = async ({
13021307 if ( segment . lane === "reasoning" ) {
13031308 reasoningStepState . noteReasoningHint ( ) ;
13041309 }
1310+ if ( segment . lane === "answer" && info . kind === "tool" ) {
1311+ await prepareAnswerLaneForToolProgress ( ) ;
1312+ }
13051313 const result =
13061314 segment . lane === "answer" && info . kind === "final"
13071315 ? await deliverFinalAnswerText (
0 commit comments