Skip to content

fix(ui): show backtick-quoted GitHub links as chips with hover cards - #141446

Merged
steipete merged 4 commits into
mainfrom
claude/backtick-prefixed-url-detection-dbba7a
Sep 7, 2026
Merged

steipete merged 4 commits into
mainfrom
claude/backtick-prefixed-url-detection-dbba7a

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users reading chat messages would see a GitHub pull request or issue link rendered as a plain grey code box when the model quoted the URL in backticks (`https://github.com/openclaw/openclaw/pull/141131`), while the same URL written bare showed the compact #141131 chip with its icon and hover card. Models quote links this way often, so a common message shape lost the reference affordance.

Why This Change Was Made

markdown-it never linkifies inside code spans, so the existing GitHub link classification never saw these URLs. The parser now promotes a top-level code span whose CommonMark-normalized content is exactly one http(s) github.com URL, with no whitespace or control characters, into the same link tokens linkify produces, so the existing chip, label, tooltip, and hover-card path applies unchanged and the emitted markup is identical to a bare URL. Fenced and indented code blocks, code spans with surrounding text, non-GitHub URLs, and code spans inside authored [label](url) links stay as code.

User Impact

Backtick-quoted GitHub issue and pull request links in chat now show as #number chips with the issue or pull-request icon, keep the full URL in the tooltip, and open the hover card. Repository and file links quoted the same way get their short label with the GitHub mark. No change for other code spans or code blocks.

Evidence

  • New parser tests cover a quoted pull request, issue (with symmetric padding), and repository URL, plus negative cases: non-GitHub URL, leading prose, trailing prose, prose after a fragment, one-sided padding, an adjacent control character, and a code span inside an authored link. The positive cases fail on the previous parser; the trailing-prose cases fail without the whitespace guard.
  • Review follow-ups: ClawSweeper's P2 (trailing prose folded into the href because the URL parser percent-encodes spaces) and two Codex autoreview findings (one-sided padding bypassing a trimmed guard, C0 control characters) are fixed in follow-up commits. Final Codex autoreview at P2: scoped-clean.
  • Rebased onto main after feat(ui): link bare GitHub issue and PR references in chat #141431 (bare #1234 references) landed; that rule runs before this one and only touches text tokens, so the two do not overlap.
  • ui/src/components/markdown*.test.ts and github-link-hovercard.test.ts: 361 tests pass across 10 files, plus the hover-card provider suite.
  • check:changed clean (Control UI i18n, UI typecheck, dead-export scan, lint lanes).
  • Docs: docs/web/control-ui/feature-reference.md updated; it previously stated that GitHub marks never appear inside code spans.
  • Known gap: no live screenshot. The mock Gateway does not process chat sends, and the parser emits byte-identical markup to the bare-URL case, which the existing presentation browser tests cover.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 7, 2026 18:33
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 7, 2026, 3:43 PM ET / 19:43 UTC.

ClawSweeper review

What this changes

The Control UI turns standalone backtick-quoted GitHub URLs into existing link chips and hover-card targets, with matching regression coverage and documentation.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: the change remains useful, the earlier mixed-content defect is addressed, and no new blocking code defect was found. Required visual evidence remains outstanding.

Priority: P2
Reviewed head: afb1bc9a0729317a4a2923feadadf360e919e663

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch and regression cases are sound, with readiness limited by the outstanding visual evidence.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 7 items Introduced change and prior finding resolution: The pinned introduced delta promotes only code_inline tokens outside authored links. Its whitespace/control-character guard runs before URL parsing, addressing the previously reported trailing-prose and padding failures.
Meaningful regression coverage: The changed tests exercise sanitized HTML for quoted pull-request, issue, and repository URLs, plus mixed prose, padding, control characters, authored links, and fences. These tests were inspected, not executed during this read-only review.
Current-main necessity: The fetched main revision still classifies existing link_open tokens without promoting code_inline tokens. The merged bare-reference work at #141431 handles text references and explicitly skips code; it does not replace this change.
Findings None None.
Security None None.

How this fits together

The Control UI Markdown renderer converts chat message text into sanitized HTML. GitHub anchors receive compact labels and connect to the existing hover-card presentation.

flowchart LR
  A[Chat Markdown] --> B[Parse inline tokens]
  B --> C{Standalone GitHub URL in code?}
  C -->|Yes| D[Existing GitHub link classification]
  C -->|No| E[Preserve ordinary rendering]
  D --> F[Sanitized chat HTML]
  E --> F
  F --> G[Chips and hover cards]
Loading

Before merge

  • Resolve merge risk (P1) - The quoted-URL input has not been demonstrated in before/after chat captures, leaving its visual integration unverified.
  • Complete next step (P2) - Add sanitized before/after chat captures showing the quoted URL becoming a chip and opening its hover card. Redact private information before posting and update the PR body to trigger review; if needed, ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source +38, Tests +34, Docs 0. Total +72 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 43 5 +38
Tests 1 36 2 +34
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 80 8 +72

Review metrics

None.

Mantis proof suggestion

Web UI chat proof can directly demonstrate the changed chip appearance and hover interaction. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis verify a standalone backtick-quoted GitHub pull-request URL in Control UI chat and capture redacted before/after evidence of its chip, tooltip, and hover card, with mixed-content code remaining unchanged.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep quoted URLs on the shared GitHub-link rendering path while preserving mixed-content code and authored links.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep quoted URLs on the shared GitHub-link rendering path while preserving mixed-content code and authored links.

Do we have a high-confidence way to reproduce the issue?

