[BUG] Markdown links in assistant output (background agent / Ghostty) no longer Cmd+clickable — regression
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
In background agent sessions only (/bg jobs / "agents mode"), markdown links emitted by the assistant using [label](url) format render as plain visible text but cannot be opened via Cmd+click in Ghostty. The link styling appears (text + URL visible), but no click handler is attached — Cmd+click does nothing, and there is no OSC 8 hyperlink escape sequence wrapping the URL.
▎ Scope — important: this regression is specific to the background agent ("agents") session UI. In a regular foreground Claude Code session launched with claude on the exact same Ghostty install, assistant-emitted markdown links work correctly — they are wrapped in OSC 8, hover-highlight, and open on Cmd+click. The two surfaces appear to render assistant output through different pipelines, and only the background-agent pipeline is missing OSC 8 emission.
This used to work in earlier Claude Code versions in background agent sessions as well, without any config change on my side.
Related but distinct issues:
- #48251 — reports user-typed URLs become unclickable, but a comment explicitly notes assistant URLs still render as clickable. My report is the inverse symptom (assistant URLs broken) and scoped to background agents only. Possibly the regression has expanded scope between 2.1.19 (that report) and 2.1.141 (mine).
- #48652 — feature request explaining that because the TUI captures mouse events, Ghostty's native URL detection cannot work; OSC 8 escape sequences are the standard solution. My report suggests OSC 8 emission is present in the foreground session pipeline but missing in the background agent pipeline.
- #44713 — file links broken in VS Code panel; different surface from this report.
What Should Happen?
Markdown links [label](url) in assistant output rendered inside a background agent session should be wrapped in OSC 8 hyperlink escape sequences (\e]8;;<url>\e\\<label>\e]8;;\e\\), matching the foreground session's behavior, so that Cmd+click in Ghostty (and any OSC 8–capable terminal) opens the URL in the default browser.
Error Messages/Logs
Steps to Reproduce
- Spawn a background agent job (/bg or equivalent) from a Claude Code session in Ghostty.
- Have the assistant output a markdown link inside that agent's session, e.g.:
PR created: PR #29
- Hover the link in Ghostty — no underline/highlight.
- Cmd+click the link — nothing happens.
- Control: open a regular foreground claude session in the same Ghostty window, have the assistant emit the same markdown link → link is highlighted on hover and opens on Cmd+click as expected.
Expected: link is wrapped in OSC 8 in both surfaces; hover shows hyperlink highlight; Cmd+click opens the URL.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.141
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