@@ -397,6 +397,7 @@ async function graphqlSearchIssues(
397397
398398 while ( true ) {
399399 let response : GraphQLIssueSearchResponse ;
400+ let isPartial = false ;
400401 try {
401402 response = await octokit . graphql < GraphQLIssueSearchResponse > (
402403 ISSUES_SEARCH_QUERY ,
@@ -407,6 +408,14 @@ async function graphqlSearchIssues(
407408 const partial = extractGraphQLPartialData < GraphQLIssueSearchResponse > ( err ) ;
408409 if ( partial ) {
409410 response = partial ;
411+ isPartial = true ;
412+ const { message } = extractRejectionError ( err ) ;
413+ errors . push ( {
414+ repo : `search-batch-${ chunkIdx + 1 } /${ chunks . length } ` ,
415+ statusCode : null ,
416+ message,
417+ retryable : true ,
418+ } ) ;
410419 } else {
411420 const { statusCode, message } = extractRejectionError ( err ) ;
412421 errors . push ( {
@@ -417,14 +426,6 @@ async function graphqlSearchIssues(
417426 } ) ;
418427 break ;
419428 }
420- const { message } = extractRejectionError ( err ) ;
421- errors . push ( {
422- repo : `search-batch-${ chunkIdx + 1 } /${ chunks . length } ` ,
423- statusCode : null ,
424- message,
425- retryable : true ,
426- } ) ;
427- // Continue processing partial data below — don't break
428429 }
429430
430431 if ( response . rateLimit ) updateGraphqlRateLimit ( response . rateLimit ) ;
@@ -450,6 +451,9 @@ async function graphqlSearchIssues(
450451 } ) ;
451452 }
452453
454+ // Don't paginate after partial error — pageInfo may be unreliable
455+ if ( isPartial ) break ;
456+
453457 if ( issues . length >= 1000 && ! capReached ) {
454458 capReached = true ;
455459 const total = response . search . issueCount ;
@@ -528,6 +532,7 @@ async function graphqlSearchPRs(
528532
529533 while ( true ) {
530534 let response : GraphQLPRSearchResponse ;
535+ let isPartial = false ;
531536 try {
532537 response = await octokit . graphql < GraphQLPRSearchResponse > (
533538 PR_SEARCH_QUERY ,
@@ -537,6 +542,14 @@ async function graphqlSearchPRs(
537542 const partial = extractGraphQLPartialData < GraphQLPRSearchResponse > ( err ) ;
538543 if ( partial ) {
539544 response = partial ;
545+ isPartial = true ;
546+ const { message } = extractRejectionError ( err ) ;
547+ errors . push ( {
548+ repo : `pr-search-batch-${ chunkIdx + 1 } /${ chunks . length } ` ,
549+ statusCode : null ,
550+ message,
551+ retryable : true ,
552+ } ) ;
540553 } else {
541554 const { statusCode, message } = extractRejectionError ( err ) ;
542555 errors . push ( {
@@ -547,13 +560,6 @@ async function graphqlSearchPRs(
547560 } ) ;
548561 break ;
549562 }
550- const { message } = extractRejectionError ( err ) ;
551- errors . push ( {
552- repo : `pr-search-batch-${ chunkIdx + 1 } /${ chunks . length } ` ,
553- statusCode : null ,
554- message,
555- retryable : true ,
556- } ) ;
557563 }
558564
559565 if ( response . rateLimit ) updateGraphqlRateLimit ( response . rateLimit ) ;
@@ -620,6 +626,9 @@ async function graphqlSearchPRs(
620626 } ) ;
621627 }
622628
629+ // Don't paginate after partial error — pageInfo may be unreliable
630+ if ( isPartial ) break ;
631+
623632 if ( prMap . size >= 1000 && ! prCapReached ) {
624633 prCapReached = true ;
625634 const total = response . search . issueCount ;
0 commit comments