@@ -154,7 +154,7 @@ describe('buildEffectiveChatTranscript', () => {
154154 )
155155 } )
156156
157- it ( 'does not duplicate thinking-only text into a second assistant block ' , ( ) => {
157+ it ( 'never surfaces thinking-channel text: a thinking-only stream stays a placeholder ' , ( ) => {
158158 const result = buildEffectiveChatTranscript ( {
159159 messages : [ buildUserMessage ( 'stream-1' , 'Hello' ) ] ,
160160 activeStreamId : 'stream-1' ,
@@ -180,15 +180,51 @@ describe('buildEffectiveChatTranscript', () => {
180180 expect ( result ) . toHaveLength ( 2 )
181181 expect ( result [ 1 ] ) . toEqual (
182182 expect . objectContaining ( {
183- content : 'Internal reasoning' ,
183+ id : getLiveAssistantMessageId ( 'stream-1' ) ,
184+ role : 'assistant' ,
185+ content : '' ,
186+ } )
187+ )
188+ expect ( JSON . stringify ( result [ 1 ] ) ) . not . toContain ( 'Internal reasoning' )
189+ } )
190+
191+ it ( 'keeps assistant text while dropping interleaved thinking chunks' , ( ) => {
192+ const textEvent = ( seq : number , channel : MothershipStreamV1TextChannel , text : string ) =>
193+ toBatchEvent ( seq , {
194+ v : 1 ,
195+ seq,
196+ ts : '2026-04-15T12:00:01.000Z' ,
197+ type : MothershipStreamV1EventType . text ,
198+ stream : { streamId : 'stream-1' } ,
199+ payload : { channel, text } ,
200+ } )
201+ const result = buildEffectiveChatTranscript ( {
202+ messages : [ buildUserMessage ( 'stream-1' , 'Hello' ) ] ,
203+ activeStreamId : 'stream-1' ,
204+ streamSnapshot : {
205+ events : [
206+ textEvent ( 1 , MothershipStreamV1TextChannel . thinking , '**Planning**\n\nHidden reasoning.' ) ,
207+ textEvent ( 2 , MothershipStreamV1TextChannel . assistant , 'Visible answer.' ) ,
208+ textEvent ( 3 , MothershipStreamV1TextChannel . thinking , 'More hidden reasoning.' ) ,
209+ ] ,
210+ previewSessions : [ ] ,
211+ status : 'active' ,
212+ } ,
213+ } )
214+
215+ expect ( result ) . toHaveLength ( 2 )
216+ expect ( result [ 1 ] ) . toEqual (
217+ expect . objectContaining ( {
218+ content : 'Visible answer.' ,
184219 contentBlocks : [
185220 expect . objectContaining ( {
186221 type : MothershipStreamV1EventType . text ,
187- content : 'Internal reasoning ' ,
222+ content : 'Visible answer. ' ,
188223 } ) ,
189224 ] ,
190225 } )
191226 )
227+ expect ( JSON . stringify ( result [ 1 ] ) ) . not . toContain ( 'reasoning' )
192228 } )
193229
194230 it ( 'treats user-cancelled tool results as cancelled' , ( ) => {
0 commit comments