Skip to content

fix: avoid shortening home path substrings - #96398

Closed
lin-hongkuan wants to merge 2 commits into
openclaw:mainfrom
lin-hongkuan:codex/terminal-home-display-boundary
Closed

lin-hongkuan wants to merge 2 commits into
openclaw:mainfrom
lin-hongkuan:codex/terminal-home-display-boundary

Conversation

@lin-hongkuan

@lin-hongkuan lin-hongkuan commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where terminal table and status output could shorten paths that merely shared the same leading characters as the effective home directory. For example, when the effective home ended in al, a sibling path ending in alice could be displayed with the home marker even though it was outside the configured home.

AI-assisted: yes. I reviewed the touched code and ran the focused validation below.

Why This Change Was Made

Home path display replacement now checks path-token boundaries before replacing the effective home with ~ or $OPENCLAW_HOME. This keeps the existing shortening behavior for real home-contained paths while leaving sibling path names intact.

User Impact

Users and operators get copyable terminal output that no longer rewrites unrelated sibling paths into misleading home-relative paths.

Evidence

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.unit.config.ts packages/terminal-core/src/display-string.test.ts packages/terminal-core/src/table.test.ts
  • node_modules\.bin\oxfmt.cmd --check packages/terminal-core/src/display-string.ts packages/terminal-core/src/display-string.test.ts
  • git diff --check

Follow-up Evidence After Review

The review correctly asked for concrete terminal behavior proof and tighter sibling-path coverage. I updated the after-boundary check so a home match is shortened only when it is followed by a path separator or the end of the string. This preserves embedded output such as path=<home>\project while leaving sibling names like <home>+logs, <home>@logs, and <home>:logs untouched.

Live proof from this branch:

C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al\project => $OPENCLAW_HOME\project
path=C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al\project => path=$OPENCLAW_HOME\project
C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al+logs => C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al+logs
C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al@logs => C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al@logs
C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al:logs => C:\Users\lin20\Documents\New project 3\openclaw\tmp\openclaw-home\al:logs

Focused validation after the follow-up patch:

RUN  v4.1.8 C:/Users/lin20/Documents/New project 3/openclaw

Test Files  1 passed (1)
     Tests  1 passed (1)
  Start at  20:31:19
  Duration  577ms (transform 409ms, setup 307ms, import 8ms, tests 84ms, environment 0ms)
Checking formatting...

All matched files use the correct format.
Finished in 1220ms on 2 files using 32 threads.

git diff --check produced no output.

@clawsweeper

clawsweeper Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 8:41 AM ET / 12:41 UTC.

Summary
The PR replaces terminal-core's unbounded home-string replacement with a boundary-aware scanner and adds a colocated displayString regression test for real home paths and sibling path names.

PR surface: Source +41, Tests +30. Total +71 across 2 files.

Reproducibility: yes. at source level: current main and v2026.6.10 use unbounded home-token replacement, and renderTable applies that helper to table values. I did not run a local runtime repro because this review was read-only.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
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.

Risk before merge

  • [P1] The broader core shortenHomeInString helper still has the same unbounded replacement behavior on current main; this PR only fixes terminal-core table/status formatting, so maintainers should decide whether to land the narrow fix separately from the broader core helper work.

Maintainer options:

  1. Decide the mitigation before merge
    Land this focused terminal-core fix if maintainers accept the narrow scope, and keep the broader core helper repair tracked through Fix home path replacement in shortenHomeInString utility #88449 or a refreshed replacement.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair is needed now: the follow-up patch supplies real behavior proof and I found no discrete blocking defect in the terminal-core change.

Security
Cleared: The diff is limited to terminal-core TypeScript and a colocated unit test; it does not change dependencies, workflows, package scripts, secrets handling, or supply-chain execution paths.

Review details

Best possible solution:

Land this focused terminal-core fix if maintainers accept the narrow scope, and keep the broader core helper repair tracked through #88449 or a refreshed replacement.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main and v2026.6.10 use unbounded home-token replacement, and renderTable applies that helper to table values. I did not run a local runtime repro because this review was read-only.

Is this the best way to solve the issue?

Yes for the PR's narrow terminal-core table/status surface: requiring a separator or end after the home token fixes the reported sibling-path rewrite while preserving diagnostic text such as path=\project. It is not a complete repository-wide cleanup because the core helper remains a separate overlapping repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ae9474b5fdc0.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied after-fix terminal output from the branch showing the exact home-shortening and sibling-preservation behavior, with private details limited to local paths.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body now includes copied after-fix terminal output from the branch showing the exact home-shortening and sibling-preservation behavior, with private details limited to local paths.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This fixes a user-visible terminal display correctness bug with limited blast radius and a focused terminal-core patch.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 now includes copied after-fix terminal output from the branch showing the exact home-shortening and sibling-preservation behavior, with private details limited to local paths.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes copied after-fix terminal output from the branch showing the exact home-shortening and sibling-preservation behavior, with private details limited to local paths.
Evidence reviewed

PR surface:

Source +41, Tests +30. Total +71 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 42 1 +41
Tests 1 30 0 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 72 1 +71

What I checked:

Likely related people:

  • steipete: GitHub history shows steipete authored the terminal-core package move and recent terminal-core helper documentation, which covers the display-string/table surface this PR changes. (role: recent area contributor and terminal-core package refactor author; confidence: high; commits: de1dfab03ef0, d14fe163b5b5, 4df95d3c3fd6; files: packages/terminal-core/src/display-string.ts, packages/terminal-core/src/table.ts)
  • jbetala7: GitHub history shows recent focused maintenance of terminal table rendering and tests, the caller surface affected by displayString. (role: recent terminal table contributor; confidence: medium; commits: 29dd7847fd96; files: packages/terminal-core/src/table.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 Jun 24, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🧂 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 Jun 24, 2026
@lin-hongkuan

Copy link
Copy Markdown
Contributor Author

Closing this older non-issue-linked PR to keep the author open-PR count at the project-safe limit while replacing it with an issue-linked fix. The branch is left intact.

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.

1 participant