Skip to content

fix(terminal): preserve sibling home-prefix paths#98876

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
qingminglong:codex/issue-98872-terminal-home-display
Jul 2, 2026
Merged

fix(terminal): preserve sibling home-prefix paths#98876
vincentkoc merged 4 commits into
openclaw:mainfrom
qingminglong:codex/issue-98872-terminal-home-display

Conversation

@qingminglong

@qingminglong qingminglong commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

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/project could display as ~2/project when the effective home was /home/alice.

Why This Change Was Made

displayString now scans home occurrences and replaces only values with a real left token boundary plus one of these right boundaries:

  • end of the value
  • a / or \\ child-path separator
  • a terminal punctuation run followed by whitespace or end of input

This 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; renderTable keeps one integration test.

User Impact

Terminal tables no longer show misleading paths such as ~2/project or /tmp~/project. Exact home paths, child paths, and complete home tokens before terminal punctuation still use ~ or $OPENCLAW_HOME.

Evidence

  • Exact repaired head: de0ff5fdf7f538594197830b1647895cf3c65064
  • node 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 files
  • Fresh autoreview after accepted boundary fixes: no findings, confidence 0.91
  • Blacksmith Testbox tbx_01kwgwkdma74r1frdw64pn1ark, Actions run 28573967242: remote check:changed passed the core and coreTests lanes with exit 0
  • Exact-head GitHub CI: 61 passing checks, 0 pending, 0 failing; two initial workflow-sanity checkout failures were rerun successfully after GitHub returned HTTP 429
  • Known scope boundary: src/utils.ts has 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

@clawsweeper

clawsweeper Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 2, 2026, 3:28 AM ET / 07:28 UTC.

Summary
The PR replaces terminal-core table-cell home-path substitution with boundary-aware replacement and adds renderTable regressions for exact, child, sibling, embedded, punctuated, and OPENCLAW_HOME cases.

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
Relationship: fixed_by_candidate
Canonical: #98872
Summary: This PR is the active candidate fix for the linked terminal table home-prefix display bug; related helper and session PRs overlap but do not supersede this terminal-core change.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • No automated repair lane is needed because the PR already implements the narrow fix and has no actionable review finding; maintainers should proceed with normal review or landing.

Security
Cleared: The diff is limited to terminal display-formatting TypeScript and tests, with no dependency, workflow, secret, package, or supply-chain surface change.

Review details

Best 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 changes

Label justifications:

  • P2: The PR addresses a user-visible terminal output correctness bug with limited blast radius and no config, persistence, provider, or security surface.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix live renderTable output from the changed terminal-core path showing corrected exact, child, and sibling path display behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live renderTable output from the changed terminal-core path showing corrected exact, child, and sibling path display behavior.
Evidence reviewed

PR surface:

Source +34, Tests +66. Total +100 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 35 1 +34
Tests 1 67 1 +66
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 102 2 +100

What I checked:

Likely related people:

  • steipete: Current-line blame and PR metadata tie the terminal-core displayString/table files to commit 27104c1 from merged fix(codex): preserve plugin app approvals in side conversations #98812. (role: introduced current terminal-core display path; confidence: high; commits: 27104c1afb13; files: packages/terminal-core/src/display-string.ts, packages/terminal-core/src/table.ts, packages/terminal-core/src/table.test.ts)
  • Seb Slight: Commit db137dd implemented OPENCLAW_HOME-aware path resolution in src/utils.ts and related path tests, which is adjacent to the display-prefix contract copied into terminal-core. (role: adjacent path-resolution contributor; confidence: medium; commits: db137dd65da0; files: src/utils.ts, src/utils.test.ts, src/infra/home-dir.ts)
  • vincentkoc: The current live PR is assigned to vincentkoc, making them a practical routing candidate even though the code-history signal points elsewhere. (role: likely follow-up owner; confidence: medium; files: packages/terminal-core/src/display-string.ts, packages/terminal-core/src/table.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 2, 2026
@qingminglong

Copy link
Copy Markdown
Contributor Author

Updated the PR body Evidence after the follow-up boundary fix. Added left-boundary handling, label/separator regression coverage, and fresh focused proof: node scripts/run-vitest.mjs packages/terminal-core/src/table.test.ts passed 26 tests, git diff --check passed, and autoreview is clean. @clawsweeper re-review

@qingminglong

Copy link
Copy Markdown
Contributor Author

Updated the PR body Evidence again to remove the stale missing-dependency proof gap and add direct renderTable output from the changed terminal-core path. The body now includes the exact focused test result, git diff --check, autoreview, and real table output showing exact/child home paths shortened while sibling and embedded paths remain unchanged. @clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 2, 2026
@qingminglong

Copy link
Copy Markdown
Contributor Author

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 Home: <home>,, and keeps punctuated/space-suffixed sibling paths unchanged. Fresh proof: node scripts/run-vitest.mjs packages/terminal-core/src/table.test.ts passed 26 tests, git diff --check passed, pnpm exec oxlint packages/terminal-core/src/display-string.ts packages/terminal-core/src/table.test.ts passed, and the body includes direct renderTable output. Latest autoreview attempt timed out, so I did not claim it passed. @clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 2, 2026
@vincentkoc vincentkoc self-assigned this Jul 2, 2026
@vincentkoc
vincentkoc force-pushed the codex/issue-98872-terminal-home-display branch from 0a203b1 to de0ff5f Compare July 2, 2026 07:49
@vincentkoc

Copy link
Copy Markdown
Member

maintainer repair and pre-merge proof complete on de0ff5fdf7f538594197830b1647895cf3c65064.

  • replaced global home-string substitution with explicit left/right token-boundary checks
  • preserved exact home, child paths, labeled values, terminal punctuation, and $OPENCLAW_HOME
  • added negative coverage for sibling prefixes, space/comma suffixes, embedded longer paths, and punctuation runs that continue into paths
  • focused local proof: node scripts/run-vitest.mjs packages/terminal-core/src/display-string.test.ts packages/terminal-core/src/table.test.ts passed 27/27
  • formatter, lint, and git diff --check passed on the three changed files
  • fresh autoreview after accepting and fixing two boundary findings: no findings, confidence 0.91
  • Blacksmith Testbox tbx_01kwgwkdma74r1frdw64pn1ark, Actions run 28573967242: raw-sync check:changed passed core and coreTests, exit 0
  • exact-head GitHub CI: 61 passing, 0 pending, 0 failing
  • Workflow Sanity run 28574317788 initially hit GitHub checkout HTTP 429; the complete rerun passed and now records top-level success
  • native scripts/pr review-validate-artifacts 98876 and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 98876 passed

known scope boundary: the broader public/plugin-SDK helper in src/utils.ts remains separate work; mixing it here would widen the compatibility surface beyond #98872.

@vincentkoc
vincentkoc merged commit c170e91 into openclaw:main Jul 2, 2026
90 of 94 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

cxbAsDev added a commit to cxbAsDev/openclaw that referenced this pull request Jul 2, 2026
…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>
cxbAsDev added a commit to cxbAsDev/openclaw that referenced this pull request Jul 2, 2026
…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>
cxbAsDev added a commit to cxbAsDev/openclaw that referenced this pull request Jul 3, 2026
…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>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 3, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Terminal table display rewrites paths that only share the home directory prefix

2 participants