fix(terminal-core): render note box directly to preserve copy-sensitive tokens from Clack re-wrap#94771
Conversation
…ve tokens from Clack re-wrap - Replace clackNote delegate with direct box rendering so that copy-sensitive tokens (paths, URLs, file-like tokens) preserved by wrapNoteMessage are not re-wrapped by Clack's hard wrapAnsi - Copy-sensitive oversized lines overflow the right border instead of being split mid-token, keeping paths copy-pasteable - Remove unused @clack/prompts note import from note.ts Fixes openclaw#94730
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR addresses a valid doctor note-wrapping bug, but it is superseded by the narrower, proof-positive, cleanly mergeable replacement at #94746; this branch still has a renderer padding bug and a lint-visible unused import. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Land or finish #94746 as the shared terminal-core fix, then let it close the linked doctor note-wrapping issue and retire duplicate branches. So I’m closing this here and keeping the remaining discussion on #94746. Review detailsBest possible solution: Land or finish #94746 as the shared terminal-core fix, then let it close the linked doctor note-wrapping issue and retire duplicate branches. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main sends session-lock doctor output through terminal-core note(), and the pinned Clack renderer hard-wraps the final box after OpenClaw's copy-sensitive wrapping. I did not run a live doctor command in this read-only review. Is this the best way to solve the issue? No. Replacing the final renderer is a plausible layer, but this branch has a padding bug and is superseded by the narrower, proof-positive #94746. Security review: Security review cleared: The diff changes terminal rendering code and tests only; I found no concrete security or supply-chain concern. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against b28fda9ef8e6. |
|
Closed in favor of canonical PR #94746 (fix(note): prevent clack from re-breaking copy-sensitive tokens), which is already merged with 149 pass / 0 fail. The approach here was correct in direction but had a boundary padding bug and an unused import in tests. |
Summary
openclaw doctormangles long file paths insidenote(...)boxes byre-wrapping copy-sensitive tokens (paths, URLs) at the box width even
though
wrapNoteMessagecorrectly preserves them. The mangled linecannot be copy-pasted, defeating the diagnostic purpose.
Root cause:
note()calledclackNote(wrapNoteMessage(...)). Thefirst wrapping pass (
wrapNoteMessage) correctly preserves copy-sensitivetokens via
isCopySensitiveToken, butclackNoteperforms its ownhard-wrapping inside the bordered box and is unaware of copy-sensitive
token semantics — it breaks paths mid-extension at the box edge.
Fix: Replace the
clackNotedelegate with direct box rendering innote(). The box borders (top, sides, bottom) are drawn without anyre-wrapping. Lines that fit are padded to the box width; oversized
copy-sensitive lines overflow the right border so the user can still
triple-click and copy the full path/URL.
Fixes #94730
Real behavior proof
Behavior addressed:
openclaw doctorrenders session lock file paths as single unbrokentokens inside
note()boxes, instead of splitting.jsonl.lockinto.js+onl.lockacross lines.Real environment tested:
Linux 4.19.112-2.el8.x86_64, Node.js v24.13.1, pnpm, vitest 4.1.8
Exact steps or command run after this patch:
After-fix evidence:
Before fix (path split mid-extension):
After fix (path preserved, overflows right border):
Observed result after the fix:
Copy-sensitive tokens (paths, URLs, file-like tokens) are no longer split
mid-token by the final note box rendering. All 36 tests pass (10 new + 22
regression + 4 integration).
What was not tested:
openclaw doctorwith actual session lock files in an 80-columnterminal (requires running gateway with active session locks)
note()(state-integrity,volatile-fs, etc.) — they benefit from the same shared fix path
Risk / scope
─/╮/╯glyphsinstead of clack's default, and oversized lines overflow the right
border instead of wrapping
wrapNoteMessage,resolveNoteColumns, andwithSuppressedNotesAPIs are unchanged(padding, border glyphs). Mitigation: the output is still a
recognizable bordered box with the same title and content format
AI-assisted: built with Claude Code