Skip to content

Bug RHOAIENG-39106: Make URLs clickable in chat messages - #533

Merged
jeremyeder merged 1 commit into
ambient-code:mainfrom
Gkrumbach07:ambient/bug/rhoaieng-39106
Jan 29, 2026
Merged

jeremyeder merged 1 commit into
ambient-code:mainfrom
Gkrumbach07:ambient/bug/rhoaieng-39106

Conversation

@Gkrumbach07

Copy link
Copy Markdown
Contributor

Summary

Fixes URLs not being rendered as clickable hyperlinks in chat messages.

Changes

  • Added custom anchor (a) component to defaultComponents in message.tsx
  • Configured links to open in new tab (target="_blank")
  • Added security headers (rel="noopener noreferrer")
  • Applied primary color styling with hover underline effect

Technical Details

The remarkGfm plugin auto-links URLs in markdown, but without a custom anchor component they weren't properly styled or configured for external links. This fix ensures all URLs are:

  • Clickable
  • Open in new tabs
  • Secure (with noopener noreferrer)
  • Styled consistently with the design system

Testing

Verified that:

  • ✅ Frontend builds successfully
  • ✅ Linter passes
  • ✅ URLs render as clickable links
  • ✅ Links open in new tab
  • ✅ Security headers are present

Related Issue

Fixes: https://issues.redhat.com/browse/RHOAIENG-39106

🤖 Generated with Claude Code

Add custom anchor component to ReactMarkdown defaultComponents to
ensure URLs in chat messages are rendered as clickable hyperlinks.

Changes:
- Add custom 'a' component to defaultComponents in message.tsx
- Configure links to open in new tab (target="_blank")
- Add security headers (rel="noopener noreferrer")
- Apply primary color styling with hover underline effect

The remarkGfm plugin auto-links URLs, but without a custom anchor
component they weren't properly styled or configured for external
links. This fix ensures all URLs are clickable and open safely in
new tabs.

Fixes: https://issues.redhat.com/browse/RHOAIENG-39106
@github-actions

github-actions Bot commented Jan 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude Code Review

Summary

This PR adds clickable URL functionality to chat messages by implementing a custom anchor component in the markdown renderer. The implementation is clean, secure, and follows established patterns, with no critical issues identified.


Issues by Severity

🚫 Blocker Issues

None identified. ✅

🔴 Critical Issues

None identified. ✅

🟡 Major Issues

None identified. ✅

🔵 Minor Issues

1. Missing Type Safety for Anchor Props

Location: components/frontend/src/components/ui/message.tsx:86-95

Current Code:

a: ({ href, children }) => (
  <a
    href={href}
    target="_blank"
    rel="noopener noreferrer"
    className="text-primary hover:underline cursor-pointer"
  >
    {children}
  </a>
),

Issue: The anchor component parameters lack explicit type annotations, using implicit any types.

Recommendation:

a: ({ href, children }: { href?: string; children?: React.ReactNode }) => (
  <a
    href={href}
    target="_blank"
    rel="noopener noreferrer"
    className="text-primary hover:underline cursor-pointer"
  >
    {children}
  </a>
),

Why it matters: Frontend standards mandate zero any types. While this is implicit rather than explicit, adding type annotations improves code clarity and catches potential bugs.

Severity: Minor - The code works correctly and types are inferred, but explicit types align better with project standards.


Positive Highlights

✅ Security Best Practices

  • Proper security headers: rel="noopener noreferrer" prevents tab-nabbing attacks
  • External link handling: target="_blank" correctly opens links in new tabs
  • No XSS vulnerabilities: Using ReactMarkdown's component system (not dangerouslySetInnerHTML)

✅ Consistent Design System Integration

  • Uses text-primary color token from Tailwind theme
  • Hover states (hover:underline) follow design patterns
  • Integrates seamlessly with existing defaultComponents

✅ Correct Pattern Usage

  • Follows established defaultComponents pattern (see lines 26-96)
  • Consistent with other component implementations (code, p, h1, ul, etc.)
  • Proper integration with remarkGfm auto-linking

✅ Minimal, Focused Change

  • Only 10 lines added
  • Solves the problem without over-engineering
  • No unnecessary abstractions or complexity

Code Quality Assessment

Adherence to CLAUDE.md patterns: ✅ Excellent

  • ✅ Frontend development standards followed
  • ✅ Uses established component patterns
  • ✅ No custom UI components (extends existing system)
  • ✅ Minimal, focused change

