rendered markdown links include trailing ')' in clickable URL

Open Beginner friendly
#17,342 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start in codex-rs/tui/src/markdown_render.rs at pop_link(), which currently renders the URL with surrounding parentheses. Update the rendering so terminal URL detection excludes punctuation, then update and run url_link_shows_destination in markdown_render_tests.rs. Done means the rendered link has the revised separator and clicking it does not include a trailing ')'.

Written by the indexing model from the issue text.

Description

bug TUI
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.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.