Not applicable as an existing-contract bug: current code and prior documentation intentionally preserve code spans; this PR extends chip presentation to a selected code-span form.

Is this the best way to solve the issue?

Yes: promoting eligible tokens into the existing classifier avoids duplicating labels, styling, sanitization, or hover-card logic.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bc79a198dc0d.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded chat-rendering improvement with no demonstrated urgent workflow failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Introduced change and prior finding resolution: The pinned introduced delta promotes only code_inline tokens outside authored links. Its whitespace/control-character guard runs before URL parsing, addressing the previously reported trailing-prose and padding failures. (ui/src/components/markdown-parser.ts:528, afb1bc9a0729)
  • Meaningful regression coverage: The changed tests exercise sanitized HTML for quoted pull-request, issue, and repository URLs, plus mixed prose, padding, control characters, authored links, and fences. These tests were inspected, not executed during this read-only review. (ui/src/components/markdown-links.test.ts:1028, afb1bc9a0729)
  • Current-main necessity: The fetched main revision still classifies existing link_open tokens without promoting code_inline tokens. The merged bare-reference work at feat(ui): link bare GitHub issue and PR references in chat #141431 handles text references and explicitly skips code; it does not replace this change. (ui/src/components/markdown-parser.ts:502, bc79a198dc0d)
  • Existing sanitization and preview boundary: Generated anchors still pass through DOMPurify and the existing scheme, rel, and target handling. Hover-card targeting retains its existing canonical GitHub URL restriction; no credential, authorization, dependency, or execution boundary is changed. (ui/src/components/markdown.ts:443, afb1bc9a0729)
  • Visual evidence remains required: Root policy requires inspected, sanitized before/after captures for UI appearance changes, reinforced by CONTRIBUTING.md. The complete supplied PR body explicitly acknowledges no live screenshot; existing browser presentation tests use constructed anchor markup rather than the new quoted-URL chat input. The prior review's capture request therefore remains applicable. (AGENTS.md:77, afb1bc9a0729)
  • Area-history routing: Current-main history lists Peter Steinberger for GitHub reference chips and bare-reference linking, and Vincent Koc for shared Markdown link boundaries. Exact source-line introduction could not be verified because required historical objects were unavailable, so these are routing suggestions only. (ui/src/components/markdown-parser.ts, bc79a198dc0d)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted before/after chat captures showing a quoted GitHub URL becoming a chip and opening its hover card.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-07T18:40:00.233Z sha 399a2ce :: blocked before merge. :: [P2] Reject mixed-content spans before promoting their URLs
  • reviewed 2026-09-07T19:19:33.493Z sha 1b7c4429ef6b07598bb97c2912c6f959db0ae23f :: blocked before merge. :: none

@steipete
steipete force-pushed the claude/backtick-prefixed-url-detection-dbba7a branch from 399a2ce to 1b7c442 Compare September 7, 2026 19:12
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Status: the check-lint-core-2 failure on head 1b7c4429ef6 is ui/src/components/markdown.test.ts exceeding the max-lines limit. That file is untouched here; it crossed the limit on main after #141369 and #141431 landed, so every PR rebased onto current main hits it. Repair is #141485 (verbatim test split). This PR will be rebased and re-verified once that lands.

A code span holding nothing but a github.com URL now renders like a bare URL: issue and pull-request links become the #number chip with icon, tooltip, and hover card; repository and file links get the short label with the GitHub mark. Fenced blocks, code spans with other text, non-GitHub URLs, and code spans inside authored links stay as code.
The URL parser percent-encodes inner whitespace instead of failing, so a backtick span like a GitHub item URL followed by prose was promoted with the prose folded into the href. Only a span that is entirely one URL is promoted now; trailing-prose and post-fragment cases are covered by tests.
Trimming before the guard let one-sided padding such as a trailing space bypass it. CommonMark already strips symmetric padding, so any remaining whitespace is content and the span stays code.
The URL parser strips or percent-encodes C0 controls, so a span holding a GitHub URL plus a control character was still promoted. The guard now rejects control characters alongside whitespace.
@steipete
steipete force-pushed the claude/backtick-prefixed-url-detection-dbba7a branch from 1b7c442 to afb1bc9 Compare September 7, 2026 19:37
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 7, 2026
@steipete
steipete merged commit c688a95 into main Sep 7, 2026
129 checks passed
@steipete
steipete deleted the claude/backtick-prefixed-url-detection-dbba7a branch September 7, 2026 19:51
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…penclaw#141446)

* fix(ui): show backtick-quoted GitHub links as chips with hover cards

A code span holding nothing but a github.com URL now renders like a bare URL: issue and pull-request links become the #number chip with icon, tooltip, and hover card; repository and file links get the short label with the GitHub mark. Fenced blocks, code spans with other text, non-GitHub URLs, and code spans inside authored links stay as code.

* fix(ui): keep code spans with prose after a GitHub URL as code

The URL parser percent-encodes inner whitespace instead of failing, so a backtick span like a GitHub item URL followed by prose was promoted with the prose folded into the href. Only a span that is entirely one URL is promoted now; trailing-prose and post-fragment cases are covered by tests.

* fix(ui): require whitespace-free code spans before promoting GitHub URLs

Trimming before the guard let one-sided padding such as a trailing space bypass it. CommonMark already strips symmetric padding, so any remaining whitespace is content and the span stays code.

* fix(ui): reject control characters when promoting GitHub URL code spans

The URL parser strips or percent-encodes C0 controls, so a span holding a GitHub URL plus a control character was still promoted. The guard now rejects control characters alongside whitespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant