fix(terminal-core): replace clackNote with own box rendering to prevent path splitting#94741
Conversation
…nt path splitting wrapNoteMessage correctly preserves copy-sensitive tokens (paths, URLs) by allowing them to overflow the wrap width, but the downstream clackNote call would re-wrap them at the box border, splitting file extensions mid-token. Build the note box directly in renderNoteBox() so OpenClaw owns wrapping decisions end-to-end. Lines with copy-sensitive overflow are allowed to extend past the right border instead of being broken. Fixes openclaw#94730
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same doctor note-wrapping bug is already covered by a cleaner open landing path with positive real behavior proof, while this branch has a lint failure and only unit-test proof. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #94738 as the current canonical landing path for #94730, then let the issue close when that fix merges. So I’m closing this here and keeping the remaining discussion on #94738 and #94730. Review detailsBest possible solution: Use #94738 as the current canonical landing path for #94730, then let the issue close when that fix merges. Do we have a high-confidence way to reproduce the issue? Yes: the source path is clear because session lock doctor output reaches the shared Is this the best way to solve the issue? No: this PR is a plausible shared-renderer fix, but it is not the best current cleanup target while #94738 is a narrower open candidate with positive real behavior proof and clean lint/type checks. Security review: Security review cleared: The diff changes terminal rendering code and tests only; it adds no dependency, workflow, secret, network, package, or code-execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 2ef0589b760d. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
openclaw doctormangles long file paths insidenote(...)boxes because the downstreamclackNote()call re-wraps text thatwrapNoteMessage()already correctly preserved. The fix replaces the@clack/promptsnote box rendering with an OpenClaw-owned box renderer so copy-sensitive tokens (paths, URLs) stay intact.Fixes #94730
Root cause
wrapNoteMessageinpackages/terminal-core/src/note.tscorrectly identifies copy-sensitive tokens (paths starting with/,~/,./, URLs, Windows drives, etc.) and allows them to overflow the wrap width rather than being broken mid-token. However,note()then callsclackNote()which performs its own width-based wrapping viafast-wrap-ansi, unaware of the copy-sensitive semantics. The double-wrap causes the path to be split at the box border, breaking file extensions like.jsonl.lockinto.js+onl.lock.Fix
Remove the
clackNote()call and build the bordered note box directly inrenderNoteBox(). The new renderer:wrapNoteMessage()as-is (no re-wrapping)◇ Title ─╮,│ content │,╰───╯)theme/isRichhelpersReal behavior proof
Behavior addressed: Copy-sensitive file paths were split mid-extension inside
openclaw doctornote boxesReal setup tested:
COLUMNS=80)Exact steps or command run after fix:
pnpm test packages/terminal-core/src/note.test.tsAfter-fix evidence:
Observed result after the fix: All 9 tests pass. The
.jsonl.lockpath remains unbroken in the box. Copy-sensitive overflow lines extend past the right border without being split. No regressions inwrapNoteMessageor note suppression behavior.What was not tested: Full end-to-end
openclaw doctorrun with a real gateway session lock. The box rendering is verified via unit tests that exercise the exact same code path used bysrc/commands/doctor-session-locks.ts.Tests and validation
packages/terminal-core/src/note.test.ts(9 tests)wrapNoteMessage(path, URL, long-word wrapping)note()box rendering (title, borders, path preservation, overflow)pnpm tsgo— no errors related to note.tsRisk checklist
Did user-visible behavior change?
Yes— copy-sensitive paths inside note boxes are no longer split; they overflow the right border instead.Did config, environment, or migration behavior change?
NoDid security, auth, secrets, network, or tool execution behavior change?
NoWhat is the highest-risk area?
@clack/promptsin edge cases (e.g., very narrow terminals, right-to-left text).How is that risk mitigated?
@clack/prompts.note()function signature is unchanged; callers are unaffected.Current review state