@@ -104,6 +104,53 @@ describe("safe_output_summary", () => {
104104 expect ( summary . length ) . toBeLessThan ( longBody . length + 1000 ) ;
105105 } ) ;
106106
107+ it ( "should use 6-backtick fences for body content containing backticks" , ( ) => {
108+ const bodyWithBackticks = "Here is some code:\n```javascript\nconsole.log('hello');\n```\nEnd of body." ;
109+
110+ const options = {
111+ type : "create_issue" ,
112+ messageIndex : 1 ,
113+ success : true ,
114+ result : {
115+ repo : "owner/repo" ,
116+ number : 123 ,
117+ } ,
118+ message : {
119+ title : "Issue with code" ,
120+ body : bodyWithBackticks ,
121+ } ,
122+ } ;
123+
124+ const summary = generateSafeOutputSummary ( options ) ;
125+
126+ // Should use 6-backtick fences to avoid breaking when body contains triple backticks
127+ expect ( summary ) . toContain ( "``````\n" ) ;
128+ expect ( summary ) . toContain ( "Body Preview" ) ;
129+ expect ( summary ) . toContain ( "```javascript" ) ;
130+ } ) ;
131+
132+ it ( "should use 6-backtick fences for error message details containing backticks" , ( ) => {
133+ const messageWithBackticks = {
134+ title : "Test Issue" ,
135+ body : "Code: ```\nconsole.log('test');\n```" ,
136+ } ;
137+
138+ const options = {
139+ type : "create_issue" ,
140+ messageIndex : 1 ,
141+ success : false ,
142+ result : null ,
143+ message : messageWithBackticks ,
144+ error : "Failed to create issue" ,
145+ } ;
146+
147+ const summary = generateSafeOutputSummary ( options ) ;
148+
149+ // Should use 6-backtick fences for message details JSON to avoid rendering issues
150+ expect ( summary ) . toContain ( "``````json\n" ) ;
151+ expect ( summary ) . toContain ( "Message Details" ) ;
152+ } ) ;
153+
107154 it ( "should handle project-specific results" , ( ) => {
108155 const options = {
109156 type : "create_project" ,
0 commit comments