@@ -220,7 +220,7 @@ export function createLabelMutationOperations(
220220 function flushIssueLabelMutationBatch (
221221 number : number ,
222222 beforeItemMutation ?: ( ) => void ,
223- afterItemMutation ?: ( ) => void ,
223+ afterItemMutation ?: ( confirmed : boolean ) => void ,
224224 ) : {
225225 itemMutationPublished : boolean ;
226226 repositoryDefinitionMutated : boolean ;
@@ -303,7 +303,7 @@ export function createLabelMutationOperations(
303303 args,
304304 onMutation : batch . onMutation ,
305305 } ) ;
306- afterItemMutation ?.( ) ;
306+ afterItemMutation ?.( true ) ;
307307 return {
308308 itemMutationPublished : true ,
309309 repositoryDefinitionMutated : definitionMutated ,
@@ -312,9 +312,10 @@ export function createLabelMutationOperations(
312312 } catch ( error ) {
313313 if ( ! isOptionalFailure ( error ) ) throw error ;
314314 // `gh issue edit` can apply removals before a missing optional addition
315- // makes the command exit nonzero. Conservatively receipt the live item
316- // before any guarded fallback command.
317- afterItemMutation ?.( ) ;
315+ // makes the command exit nonzero. Refresh the live self-mutation receipt
316+ // before any guarded fallback command, but do not claim a confirmed label
317+ // sync unless a fallback succeeds.
318+ afterItemMutation ?.( false ) ;
318319 console . warn (
319320 `Combined optional label sync for item ${ number } failed; retrying its final operations individually: ${
320321 error instanceof Error ? error . message : String ( error )
@@ -328,7 +329,7 @@ export function createLabelMutationOperations(
328329 args : [ "issue" , "edit" , String ( number ) , "--remove-label" , removals . join ( "," ) ] ,
329330 onMutation : batch . onMutation ,
330331 } ) ;
331- afterItemMutation ?.( ) ;
332+ afterItemMutation ?.( true ) ;
332333 itemMutationPublished = true ;
333334 }
334335 const fallbackAdditions = [
@@ -347,7 +348,7 @@ export function createLabelMutationOperations(
347348 optional &&
348349 ( missingLabelError ( fallbackError , label ) || labelCapacityError ( fallbackError ) ) ,
349350 } ) ;
350- afterItemMutation ?.( ) ;
351+ afterItemMutation ?.( true ) ;
351352 itemMutationPublished = true ;
352353 } catch ( fallbackError ) {
353354 if (
0 commit comments