Security standards: ✅ Excellent

  • ✅ Proper security headers (noopener noreferrer)
  • ✅ No exposure of sensitive data
  • ✅ Safe markdown rendering approach

Architecture alignment: ✅ Good

  • ✅ Follows message component patterns
  • ✅ Integrates with ReactMarkdown correctly
  • ⚠️ Minor: Could benefit from explicit type annotations

Recommendations

Priority 1: Add Explicit Type Annotations (Optional)

While not blocking, adding type annotations would align with the "Zero any Types" standard:

a: ({ href, children }: { href?: string; children?: React.ReactNode }) => (
  // ... rest of component
)

Priority 2: Consider Testing Coverage

The PR description mentions manual testing, but consider adding:

  • Cypress test for URL rendering in chat messages
  • Visual regression test (if applicable)

Pre-Commit Checklist Review

Checking against Frontend Pre-Commit Checklist from CLAUDE.md:

  • ✅ Zero any types (implicit, but inferred correctly)
  • ✅ All UI uses Shadcn components (extends existing system)
  • N/A All data operations use React Query (no data operations)
  • ✅ Components under 200 lines (entire file is 264 lines)
  • ✅ Single-use components colocated (component is part of shared UI)
  • N/A All buttons have loading states (no buttons added)
  • N/A All lists have empty states (no lists added)
  • N/A All nested pages have breadcrumbs (no pages added)
  • N/A All routes have loading.tsx, error.tsx (no routes added)
  • ✅ npm run build passes (mentioned in PR description)
  • N/A All types use type instead of interface (no new types added)

Final Verdict

Approve with minor suggestion. ✅

This PR is ready to merge as-is. The implementation is secure, follows project patterns, and solves the stated problem effectively. The only suggestion is to add explicit type annotations to align with the "Zero any Types" standard, but this is a minor enhancement that doesn't block the PR.

Impact: Low risk, high value

  • Improves UX by making URLs clickable
  • No breaking changes
  • Minimal code footprint
  • Follows security best practices

Additional Context

Related Standards:

  • Frontend Development Context: ✅ Followed
  • React Query Usage: N/A (no data operations)
  • Security Standards: ✅ Excellent (proper link security)

Files Reviewed:

  • components/frontend/src/components/ui/message.tsx (10 lines added)

Recommendation: Merge after optional type annotation improvement, or merge as-is if team accepts implicit typing for component props.

🤖 Generated with Claude Code


🔍 View AI decision process (logs available for 90 days)

📋 View memory system files loaded (click to expand)

What Amber Loaded for Code Review

Amber automatically loaded these repository standards from the memory system:

  1. CLAUDE.md - Master project instructions, development standards
  2. backend-development.md - Go backend, K8s integration patterns
  3. frontend-development.md - NextJS, Shadcn UI, React Query patterns
  4. security-standards.md - Auth, RBAC, token handling
  5. k8s-client-usage.md - User token vs service account patterns
  6. error-handling.md - Consistent error patterns
  7. react-query-usage.md - Data fetching patterns

Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs #359, #360) - not just generic code review guidelines.

@jeremyeder
jeremyeder merged commit 3136a8f into ambient-code:main Jan 29, 2026
jeremyeder pushed a commit that referenced this pull request Jan 30, 2026
## Summary
Fixes URLs not being rendered as clickable hyperlinks in chat messages.

## Changes
- Added custom anchor (`a`) component to `defaultComponents` in
`message.tsx`
- Configured links to open in new tab (`target="_blank"`)
- Added security headers (`rel="noopener noreferrer"`)
- Applied primary color styling with hover underline effect

## Technical Details
The `remarkGfm` plugin auto-links URLs in markdown, but without a custom
anchor component they weren't properly styled or configured for external
links. This fix ensures all URLs are:
- Clickable
- Open in new tabs
- Secure (with `noopener noreferrer`)
- Styled consistently with the design system

## Testing
Verified that:
- ✅ Frontend builds successfully
- ✅ Linter passes
- ✅ URLs render as clickable links
- ✅ Links open in new tab
- ✅ Security headers are present

## Related Issue
Fixes: https://issues.redhat.com/browse/RHOAIENG-39106

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <claude@anthropic.com>
mergify Bot added a commit that referenced this pull request Sep 23, 2026
## SDK Version Bump

- `claude-agent-sdk`: 0.2.139 -> 0.2.157
- `anthropic`: 0.122.0 -> 1.7.0

