@@ -306,4 +306,48 @@ describe("generate_safe_outputs_tools", () => {
306306 expect ( addCommentTool . description ) . toContain ( "Discussion comments are disabled for this workflow" ) ;
307307 expect ( addCommentTool . description ) . not . toContain ( "Supports reply_to_id for discussion threading." ) ;
308308 } ) ;
309+
310+ it ( "adds issue intent suffix for issue tools when issue_intents runtime feature is enabled" , ( ) => {
311+ fs . writeFileSync (
312+ toolsSourcePath ,
313+ JSON . stringify ( [
314+ { name : "set_issue_type" , description : "Sets issue type." , inputSchema : { type : "object" , properties : { } } } ,
315+ { name : "set_issue_field" , description : "Sets issue field." , inputSchema : { type : "object" , properties : { } } } ,
316+ { name : "add_labels" , description : "Adds labels." , inputSchema : { type : "object" , properties : { } } } ,
317+ { name : "create_issue" , description : "Creates a GitHub issue." , inputSchema : { type : "object" , properties : { } } } ,
318+ ] )
319+ ) ;
320+ fs . writeFileSync ( configPath , JSON . stringify ( { set_issue_type : { } , set_issue_field : { } , add_labels : { } , create_issue : { } } ) ) ;
321+ fs . writeFileSync ( toolsMetaPath , JSON . stringify ( { description_suffixes : { } , repo_params : { } , dynamic_tools : [ ] } ) ) ;
322+
323+ runScript ( { GH_AW_RUNTIME_FEATURES : "other\nissue_intents\nanother=true" } ) ;
324+
325+ const result = JSON . parse ( fs . readFileSync ( outputPath , "utf8" ) ) ;
326+ const intentSuffix = "INTENT: Include rationale (max 280 chars) and confidence (LOW/MEDIUM/HIGH) with each call." ;
327+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "set_issue_type" ) . description ) . toContain ( intentSuffix ) ;
328+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "set_issue_field" ) . description ) . toContain ( intentSuffix ) ;
329+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "add_labels" ) . description ) . toContain ( intentSuffix ) ;
330+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "create_issue" ) . description ) . not . toContain ( intentSuffix ) ;
331+ } ) ;
332+
333+ it ( "does not add issue intent suffix when issue_intents runtime feature is not enabled" , ( ) => {
334+ fs . writeFileSync (
335+ toolsSourcePath ,
336+ JSON . stringify ( [
337+ { name : "set_issue_type" , description : "Sets issue type." , inputSchema : { type : "object" , properties : { } } } ,
338+ { name : "set_issue_field" , description : "Sets issue field." , inputSchema : { type : "object" , properties : { } } } ,
339+ { name : "add_labels" , description : "Adds labels." , inputSchema : { type : "object" , properties : { } } } ,
340+ ] )
341+ ) ;
342+ fs . writeFileSync ( configPath , JSON . stringify ( { set_issue_type : { } , set_issue_field : { } , add_labels : { } } ) ) ;
343+ fs . writeFileSync ( toolsMetaPath , JSON . stringify ( { description_suffixes : { } , repo_params : { } , dynamic_tools : [ ] } ) ) ;
344+
345+ runScript ( { GH_AW_RUNTIME_FEATURES : "other\nanother=true" } ) ;
346+
347+ const result = JSON . parse ( fs . readFileSync ( outputPath , "utf8" ) ) ;
348+ const intentSuffix = "INTENT: Include rationale (max 280 chars) and confidence (LOW/MEDIUM/HIGH) with each call." ;
349+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "set_issue_type" ) . description ) . not . toContain ( intentSuffix ) ;
350+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "set_issue_field" ) . description ) . not . toContain ( intentSuffix ) ;
351+ expect ( result . find ( ( /** @type {{name: string, description: string} } */ t ) => t . name === "add_labels" ) . description ) . not . toContain ( intentSuffix ) ;
352+ } ) ;
309353} ) ;
0 commit comments