@@ -227,6 +227,49 @@ describe("image generation task status", () => {
227227 ) ;
228228 } ) ;
229229
230+ it ( "does not use a delivery-blocked image task as a succeeded duplicate guard" , ( ) => {
231+ const now = Date . now ( ) ;
232+ recordRecentMediaGenerationTaskStartForSession ( {
233+ sessionKey : "agent:main" ,
234+ taskKind : IMAGE_GENERATION_TASK_KIND ,
235+ sourcePrefix : "image_generate" ,
236+ taskId : "task-blocked-delivery" ,
237+ runId : "run-blocked-delivery" ,
238+ taskLabel : "recent prompt" ,
239+ requestKey : "image-request:blocked" ,
240+ providerId : "xai" ,
241+ progressSummary : "Generating image" ,
242+ nowMs : now - 20_000 ,
243+ } ) ;
244+ taskRuntimeInternalMocks . listTasksForOwnerKey . mockReturnValue ( [
245+ {
246+ taskId : "task-blocked-delivery" ,
247+ runId : "run-blocked-delivery" ,
248+ runtime : "cli" ,
249+ taskKind : IMAGE_GENERATION_TASK_KIND ,
250+ sourceId : "image_generate:xai" ,
251+ requesterSessionKey : "agent:main" ,
252+ ownerKey : "agent:main" ,
253+ scopeKind : "session" ,
254+ task : "recent prompt" ,
255+ status : "succeeded" ,
256+ terminalOutcome : "blocked" ,
257+ terminalSummary : "Required completion delivery failed before reaching the requester." ,
258+ deliveryStatus : "not_applicable" ,
259+ notifyPolicy : "silent" ,
260+ createdAt : now - 20_000 ,
261+ endedAt : now - 10_000 ,
262+ progressSummary : "Generated 1 image" ,
263+ } ,
264+ ] ) ;
265+
266+ expect (
267+ findDuplicateGuardImageGenerationTaskForSession ( "agent:main" , {
268+ requestKey : "image-request:blocked" ,
269+ } ) ,
270+ ) . toBeUndefined ( ) ;
271+ } ) ;
272+
230273 it ( "does not use a recent succeeded image task without a matching request key" , ( ) => {
231274 const now = Date . now ( ) ;
232275 recordRecentMediaGenerationTaskStartForSession ( {
0 commit comments