Skip to content

fix(tui): preserve authored hyperlink destinations - #136469

Merged
steipete merged 5 commits into
mainfrom
codex/qa30b-tui-hyperlinks
Sep 2, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/qa30b-tui-hyperlinks

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #136468.

A Markdown link such as [https://example.test/label](https://example.test/actual-destination) could open the label URL instead of its authored destination in hyperlink-capable terminals. Pi TUI had already emitted the correct native OSC8 span; OpenClaw's subsequent visible-URL pass overrode it.

Keep the renderer's existing hyperlink authoritative and infer targets only for unlinked text. Reuse the canonical terminal ANSI parser and replace the per-character URL map with a range cursor. The shipped bare/wrapped URL fallback remains intact.

Production +35 / −53 = -18 LOC; tests/support +148 / −5 = +143; docs +1.

Actual terminal proof

The real runTui loop runs in a native PTY with a synthetic backend. Before: the URL-shaped label emits /label as its target. After: it emits /actual-destination; the ordinary Documentation sibling remains correct. The 36-column case wraps across two rows and both retain the authored target. The unidentified-terminal path still prints and links the destination.

These pictures render the recorded 100×30 PTY frames and show diagnostics extracted from the recorded OSC8 stream. They are explicitly labeled renderings, not graphical terminal screenshots.

Before After
Recorded PTY before: wrong target Recorded PTY after: authored target
  • Three native PTY scenarios pass and exit normally; the original failing before trace is retained.
  • 165 tests across six owner/sibling files pass, including BEL/ST terminators, link identity parameters, adjacent bare URLs, wrapping, punctuation, RTL isolation, user/assistant/tool/side-question rendering and render-cache invalidation.
  • All 30 required changed-file checks, typed lint and formatting pass. Independent Codex P2 review is clean; source hashes match after commit.
  • Installed Pi TUI 0.84.2 source was inspected directly: parsed Markdown href emission, terminal capability routing, OSC8 parsing and wrap close/reopen behavior.

The proof exercises actual terminal bytes with a fake backend. It does not claim a graphical VS Code launch, browser navigation, provider/Gateway transport or persistence. The separate picker cancellation defect is being repaired independently.

Dependency inspection and CI follow-up

The maintainer directly inspected the installed Pi TUI 0.84.2 renderer and ANSI output contract, the shared terminal parser and the complete caller/fallback owner. The raw native-PTY output and fully inspected synthetic renderings show the authored destination is retained; the reviewer’s missing dependency files/DNS access is an environment limitation, accepted with that direct inspection and recorded evidence.

The serial PTY inventory includes the new hyperlink integration test; all four inventory checks pass. Canonical startup-recovery coverage and its real-Gateway proof are described below. These CI corrections add no counted product issue.

CI follow-up and review disposition

The temporary Gateway CLI fixture cleanup has been removed because main already owns the canonical test split. The cumulative PR no longer changes that file. The exact three-way file merge matches main byte for byte, retaining the health/transport cases, Linux socat case and cleanup hooks; typed lint and an independent Codex P2 review pass. No product issue or production deletion is credited to this reconciliation.

Shared CI fixture follow-up

Startup-recovery coverage now uses the canonical fixture already landed in #136473: await both exact queued message identities, assert one pending item alongside the active source, then retain cancellation, survivor and cleanup checks. This replaces the earlier pending-only assertion where present. The exact real-Gateway scenario passes after adoption; no production recovery behavior changes.

Fresh scoped typed lint/format checks and independent Codex P2 review pass. Shared review reuse is limited to identical before/after files and owner context. These CI repairs add no counted product issue.

Maintainer landing disposition

The latest review’s required-check rank-up move is complete: exact-head CI passed. Root directly inspected installed Pi TUI0.84.2 components/markdown.js:529, terminal-image.js and utils.js:397/610 for authored href emission, capability routing and OSC8 close/reopen behavior. The previously recorded native-PTY proof and dependency inspection address the reviewer’s missing-source/DNS limitation. Production owners remain unchanged on main a0af72e, and its three-way merge is clean.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 3:51 PM ET / 19:51 UTC.

ClawSweeper review

What this changes

This PR preserves Markdown-authored terminal hyperlink destinations while continuing to add links to plain and wrapped URLs that the renderer did not link.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for normal maintainer merge handling. The exact head contains a focused repair at the post-render fallback owner; it is not eligible for automated cleanup because it is maintainer-associated and carries the protected maintainer label.

Priority: P2
Reviewed head: 50ea98af8a41fe1a451625ebe7b4afb41f9f0a27

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The targeted owner-boundary fix and focused regression coverage are solid; exact-head CI remains the normal landing gate.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies this as maintainer-associated, so the external-contributor proof gate does not apply; the included PTY test nevertheless exercises the changed fallback owner through the real TUI loop with a fake backend.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as maintainer-associated, so the external-contributor proof gate does not apply; the included PTY test nevertheless exercises the changed fallback owner through the real TUI loop with a fake backend.
Evidence reviewed 7 items Caller and owner boundary: HyperlinkMarkdown renders Pi TUI Markdown and immediately passes those lines into addOsc8Hyperlinks, making the fallback linker the correct owner of the override behavior.
Root-cause repair: The new segment walk recognizes existing ESC OSC 8 spans, suppresses inferred URLs while a renderer link is open, and keeps inferred links for remaining text.
Pre-fix behavior: The parent-base implementation mapped visible URL positions without tracking renderer-owned OSC 8 state, so a URL-shaped label could receive a second inferred destination.
Findings None None.
Security None None.

How this fits together

The terminal UI renders Markdown through Pi TUI, then OpenClaw adds fallback OSC 8 links for visible URLs. The changed pass must preserve renderer-owned link spans while handling unlinked text.

flowchart LR
  A[Markdown response] --> B[Pi TUI renderer]
  B --> C[Rendered terminal spans]
  C --> D[OpenClaw fallback linker]
  E[Unlinked visible URLs] --> D
  D --> F[Terminal hyperlink output]
Loading

Before merge

  • Resolve merge risk (P1) - Independent reinspection of the Pi TUI source and fetched-main blobs is unavailable in this partial checkout because package sources are absent and DNS resolution failed; retain exact-head CI as the merge gate.
Agent review details

Security

None.

PR surface

Source -18, Tests +143, Docs +1. Total +126 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 35 53 -18
Tests 5 148 5 +143
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 184 58 +126

Review metrics

Metric Value Why it matters
Production versus test delta production -18; tests/support +143 net; docs +1 The repair simplifies production hyperlink handling while adding focused unit and native-PTY regression coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #136468
Summary: This PR is the active candidate repair for the reported TUI hyperlink-destination bug.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the fallback logic at the post-render owner, preserve renderer-authored spans, and complete exact-head CI before landing.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the fallback logic at the post-render owner, preserve renderer-authored spans, and complete exact-head CI before landing.

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

No direct current-main run was performed in this read-only review, but the pre-fix owner path and the native-PTY scenario are clear from source and the supplied evidence, so the bug is source-reproducible.

Is this the best way to solve the issue?

Yes for the OpenClaw owner boundary: preserving renderer-owned spans in the post-render fallback pass avoids changing Pi TUI while retaining the existing bare-URL behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 47def12ea292.

Labels

Label justifications:

  • P2: This fixes incorrect terminal hyperlink destinations with bounded user impact and no demonstrated availability or security impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as maintainer-associated, so the external-contributor proof gate does not apply; the included PTY test nevertheless exercises the changed fallback owner through the real TUI loop with a fake backend.

Evidence

What I checked:

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.

  • Let the required checks complete successfully on the exact current head.

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 (4 earlier review cycles)
  • reviewed 2026-09-02T17:27:56.200Z sha 94f30d2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T18:35:05.495Z sha c820198 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T18:56:15.132Z sha 667ce2b :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T19:32:11.809Z sha 19dc29e :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M maintainer Maintainer-authored PR labels Sep 2, 2026
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 2, 2026
steipete added a commit that referenced this pull request Sep 2, 2026
Refresh against authenticated comparison-base checkout on main. Reuse the
reviewed corner serialization, CLI fixture, and queue-depth test repairs
from #136286, #136469, and #136434.
steipete added a commit that referenced this pull request Sep 2, 2026
Reuse the reviewed Gateway process-fixture cleanup from 667ce2b (PR #136469) to remove repeated configuration setup without changing assertions, timeouts, child invocations, or values.

Align the equivalent corner-shape normalization with 6c89a1a (PR #136286) so the shared CI repairs integrate without conflicting spellings. No production behavior changes.
steipete added a commit that referenced this pull request Sep 2, 2026
Reuse the reviewed fixture deduplication from #136469 while preserving the Linux listener regression added on main.
steipete added a commit that referenced this pull request Sep 2, 2026
Reuse the gateway CLI fixture cleanup from #136469 (667ce2b) and
the landed startup-recovery queue assertions from #136473 (564e544).
These address independent lint and shared-worker test failures while
preserving all process, state, cancellation, and survivor assertions.

Keep Vincent Koc's scanner implementation and original PR ancestry unchanged.
The new commit also refreshes pull-request CI against main's authenticated
checkout repair from #136178.
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 2, 2026
@steipete
steipete merged commit f186bdd into main Sep 2, 2026
237 of 238 checks passed
@steipete
steipete deleted the codex/qa30b-tui-hyperlinks branch September 2, 2026 20:52
@steipete

steipete commented Sep 2, 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 3, 2026
* fix(tui): preserve authored hyperlink destinations

* test: align queue depth and TUI integration expectations

* test(cli): share Gateway process configuration fixtures

* test(gateway): adopt canonical recovery queue admission

* test(cli): retain the canonical main process test split
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

Bug: TUI URL-shaped link labels override their authored destinations

1 participant