fix(terminal): preserve sibling home-prefix paths#98876
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 2, 2026, 3:28 AM ET / 07:28 UTC. Summary PR surface: Source +34, Tests +66. Total +100 across 2 files. Reproducibility: yes. Source inspection shows current main uses global home-string replacement and renderTable applies it to every table cell, so a HOME=/home/alice cell containing /home/alice2/project follows the reported failure path. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land this terminal-core boundary fix after ordinary maintainer review and CI; keep broader src/utils helper behavior tracked separately by the existing helper-focused PR if maintainers want that surface changed too. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main uses global home-string replacement and renderTable applies it to every table cell, so a HOME=/home/alice cell containing /home/alice2/project follows the reported failure path. Is this the best way to solve the issue? Yes. The PR fixes the implicated terminal-core displayString path with boundary-aware matching and table-level regression coverage; changing the broader src/utils helper is a separate surface, not required for this terminal-table bug. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d32c4cf3007f. Label changesLabel justifications:
Evidence reviewedPR surface: Source +34, Tests +66. Total +100 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Updated the PR body Evidence after the follow-up boundary fix. Added left-boundary handling, label/separator regression coverage, and fresh focused proof: |
|
Updated the PR body Evidence again to remove the stale missing-dependency proof gap and add direct |
|
Pushed a boundary follow-up and refreshed the PR body Evidence. The new head preserves exact/child home shortening, allows prose exact-home tokens like |
0a203b1 to
de0ff5f
Compare
|
maintainer repair and pre-merge proof complete on
known scope boundary: the broader public/plugin-SDK helper in |
|
Merged via squash.
|
…diagnostics
Replace text.split(homePath).join('~') with replaceHomePathInText() that
checks token boundaries before substituting home paths, preventing sibling
path corruption (same bug pattern as openclaw#98876).
Real behavior proof:
Input: "Error in /home/user2/project: file not found at /home/user/config.json"
OLD: "Error in ~2/project: file not found at ~/config.json" <- corrupted
NEW: "Error in /home/user2/project: file not found at ~/config.json"
Co-Authored-By: Claude <noreply@anthropic.com>
…diagnostics
Replace text.split(homePath).join('~') with replaceHomePathInText() that
checks token boundaries before substituting home paths, preventing sibling
path corruption (same bug pattern as openclaw#98876).
Real behavior proof:
Input: "Error in /home/user2/project: file not found at /home/user/config.json"
OLD: "Error in ~2/project: file not found at ~/config.json" <- corrupted
NEW: "Error in /home/user2/project: file not found at ~/config.json"
Co-Authored-By: Claude <noreply@anthropic.com>
…diagnostics
Replace text.split(homePath).join('~') with replaceHomePathInText() that
checks token boundaries before substituting home paths, preventing sibling
path corruption (same bug pattern as openclaw#98876).
Real behavior proof:
Input: "Error in /home/user2/project: file not found at /home/user/config.json"
OLD: "Error in ~2/project: file not found at ~/config.json" <- corrupted
NEW: "Error in /home/user2/project: file not found at ~/config.json"
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(terminal): preserve sibling home-prefix paths * fix(terminal): avoid embedded home path rewrites * fix(terminal): preserve punctuated sibling paths * fix(terminal): tighten home path boundaries
Closes #98872
What Problem This Solves
Terminal table rendering globally replaced the effective home string, so sibling or embedded paths that merely shared that prefix could be corrupted. For example,
/home/alice2/projectcould display as~2/projectwhen the effective home was/home/alice.Why This Change Was Made
displayStringnow scans home occurrences and replaces only values with a real left token boundary plus one of these right boundaries:/or\\child-path separatorThis preserves whole-home and child-path shortening, including labeled table values, while rejecting sibling prefixes, embedded longer paths, space-suffixed siblings, comma-suffixed siblings, and punctuation runs that continue into a path. The detailed cases live beside
displayString;renderTablekeeps one integration test.User Impact
Terminal tables no longer show misleading paths such as
~2/projector/tmp~/project. Exact home paths, child paths, and complete home tokens before terminal punctuation still use~or$OPENCLAW_HOME.Evidence
de0ff5fdf7f538594197830b1647895cf3c65064node scripts/run-vitest.mjs packages/terminal-core/src/display-string.test.ts packages/terminal-core/src/table.test.ts: 27/27 tests passed./node_modules/.bin/oxfmt --check ...and./node_modules/.bin/oxlint ...: passed for all three changed filestbx_01kwgwkdma74r1frdw64pn1ark, Actions run28573967242: remotecheck:changedpassed thecoreandcoreTestslanes with exit 0src/utils.tshas a broader public/plugin-SDK helper with similar prefix behavior; it is intentionally excluded from this narrow terminal-core fix and needs a separate clean follow-up