Skip to content

fix(jira): keep line breaks and Markdown in Jira Cloud comments - #42075

Closed
LDH1103 wants to merge 2 commits into
stablyai:mainfrom
LDH1103:fix/jira-comment-line-breaks
Closed

LDH1103 wants to merge 2 commits into
stablyai:mainfrom
LDH1103:fix/jira-comment-line-breaks

Conversation

@LDH1103

@LDH1103 LDH1103 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

ELI5

When you write a Jira comment in Orca, Orca shows it one way and Jira Cloud showed it another way: line breaks turned into paragraph gaps, and **bold** or lists stayed as raw symbols. Now Orca turns the Markdown you typed into Jira's own document format, so the comment looks the same in both places.

What Changed

Before: on Jira Cloud, toBodyText called textToAdf, which made every typed line its own ADF paragraph. For first\nsecond\n\n**third** Jira received four paragraphs: first, second, an empty one, and **third** with literal asterisks. Orca renders the same text as Markdown with remark-breaks, so it shows first and second on tight lines and third in bold.

After: on Jira Cloud, comment, transition comment and new-issue description bodies are built from Markdown.

  • A single newline becomes a hardBreak, and a blank line starts a new paragraph.
  • Emphasis, strong, strike, code, links, headings, lists, code blocks, quotes, rules and GFM tables map to ADF.
  • Jira Server/DC still receives the typed text unchanged as wiki text.

Mechanism:

  • markdown-adf.ts (new): markdownToAdf parses with unified + remark-parse + remark-gfm and maps the tree to ADF.
    • These packages are already bundled into main (pr-conversation-response.ts and linear-issue-description-comparison.ts use them). The converter imports them on first use, since only Jira Cloud writes need them.
    • It follows ADF's container rules: list items start with a paragraph, and headings inside quotes or list items become paragraphs.
    • Only http(s) and mailto destinations become links. Other link targets keep their label as plain text.
  • jira-issue-mapping.ts: toBodyText uses markdownToAdf on Cloud and is now async.
  • jira-issue-mutations.ts: createIssue, updateIssue (transition comment) and addIssueComment await it. Each call sits inside the existing try, so a converter failure is reported as a failed write, like a Jira request error.
  • adf-markdown.ts: removes the unused textToAdf.

Why

Orca already renders Jira bodies as Markdown with remark-breaks. Writing through the same grammar makes Orca and Jira agree, instead of each side reading the text its own way.

Keeping one paragraph per line and only mapping blank lines would fix the spacing, but **bold**, lists and links would still show as raw symbols in Jira. Comments from orca jira comment add, which agents usually write in Markdown, have the same problem.

Linked Issue

Fixes #42074

This is split out of #29525 so it can be reviewed on its own. #29525 builds its description editor on the same converter.

Visual Proof

N/A: nothing changes in Orca's UI. The difference is the ADF payload sent to Jira Cloud, which jira-issue-mutations.test.ts pins: first\nsecond\n\n**third** becomes one paragraph first, hardBreak, second, then a paragraph with bold third.

Testing

Automated, on Windows 11:

  • markdown-adf.test.ts: line breaks and paragraphs, marks, code marks combined only with links, headings, lists, code blocks, quotes and rules, blocks ADF forbids inside quotes and list items, GFM tables, unsafe link schemes, and escaped punctuation.
  • jira-issue-mutations.test.ts: the Cloud comment payload through addIssueComment, and the Cloud transition comment and new-issue description through updateIssue and createIssue.
  • With the source change reverted, both jira-issue-mutations.test.ts cases fail, and markdown-adf.test.ts has no module to import.
  • src/main/jira suites: 11 files, 47 passed. pnpm typecheck exit 0.
  • pnpm check:changed --base=upstream/main: 24 of 25 checks pass, including format, oxlint, typecheck, changed-code quality, the ratchets, import boundaries and localization extraction. The unit-test step fails only in suites this change does not touch, all on this Windows machine:
    • temp-folder cleanup EPERM in exit-provenance-audit, pane-last-grid and agent-generated-tab-titles;
    • orca-runtime.test.ts "RPC-initiated delete awaits matching PTYs before git", which fails the same way with this change reverted.

Not tested: a real Jira Cloud or Server/DC site, macOS, Linux, SSH.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

Risk

Markdown typed in a Cloud comment now renders as Markdown in Jira. This includes comments that agents write through orca jira comment add. Text meant literally can now be formatted: for example, a line starting with 1. becomes a list item, and *word* becomes italic. That matches how Orca already displays the same comment.

Jira Server/DC writes are unchanged. Nothing is stored locally. A plain revert restores the old payload; comments already posted keep the ADF they were sent with.

Level: Low

AI Disclosure

LDH1103 used Claude Code (Claude Opus 5.5) for implementation, tests, and this description, and directed the work and approved opening this PR.

Review

  • Cross-platform: no platform branches. Jira calls stay in the host's main process.
  • SSH/remote: the host builds the body, so the RPC contract and older paired clients are unaffected.
  • Security: link marks are limited to http(s) and mailto. No new credentials or permissions.
  • Performance: remark loads once, on the first Jira Cloud write.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

