@@ -1930,6 +1930,30 @@ function setsEqual<T>(left: ReadonlySet<T>, right: ReadonlySet<T>): boolean {
19301930 return true ;
19311931}
19321932
1933+ // Summaries are re-derived whenever messages change, including streamed text,
1934+ // so a new array often holds the same checkpoints.
1935+ function checkpointSummariesEqual (
1936+ left : ReadonlyArray < ThreadCheckpointSummary > | undefined ,
1937+ right : ReadonlyArray < ThreadCheckpointSummary > | undefined ,
1938+ ) : boolean {
1939+ if ( left === right ) return true ;
1940+ if ( left === undefined || right === undefined || left . length !== right . length ) return false ;
1941+ return left . every ( ( summary , index ) => {
1942+ const other = right [ index ] ! ;
1943+ return (
1944+ summary . checkpointId === other . checkpointId &&
1945+ summary . scopeId === other . scopeId &&
1946+ summary . runId === other . runId &&
1947+ summary . checkpointTurnCount === other . checkpointTurnCount &&
1948+ summary . checkpointRef === other . checkpointRef &&
1949+ summary . completedAt === other . completedAt &&
1950+ summary . status === other . status &&
1951+ summary . files === other . files &&
1952+ summary . assistantMessageId === other . assistantMessageId
1953+ ) ;
1954+ } ) ;
1955+ }
1956+
19331957function setMapsEqual < K , V > (
19341958 left : ReadonlyMap < K , ReadonlySet < V > > ,
19351959 right : ReadonlyMap < K , ReadonlySet < V > > ,
@@ -2003,7 +2027,7 @@ export function buildThreadFeed(
20032027 anchoredMessages . length === 0 &&
20042028 previous . attempts === options ?. attempts &&
20052029 previous . nodes === options ?. nodes &&
2006- previous . checkpointSummaries === options ?. checkpointSummaries &&
2030+ checkpointSummariesEqual ( previous . checkpointSummaries , options ?. checkpointSummaries ) &&
20072031 setsEqual ( previous . foldedAnswerMessageIds , foldedAnswerMessageIds ) &&
20082032 setMapsEqual ( previous . delegatedChildrenByRun , delegatedChildrenByRun )
20092033 ) {
0 commit comments