Repository navigation
improve: avoid rebuilding terminal link fallbacks - #139159
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 11:03 AM ET / 15:03 UTC. ClawSweeper reviewWhat this changesThe PR reduces temporary string allocation when formatting terminal links while preserving clickable links, plain-text fallbacks, and control-character filtering. Merge readiness✅ Ready for maintainer review Keep open: this useful optimization is absent from inspected main and the latest release. No blocking correctness or security findings. Priority: P3 Review scores
Verification
How this fits togetherTerminal Core formats links used by CLI help and documentation messages. It receives labels, URLs, and display options, then returns either terminal hyperlink sequences or readable plain text. flowchart TD
A[CLI help and documentation messages] --> B[Labels URLs and display options]
B --> C{Clickable output enabled}
C -->|Yes| D[Sanitize label and URL]
D --> E[Terminal hyperlink]
C -->|No| F[Select and sanitize fallback]
F --> G[Plain text]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -6, Tests +6. Total 0 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain one formatter with the existing terminal-safety contract, avoiding unnecessary work without introducing caching, dependencies, or configuration. Do we have a high-confidence way to reproduce the issue? Not applicable to a functional bug: this is an optimization, and current-main source confirms the unnecessary reconstruction and eager sanitization. Is this the best way to solve the issue? Yes. The shared formatter owns this work; caller-side shortcuts would duplicate policy, while the general safe-text sanitizer would change output semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 12a3b102f507. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (46 commits) fix(gateway): keep chat metadata responsive across auth refresh (openclaw#139192) fix(doctor): keep Workshop relocation lint read-only (openclaw#139193) perf(ui): retain unchanged forwarded avatar publications (openclaw#139181) fix(config): guide exec policy migration repairs (openclaw#139143) test(i18n): refresh representative Watch key (openclaw#139197) fix(agents): preserve recovered scheduled-run outcomes (openclaw#139037) refactor(acp): simplify pending operation accounting (openclaw#139189) fix(plugin-sdk): harden account scope for pairing requests and challenges (openclaw#139142) perf(gateway): avoid redundant PR landing ancestry checks (openclaw#139186) perf(ui): release captured audio cache leases directly (openclaw#139174) fix(skills): validate names in library forms (openclaw#139184) fix(sessions): reduce cold catalog listing delays (openclaw#139146) perf(cron): scan preserved action output once (openclaw#139163) fix(agents): keep fresh tool results readable under context pressure (openclaw#139165) fix(compaction): heartbeat sessions ignore the active transcript byte cap (openclaw#136533) perf(agents): reuse snapshotted web search result rows (openclaw#139162) fix(onboarding): keep Tauri setup recoverable and verify model results (openclaw#139140) fix(memory): rank indexed sessions by source activity (openclaw#139112) perf(terminal): avoid rebuilding sanitized link fallbacks (openclaw#139159) perf(agents): bound retained tool result projection data (openclaw#139157) ...
What Problem This Solves
Formatting CLI help and documentation links rebuilt every label and URL character by character, even when redirected output used an explicit fallback and neither input would be displayed.
Why This Change Was Made
The terminal-link owner now removes the same C0, DEL, and C1 characters with Unicode
Ccreplacement and selects explicit plain-text fallbacks before sanitizing unused inputs. Printable ANSI fragments, Unicode text, empty fallbacks, TTY/force selection, and OSC-8 framing keep their existing byte contract.User Impact
CLI links render identically with less temporary allocation. The docs-fallback microbenchmark sampled 3,955 → 56 bytes per call; this is an owner-level result, not an end-to-end CLI or retained-memory claim. Production is 6 lines smaller; expanded existing tests add 6 net lines.
Evidence