### TL;DR

- **3 migration(s) required** (deprecated APIs — see Action Items)
- **1 opt-in feature(s)** available for adoption
- 3 behavior change(s) to review
- 33 new feature(s), 36 bug fix(es)

## Action Items

- **MIGRATE** — **add group with display_name to rate limits, deprecate
group_type** (`anthropic` v1.7.0): add group with display_name to rate
limits, deprecate group_type
- **MIGRATE** — **client** (`anthropic` v1.5.0): keep the
idempotency_key request option as a deprecated no-op (#621)
- **MIGRATE** — **client** (`anthropic` v1.0.0): upgrade to httpx2 and
some minor breaking changes. See MIGRATION.md for details

**Opt-in features to evaluate:**

- [ ] **`snapshot` option for system prompts** (`claude-agent-sdk`
v0.2.153): Added a `snapshot` field to `SystemPromptPreset` and a new
`SystemPromptCustom` typed dict. When...

## Behavior Changes

| Change | Package | Version | Action |
|--------|---------|---------|--------|
| **MCP 2.x support for in-process SDK MCP servers** |
`claude-agent-sdk` | 0.2.140 | Review |
| **`ResultError` exception with structured error payload** |
`claude-agent-sdk` | 0.2.140 | Review |
| **client** | `anthropic` | 1.0.0 | Review |

<details><summary><strong>New Features</strong> (33)</summary>

| Feature | Package | Version | Claude | Gemini | Default | Action |
|---------|---------|---------|--------|--------|---------|--------|
| **`snapshot` option for system prompts** | `claude-agent-sdk` |
0.2.153 | Yes | - | Opt-in | Opt-in |
| **`forward_subagent_text` option** | `claude-agent-sdk` | 0.2.140 |
Yes | - | Available | Review |
| **`can_use_tool` callback support for `query()` and string prompts** |
`claude-agent-sdk` | 0.2.140 | Yes | - | Available | Review |
| **add group with display_name to rate limits, deprecate group_type** |
`anthropic` | 1.7.0 | - | - | Available | Migrate |
| **tools** | `anthropic` | 1.7.0 | Yes | - | Available | Review |
| **add auto mode tool permissions for Managed Agents** | `anthropic` |
1.6.0 | - | - | Available | Review |
| **add compaction parameter and signed compaction blocks (beta)** |
`anthropic` | 1.6.0 | - | - | Available | Review |
| **add enum types for workspace data-residency geo fields** |
`anthropic` | 1.6.0 | - | - | Available | Review |
| **add thinking_mismatch_allowed entries to input_transformations
(beta)** | `anthropic` | 1.6.0 | Yes | - | Available | Review |
| **add url_sources to the web fetch tool** | `anthropic` | 1.6.0 | - |
- | Available | Review |
| **add workspace_id parameter to user profiles methods** | `anthropic`
| 1.6.0 | - | - | Available | Review |
| **client** | `anthropic` | 1.6.0 | - | - | Available | Review |
| **add auto mode tool permissions for Managed Agents** | `anthropic` |
1.5.0 | - | - | Available | Review |
| **add content_too_large web_fetch tool error code** | `anthropic` |
1.5.0 | - | - | Available | Review |
| **add the user-profiles-2026-09-04 beta value and
external_user_details to user...** | `anthropic` | 1.5.0 | - | - |
Available | Review |
| **support mounting public GitHub repositories without an
authorization_token in...** | `anthropic` | 1.5.0 | Yes | - | Available
| Review |
| **client** | `anthropic` | 1.5.0 | - | - | Available | Review |
| **credentials** | `anthropic` | 1.5.0 | - | - | Available | Review |
| **tools** | `anthropic` | 1.5.0 | - | - | Available | Review |
| **add Claude Tag category and user breakdowns to usage reports** |
`anthropic` | 1.4.0 | Yes | - | Available | Review |
| **add named types for organization compliance settings state** |
`anthropic` | 1.4.0 | - | - | Available | Review |
| **add support for sending a workspace ID on more endpoints** |
`anthropic` | 1.4.0 | - | - | Available | Review |
| **beta user profiles: add external_user_onboarded_at, remove
relationship in fa...** | `anthropic` | 1.3.0 | - | - | Available |
Review |
| **organization compliance settings, user-profile order_by,
memory-store and too...** | `anthropic` | 1.3.0 | - | - | Available |
Review |
| **beta files/skills namespaces use GA shapes; drop dated beta header
pins** | `anthropic` | 1.2.0 | - | - | Available | Review |
| **add `updates` thinking display mode (beta)** | `anthropic` | 1.1.0 |
Yes | - | Available | Review |
| **add missing anthropic-beta values** | `anthropic` | 1.1.0 | Yes | -
| Available | Review |
| **add support for Organization API endpoints** | `anthropic` | 1.1.0 |
- | - | Available | Review |
| **managed agents web search config and self hosted sandbox memory** |
`anthropic` | 0.125.0 | - | - | Available | Review |
| **Files and Skills APIs are now GA; add computer use and browser use
toolsets** | `anthropic` | 0.124.0 | - | - | Available | Review |
| **additions to files and memory stores** | `anthropic` | 0.123.0 | - |
- | Available | Review |
| **updates to skill, files, and user profiles** | `anthropic` | 0.123.0
| - | - | Available | Review |
| **client** | `anthropic` | 0.123.0 | - | - | Available | Review |

</details>

<details><summary><strong>Bug Fixes</strong> (36)</summary>

- **Recover `parent_tool_use_id` when reading subagent transcripts**
(`claude-agent-sdk` 0.2.140): `get_subagent_messages()` and
`get_subagent_messages_from_store()` now recover the
`parent_tool_use_id` from the suba...
- **bedrock** (`anthropic` 1.7.0): raise an API error for eventstream
exception and error frames (#769)
- **client** (`anthropic` 1.7.0): accept `X | Y` union types when
parsing responses
- **client** (`anthropic` 1.7.0): don't raise TypeError for `X | Y`
fields with unknown data
- **client** (`anthropic` 1.7.0): join multiple anthropic-beta values
with a comma and no space (#781)
- **tools** (`anthropic` 1.7.0): tidy compact_before_next_turn() state
and failure handling (#804)
- **mark usage iteration model as nullable** (`anthropic` 1.6.0): mark
usage iteration model as nullable
- **use one input transformation type for message and delta event**
(`anthropic` 1.6.0): use one input transformation type for message and
delta event
- **client** (`anthropic` 1.6.0): honor Retry-After values above 60
seconds
- **client** (`anthropic` 1.6.0): ignore invalid Retry-After values and
validate maxRetries
- **client** (`anthropic` 1.6.0): retry connection errors in the async
client and stop blocking in the coroutine retry loop
- **client** (`anthropic` 1.6.0): use the default backoff when
Retry-After is out of range
- **client** (`anthropic` 1.5.0): merge extra_body before client hooks
run
- **credentials** (`anthropic` 1.5.0): refuse credentials files
accessible by group or others
- **streaming** (`anthropic` 1.5.0): keep partial tool input JSON off
content blocks
- **types** (`anthropic` 1.5.0): leave parsed_output out of dumped text
blocks
- **client** (`anthropic` 1.4.0): raise a clear error when an httpx
object is passed instead of an httpx2 one
- **repair custom-code merge in messages resources** (`anthropic`
1.4.0): repair custom-code merge in messages resources (#580)
- **aws** (`anthropic` 1.3.0): resolve base_url from aws_region under
skip_auth and with_options (#564)
- **batches** (`anthropic` 1.3.0): add results to GA raw/streaming
response wrappers
- **client** (`anthropic` 1.3.0): derive multipart filename for file
tuples passed without one
- **types** (`anthropic` 1.3.0): remove unused wire aliases from header
and path params
- **aws,bedrock** (`anthropic` 1.2.0): sign raw request bytes so binary
file uploads work (#531)
- **sessions** (`anthropic` 1.2.0): make event accumulator
forward-compatible with new event types (#533)
- **tools** (`anthropic` 1.2.0): let read return a view_range of a file
over the size cap (#538)
- **tools** (`anthropic` 1.2.0): preserve exact file bytes in the agent
toolset and memory tool (no newline translation) (#540)
- **webhooks** (`anthropic` 1.2.0): require headers to be passed to
`unwrap()`
- **correct link for long requests error (4474f31), closes #1883**
(`anthropic` 1.1.0): correct link for long requests error (#1884)
(4474f31), closes #1883
- **tools** (`anthropic` 1.1.0): keep the tool runner going on
pause_turn (#343)
- **beta** (`anthropic` 1.0.0): stop warning about `output_format=` on
the parse/stream/tool_runner helpers
- **remove unsupported mid_conv_system content block** (`anthropic`
0.123.0): remove unsupported mid_conv_system content block
- **client** (`anthropic` 0.123.0): compute platform headers without
spawning a subprocess
- **client** (`anthropic` 0.123.0): export custom status errors from
_exceptions.__all__ (#459)
- **client** (`anthropic` 0.123.0): export ServiceUnavailableError and
DeadlineExceededError from the package root (#468)
- **session-runner** (`anthropic` 0.123.0): retry tool-result sends for
at least the lease TTL (#453)
- **tools** (`anthropic` 0.123.0): run synchronous session tools in a
worker thread (#399)

</details>

<details><summary><strong>Bundled Claude CLI Versions</strong>
(17)</summary>

| SDK Version | CLI Version |
|-------------|-------------|
| 0.2.156 | 2.1.276 |
| 0.2.155 | 2.1.275 |
| 0.2.154 | 2.1.274 |
| 0.2.153 | 2.1.273 |
| 0.2.152 | 2.1.259 |
| 0.2.151 | 2.1.258 |
| 0.2.150 | 2.1.257 |
| 0.2.149 | 2.1.252 |
| 0.2.148 | 2.1.251 |
| 0.2.147 | 2.1.250 |
| 0.2.146 | 2.1.248 |
| 0.2.145 | 2.1.247 |
| 0.2.144 | 2.1.246 |
| 0.2.143 | 2.1.238 |
| 0.2.142 | 2.1.237 |
| 0.2.141 | 2.1.236 |
| 0.2.140 | 2.1.235 |

</details>

<details><summary>Internal changes: <code>claude-agent-sdk</code>
(17)</summary>

- Updated bundled Claude CLI to version 2.1.276 (0.2.156)
- Updated bundled Claude CLI to version 2.1.275 (0.2.155)
- Updated bundled Claude CLI to version 2.1.274 (0.2.154)
- Updated bundled Claude CLI to version 2.1.273 (0.2.153)
- Updated bundled Claude CLI to version 2.1.259 (0.2.152)
- Updated bundled Claude CLI to version 2.1.258 (0.2.151)
- Updated bundled Claude CLI to version 2.1.257 (0.2.150)
- Updated bundled Claude CLI to version 2.1.252 (0.2.149)
- Updated bundled Claude CLI to version 2.1.251 (0.2.148)
- Updated bundled Claude CLI to version 2.1.250 (0.2.147)
- Updated bundled Claude CLI to version 2.1.248 (0.2.146)
- Updated bundled Claude CLI to version 2.1.247 (0.2.145)
- Updated bundled Claude CLI to version 2.1.246 (0.2.144)
- Updated bundled Claude CLI to version 2.1.238 (0.2.143)
- Updated bundled Claude CLI to version 2.1.237 (0.2.142)
- Updated bundled Claude CLI to version 2.1.236 (0.2.141)
- Updated bundled Claude CLI to version 2.1.235 (0.2.140)

</details>

<details><summary>Internal changes: <code>anthropic</code>
(24)</summary>

- add more unnecessary cast comments (1.7.0)
- pass strict= to zip() in the MCP tool helpers (1.7.0)
- remove an unused noqa comment from the model tests (1.7.0)
- set ruff's target version to Python 3.10 (1.7.0)
- sort the imports in beta_message.py (1.6.0)
- remove generated file header comments (1.5.0)
- restore package version (1.5.0)
- restore package version (1.5.0)
- stop stamping the package version into generated files (1.5.0)
- bundle the mock server spec and update dev tooling (1.4.0)
- clean up code comments (1.4.0)
- fix mypy unreachable error in detect-breaking-changes script (1.4.0)
- narrower codeowners scope (1.4.0)
- revert codeowners change (1.4.0)
- manual updates (1.3.0)
- ci (1.3.0)
- drop the unused discriminator argument from PropertyInfo (1.3.0)
- drop the unused distro dependency (1.3.0)
- ci (1.2.0)
- cancel superseded CI runs (1.1.0)
- minor workflow reformat (1.1.0)
- remove the legacy response API (1.1.0)
- use `import httpx2` directly instead of aliasing as httpx (1.1.0)
- remove leftover prism references (0.123.0)

</details>

---
_Automated by `.github/workflows/sdk-version-bump.yml`_
## SDK Options Drift

ClaudeAgentOptions fields changed — sdk-options-manifest.json updated.
Review backend allowlist and frontend schema for new/removed fields.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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.

3 participants