diff --git a/src/github/operations/comment-logic.ts b/src/github/operations/comment-logic.ts
index bc0253d..6a4551a 100644
--- a/src/github/operations/comment-logic.ts
+++ b/src/github/operations/comment-logic.ts
@@ -183,7 +183,7 @@ export function updateCommentBody(input: CommentUpdateInput): string {
// Add error details if available
if (actionFailed && errorDetails) {
- newBody += `\n\n\nError details
\n\n\`\`\`\n${errorDetails}\n\`\`\`\n\n `;
+ newBody += `\n\n\`\`\`\n${errorDetails}\n\`\`\``;
}
newBody += `\n\n---\n`;
diff --git a/test/comment-logic.test.ts b/test/comment-logic.test.ts
index 7488400..82fec08 100644
--- a/test/comment-logic.test.ts
+++ b/test/comment-logic.test.ts
@@ -51,11 +51,9 @@ describe("updateCommentBody", () => {
const result = updateCommentBody(input);
expect(result).toContain("**Claude encountered an error after 45s**");
expect(result).toContain("[View job]");
- expect(result).toContain("");
- expect(result).toContain("Error details
");
- expect(result).toContain("Failed to fetch issue data");
+ expect(result).toContain("```\nFailed to fetch issue data\n```");
// Ensure error details come after the header/links
- const errorIndex = result.indexOf("");
+ const errorIndex = result.indexOf("```");
const headerIndex = result.indexOf("**Claude encountered an error");
expect(errorIndex).toBeGreaterThan(headerIndex);
});