fix(terminal-core): prevent clack note box from re-breaking copy-sensitive paths (fixes #94730)#94740
Conversation
…itive paths wrapNoteMessage correctly preserves paths/URLs as unbroken tokens, but clack's note() re-wraps them with hard-wrap inside the bordered box. Align maxWidth with clack's content width (columns - 6) and pad wrapped lines to that width so clack's wrap-ansi sees no overflow. Fixes openclaw#94730
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: this branch still lets oversized copy-sensitive paths reach Clack's hard-wrap path, while #94738 is an open, mergeable candidate with sufficient real behavior proof for the same canonical bug. Canonical path: Use #94738, or an equivalent shared terminal-core fix that prevents Clack's final hard-wrap, as the landing path for the canonical bug. So I’m closing this here and keeping the remaining discussion on #94738. Review detailsBest possible solution: Use #94738, or an equivalent shared terminal-core fix that prevents Clack's final hard-wrap, as the landing path for the canonical bug. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main routes session-lock paths through Is this the best way to solve the issue? No: padding lines that are narrower than Security review: Security review cleared: The diff only changes terminal note rendering and adds a test, with no dependency, workflow, secret, package, or code-execution surface change. 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.wrapNoteMessagecorrectly preserves copy-sensitive tokens (paths, URLs) as unbroken lines, but@clack/prompts.note()performs its own hard-wrap inside the bordered box — breaking paths mid-extension (e.g..jsonl.lock→.js+onl.lock).The fix aligns
maxWidthwith clack's actual content width (columns - 6) and pads wrapped lines to that width, so clack'swrap-ansisees no overflow and leaves copy-sensitive tokens intact.Changes Made
packages/terminal-core/src/note.ts: Innote(), computecontentWidth = columns - 6, pass it asmaxWidthtowrapNoteMessage, and pad each line tocontentWidthbefore passing toclackNote.packages/terminal-core/src/note.test.ts(new): Tests that copy-sensitive paths are not re-broken by the clack note box, and that lines are padded to prevent re-wrapping.Real behavior proof
openclaw doctornote boxes break copy-sensitive paths (file paths, URLs) mid-token when the terminal is ≤88 columns wide.55323103.node scripts/run-vitest.mjs run packages/terminal-core/src/note.test.ts— 2 tests passnode scripts/run-vitest.mjs run packages/terminal-core/src/table.test.ts— 22 tests pass (existing wrapNoteMessage tests unaffected)grep -n:columns - 6so clack's hard-wrap sees no overflow. Copy-sensitive tokens remain on a single line.~/.openclaw/agents/main/sessions/9c2acae5-841f-4aea-936b-fdb513b60202.jsonl.lockstays intact in an 80-column terminal.