@@ -458,6 +458,20 @@ describe("threadItems", () => {
458458 }
459459 } ) ;
460460
461+ it ( "defaults web search items to completed status" , ( ) => {
462+ const item = buildConversationItem ( {
463+ type : "webSearch" ,
464+ id : "web-1" ,
465+ query : "codex monitor" ,
466+ } ) ;
467+ expect ( item ) . not . toBeNull ( ) ;
468+ if ( item && item . kind === "tool" ) {
469+ expect ( item . toolType ) . toBe ( "webSearch" ) ;
470+ expect ( item . status ) . toBe ( "completed" ) ;
471+ expect ( item . detail ) . toBe ( "codex monitor" ) ;
472+ }
473+ } ) ;
474+
461475 it ( "merges thread items preferring non-empty remote tool output" , ( ) => {
462476 const remote : ConversationItem = {
463477 id : "tool-2" ,
@@ -512,6 +526,33 @@ describe("threadItems", () => {
512526 }
513527 } ) ;
514528
529+ it ( "keeps local tool status when remote status is empty" , ( ) => {
530+ const remote : ConversationItem = {
531+ id : "tool-remote-status" ,
532+ kind : "tool" ,
533+ toolType : "webSearch" ,
534+ title : "Web search" ,
535+ detail : "query" ,
536+ status : "" ,
537+ output : "" ,
538+ } ;
539+ const local : ConversationItem = {
540+ id : "tool-remote-status" ,
541+ kind : "tool" ,
542+ toolType : "webSearch" ,
543+ title : "Web search" ,
544+ detail : "query" ,
545+ status : "completed" ,
546+ output : "" ,
547+ } ;
548+ const merged = mergeThreadItems ( [ remote ] , [ local ] ) ;
549+ expect ( merged ) . toHaveLength ( 1 ) ;
550+ expect ( merged [ 0 ] . kind ) . toBe ( "tool" ) ;
551+ if ( merged [ 0 ] . kind === "tool" ) {
552+ expect ( merged [ 0 ] . status ) . toBe ( "completed" ) ;
553+ }
554+ } ) ;
555+
515556 it ( "preserves streamed plan output when completion item has empty output" , ( ) => {
516557 const existing : ConversationItem = {
517558 id : "plan-1" ,
0 commit comments