On Jira Cloud, Orca sent every typed line as its own ADF paragraph, so
single line breaks showed as paragraph gaps and Markdown stayed literal.
Build Cloud comment, transition comment and description bodies from
Markdown instead, so Jira shows what Orca renders. Server/DC still
sends wiki text unchanged.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

Jira Cloud issue descriptions, comments, and transition comments now convert Markdown to ADF before submission. Jira Server/DC bodies continue to use the original text. The new converter handles inline formatting and block elements, including links, lists, tables, and code blocks. Tests cover converter output and the request payloads for Jira issue mutations.

Severity of issue fixed: Medium

Merge Risk: Low · previous review 83fad

Jira Cloud comments or descriptions that contain an empty quote line may fail to submit. This affects an uncommon input, and the fix is small. The change is otherwise mergeable, with this edge case worth fixing first.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Jira Cloud comments now keep line breaks and Markdown formatting. It uses the conventional fix(jira) prefix. The title is 63 characters, which is within a reasonable l…
Description check Passed The description follows the repository template closely. It covers ELI5, What Changed (before and after, with the mechanism), Why (with alternatives considered), Linked Issue (Fixes #42074), Visual Pr…
Linked Issues check Passed Issue #42074 requires that Jira Cloud bodies match Orca's Markdown rendering. Single newlines must become line breaks, blank lines must start paragraphs, and Markdown formatting must carry over. The r…
Out of Scope Changes check Passed All changed files serve the Markdown-to-ADF objective of #42074. markdown-adf.ts and markdown-adf.test.ts implement the converter and its tests. jira-issue-mapping.ts routes Cloud bodies through the c…
Full details: Title check

Explanation

The title names the main change: Jira Cloud comments now keep line breaks and Markdown formatting. It uses the conventional fix(jira) prefix. The title is 63 characters, which is within a reasonable length for a single-line title. It matches the linked issue and the changeset, which convert Cloud bodies from text to Markdown-derived ADF.

Full details: Description check

Explanation

The description follows the repository template closely. It covers ELI5, What Changed (before and after, with the mechanism), Why (with alternatives considered), Linked Issue (Fixes #42074), Visual Proof (N/A with reason), Testing (automated tests, environment, and untested areas), Risk (with level and revert path), AI Disclosure, Review, the upstream boundary checkbox, Notes, and Checklist. The description gives concrete evidence for the change, including the exact ADF payload pinned by the test. The unchecked pnpm lint/build item is a minor gap, because the author states that the check:changed run partially passed and the typecheck passed.

Full details: Linked Issues check

Explanation

Issue #42074 requires that Jira Cloud bodies match Orca's Markdown rendering. Single newlines must become line breaks, blank lines must start paragraphs, and Markdown formatting must carry over. The requirement covers comments, transition comments, new-issue descriptions, and orca jira comment add. At head, src/main/jira/markdown-adf.ts exports markdownToAdf. textNodes maps each single newline to a hardBreak. blockNode creates a new paragraph for each blank-line-separated block. inlineNode maps emphasis, strong, delete, inlineCode, and links to ADF marks. blockNode maps headings, lists, code blocks, blockquotes, rules, and tables. jira-issue-mutations.ts diff at head awaits toBodyText in createIssue (description), updateIssue (transition comment), and addIssueComment (comment body). orca jira comment add uses the addIssueComment path, per the PR description. Server/DC still receives the raw text. The PR tests cover these cases. Real Jira Cloud behavior was not tested, which is a verification gap and not a coding gap.

Full details: Out of Scope Changes check

Explanation

All changed files serve the Markdown-to-ADF objective of #42074. markdown-adf.ts and markdown-adf.test.ts implement the converter and its tests. jira-issue-mapping.ts routes Cloud bodies through the converter and keeps Server/DC unchanged. jira-issue-mutations.ts and its test cover the three Cloud write paths named in the issue. adf-markdown.ts removes textToAdf, which has no remaining role once the converter replaces it. The PR does not add unrelated behavior. The #29525 reference is context only. Its description editor is not part of this diff.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 82380ed2-60e9-4045-b2a7-3d23819ab98a
Commits

Reviewing files that changed from the base of the PR and between 5480f48 and 83fad3d.

Files selected for processing: 6

  • src/main/jira/adf-markdown.ts
  • src/main/jira/jira-issue-mapping.ts
  • src/main/jira/jira-issue-mutations.test.ts
  • src/main/jira/jira-issue-mutations.ts
  • src/main/jira/markdown-adf.test.ts
  • src/main/jira/markdown-adf.ts
Files with no reviewable changes: 1

  • src/main/jira/adf-markdown.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/main/jira/markdown-adf.ts Resolved
@LDH1103

LDH1103 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #42242, which landed the same Markdown to ADF conversion for Jira Cloud comments and descriptions and closed #42074. Thanks for picking it up.

@LDH1103 LDH1103 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Jira Cloud comments written in Orca lose single line breaks and Markdown

1 participant