codex - ✅(Solved) Fix rendered markdown links include trailing ')' in clickable URL [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17342Fetched 2026-04-11 06:17:19
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×3renamed ×1unlabeled ×1

Root Cause

Root cause

PR fix notes

PR #18377: [codex] Avoid parenthesized rendered markdown URLs

Description (problem / solution / changelog)

Fixes #17342.

This changes the TUI markdown renderer so remote links render as label - url instead of label (url). That avoids placing a trailing ) directly next to the rendered URL, which terminals like WezTerm and iTerm can treat as part of the clickable destination.

What changed:

  • update remote markdown link rendering in the TUI transcript
  • keep local file-link rendering unchanged
  • update the existing markdown renderer assertions and snapshot output

Testing:

  • build the patched binary with CARGO_TARGET_DIR=target-17342 cargo build -p codex-cli --bin codex
  • ask Codex to print [PR #496](https://github.com/org/repo/pull/496) and confirm it renders as PR #496 - https://github.com/org/repo/pull/496
  • click the rendered URL and confirm the browser opens the URL without a trailing )

Changed files

  • codex-rs/tui/src/markdown_render.rs (modified, +1/-2)
  • codex-rs/tui/src/markdown_render_tests.rs (modified, +2/-4)
  • codex-rs/tui/src/snapshots/codex_tui__markdown_render__markdown_render_tests__markdown_render_complex_snapshot.snap (modified, +3/-3)

Code Example

PR #496 (https://github.com/org/repo/pull/496)

---

self.push_span(" (".into());
self.push_span(Span::styled(link.destination, self.styles.link));
self.push_span(")".into());

---

self.push_span(" — ".into());
self.push_span(Span::styled(link.destination, self.styles.link));
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.118.0

What subscription do you have?

Business

Which model were you using?

gpt-5.4 xhigh fast

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

WezTerm 20240203-110809-5046fc22 (latest version. not the nightly channel)

What issue are you seeing?

When codex renders a markdown link like [PR #496](https://github.com/org/repo/pull/496), the TUI output looks like:

PR #496 (https://github.com/org/repo/pull/496)

The problem is terminal emulators (WezTerm, iTerm2, Terminal.app, etc.) include the trailing ) in the clickable URL — so you end up navigating to https://github.com/org/repo/pull/496) which 404s.

What steps can reproduce the bug?

  1. Have codex output any markdown link to a remote URL (e.g. a PR link)
  2. Click the rendered URL in the terminal
  3. Browser navigates to the URL with a trailing ) appended — 404

What is the expected behavior?

Clicking the URL should navigate to the correct destination without the trailing ).


Additional information

Root cause

pop_link() in codex-rs/tui/src/markdown_render.rs (around line 596) pushes " (", the styled URL, then ")" as separate spans. The closing paren is character-adjacent to the URL, and most terminals' URL detection heuristics will grab it since there's no matching ( inside the URL itself.

self.push_span(" (".into());
self.push_span(Span::styled(link.destination, self.styles.link));
self.push_span(")".into());

Suggested fix

Swap the parens for a separator that won't get captured — something like an em-dash works fine here since the URL is already styled (cyan + underline) so the visual grouping isn't lost:

self.push_span(" — ".into());
self.push_span(Span::styled(link.destination, self.styles.link));

The test url_link_shows_destination in markdown_render_tests.rs would need the same update.

extent analysis

TL;DR

Update the pop_link() function in codex-rs/tui/src/markdown_render.rs to use a separator that won't be captured by terminal URL detection heuristics.

Guidance

  • Identify the pop_link() function in codex-rs/tui/src/markdown_render.rs and update the separator used to separate the link text and URL.
  • Replace the existing code with the suggested fix: self.push_span(" — ".into()); self.push_span(Span::styled(link.destination, self.styles.link));.
  • Update the url_link_shows_destination test in markdown_render_tests.rs to reflect the changed separator.
  • Verify the fix by running the updated code and checking that clicking on rendered URLs no longer appends a trailing ).

Example

// Before
self.push_span(" (".into());
self.push_span(Span::styled(link.destination, self.styles.link));
self.push_span(")".into());

// After
self.push_span(" — ".into());
self.push_span(Span::styled(link.destination, self.styles.link));

Notes

This fix assumes that the issue is solely due to the terminal's URL detection heuristics capturing the closing parenthesis. If the issue persists after applying this fix, further investigation may be necessary.

Recommendation

Apply the suggested workaround by updating the pop_link() function to use an em-dash separator, as this is a targeted fix that addresses the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING