Skip to content

fix(install): preserve empty PATH search entries - #147249

Merged
vincentkoc merged 1 commit into
mainfrom
fix/install-cli-path-search
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/install-cli-path-search

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Related: #45233
Parent landed: #147221

What Problem This Solves

The CLI installer's PATH splitters discard a trailing or sole empty component, even though Bash treats that component as the current directory. A usable local runtime can disappear from lookup. Separately, filtering every search directory leaves an empty PATH, which accidentally searches the current directory again.

User Impact

Runtime discovery preserves PATH search order and intentional current-directory entries. Excluding every managed directory returns not found instead of introducing a new lookup location. Default FreeBSD alias reuse remains supported.

Why This Change Was Made

Append a delimiter before Bash splits PATH so the final original component survives. Reuse the selector's existing separator as the retained-entry indicator, distinguishing an intentional empty component from no retained entries.

Production is net +3 lines, including two comments. Ten focused cases add 68 test lines. This is the separately scoped PATH parsing repair identified while reviewing the runtime-link change.

Evidence

  • Exact signed head: 9170bc52e152d880914fef920575cb62f762c440, based on landed parent 4d6ebf94. Independent review verified the sole repair commit is patch-identical and inherits the parent’s macOS fixture and tuple typing corrections.
  • The unchanged parent was probed in a disposable directory: native Bash found npm through a trailing empty entry while the installer missed it; an excluded-only PATH unexpectedly found npm in the current directory.
  • Bash documents empty PATH components as current-directory lookup. A direct Bash field-splitting probe confirmed the added delimiter preserves sole/trailing entries.
  • Independent source review and fresh scoped autoreview found no actionable issues. Bash syntax, focused formatting/lint, and diff checks passed.
  • Ten fixtures cover both selectors, empty/trailing/leading entries, first-candidate priority, and fully excluded paths.
  • Historical Linux Crabbox proof at b6d3369c: the ten new cases produced the expected five failures against parent 8fd304ae1042ee082e4c6f73e0318622cbba63fe. Restoring that reviewed head and running node scripts/run-vitest.mjs test/scripts/install-cli.test.ts test/scripts/install-cli.freebsd.test.ts passed 147 tests, with one Darwin-only skip. The original completed client receipt verifies the source SHA and clean tracked state before/after, exit 0, and the disposable box stopped. Backing run.
  • Native FreeBSD 15.1 proof, attempt 1, passed at the prior reviewed head b6d3369c. A restricted PATH with a trailing current-directory entry selected the system runtime; published node/npm still worked after changing directories. Actual fresh and repeat OpenClaw 2026.9.4 installations passed, including active-alias reuse and native Node 24.20.0 / SQLite 3.53.4 NUL round-trip verification. The complete terminal log and source digest were checked. This covers installer and CLI behavior; it makes no service or all-addon readiness claim.
  • The temporary native proof workflow was removed after evidence verification; no permanent CI lane was added.
  • The current script differs from the native-tested version only in the parent’s generated download-timeout budget; PATH parsing, runtime validation, and link publication are unchanged. That receipt proves those unchanged paths, not a fresh execution of this head.
  • Fresh final-head Linux Crabbox proof at 9170bc52: pnpm tsgo:test:root passed, then the canonical two-file installer command passed 147 tests, with one expected Darwin-only skip. The original complete client receipt verifies exact HEAD and clean tracked state before and after, command exit 0, and the disposable box stopped. This covers the inherited macOS fixture selection and tuple typing integration on the Linux host; historical native receipts retain the platform limits stated above. Backing run identifies the disposable session lifecycle, not a required-CI result.

The parent has landed. This PR targets main with only the PATH parsing repair. Normal exact-head CI and native maintainer gates remain required before merge.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 3:25 PM ET / 19:25 UTC (Revision 3).

ClawSweeper review

What this changes

The CLI installer preserves intentional current-directory entries and search order in PATH, returns not found when every directory is excluded, and adds regression coverage.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair: current main retains both PATH defects, and the merged parent explicitly leaves them to this follow-up. No actionable findings remain; the earlier unmerged-parent blocker is resolved.

Priority: P2
Reviewed head: 9170bc52e152d880914fef920575cb62f762c440

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, maintainable repair with relevant native proof and regression coverage; no actionable defect was found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Accepted historical FreeBSD terminal proof exercises trailing-empty PATH selection, published runtime execution, and fresh/repeat installation; source comparison confirms those paths are unchanged at this head. GitHub confirms job success, although the environment blocked rereading its terminal log.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Accepted historical FreeBSD terminal proof exercises trailing-empty PATH selection, published runtime execution, and fresh/repeat installation; source comparison confirms those paths are unchanged at this head. GitHub confirms job success, although the environment blocked rereading its terminal log.
Evidence reviewed 8 items Introduced repair: The merge-base-to-head diff changes only the two PATH splitters, adds the retained-entry guard, and adds ten regression cases. The supplied verified test merge preserves base-only changes.
Current main still needs the repair: Both selectors still split the unmodified PATH, and command lookup lacks the no-retained-entry guard. The surrounding implementation validates candidates before publication and anchors relative link targets.
Latest release comparison: GitHub Contents API inspection of v2026.9.4 found the original PATH splitting in both selectors and no retained-entry guard. This is not an already-shipped repair.
Findings None None.
Security None None.

How this fits together

The CLI installer searches PATH for Node, npm, and optional runtime tools, validates the selected runtime, and links it into the installation prefix. These selectors support FreeBSD and Alpine setup and optional-tool discovery.

flowchart TD
  A[User PATH] --> B[Preserve ordered entries]
  B --> C[Exclude managed runtime directories]
  C --> D[Find command or usable runtime]
  D --> E[Validate Node and npm]
  E --> F[Publish runtime links]
  C --> G[Return not found when empty]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +68, Other +3. Total +71 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 68 0 +68
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 5 2 +3
Total 2 73 2 +71

Review metrics

None.

Root-cause cluster

Relationship: canonical
Canonical: #147249
Summary: This PR owns the distinct PATH parsing repair; the related FreeBSD request is broader and the merged parent repairs runtime publication.

Members:

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

Technical review

Best possible solution:

Keep runtime discovery within the existing selectors, preserving Bash PATH semantics while retaining candidate validation and managed-runtime exclusions.

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

Yes: current-main source exposes both mechanisms—dropping a trailing empty component and searching the current directory after all entries are excluded—and the supplied historical regressions exercise them. This review did not execute the installer.

Is this the best way to solve the issue?

Yes: the delimiter and retained-entry guard repair the existing selectors directly, preserve their callers and validation, and avoid adding another runtime-selection implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cf45ff4d6a9c.

Labels

Label justifications:

  • P2: This repairs bounded installer runtime-discovery failures for empty PATH components without adding configuration or changing ordinary search order.
  • 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 (terminal): Accepted historical FreeBSD terminal proof exercises trailing-empty PATH selection, published runtime execution, and fresh/repeat installation; source comparison confirms those paths are unchanged at this head. GitHub confirms job success, although the environment blocked rereading its terminal log.
  • proof: sufficient: Contributor real behavior proof is sufficient. Accepted historical FreeBSD terminal proof exercises trailing-empty PATH selection, published runtime execution, and fresh/repeat installation; source comparison confirms those paths are unchanged at this head. GitHub confirms job success, although the environment blocked rereading its terminal log.

Evidence

What I checked:

  • Introduced repair: The merge-base-to-head diff changes only the two PATH splitters, adds the retained-entry guard, and adds ten regression cases. The supplied verified test merge preserves base-only changes. (scripts/install-cli.sh:569, 9170bc52e152)
  • Current main still needs the repair: Both selectors still split the unmodified PATH, and command lookup lacks the no-retained-entry guard. The surrounding implementation validates candidates before publication and anchors relative link targets. (scripts/install-cli.sh:568, cf45ff4d6a9c)
  • Latest release comparison: GitHub Contents API inspection of v2026.9.4 found the original PATH splitting in both selectors and no retained-entry guard. This is not an already-shipped repair. (scripts/install-cli.sh:537, 3a9d69db306c)
  • Parent and review continuity: fix(install): preserve runtime links when Node validation fails #147221 merged the runtime-link repair and explicitly reserved PATH parsing for this PR. Live GitHub metadata confirms this PR is open, non-draft, targets main, and retains the reviewed head. The prior review recorded no findings. (9170bc52e152)
  • Historical proof still covers the changed code: The captured PR body reports native FreeBSD trailing-empty PATH selection, execution after changing directories, and fresh/repeat installations at b6d3369. Reading that exact script through GitHub and comparing it in memory with the checkout confirmed only inherited download-budget differences; PATH parsing, validation, and publication are unchanged. This is historical proof, not fresh execution of the current head. (scripts/install-cli.sh:558, 9170bc52e152)
  • Native proof job and inspection limitation: GitHub confirms the native installer job succeeded: https://github.com/vincentkoc/plugins-workspace/actions/runs/34773359447/job/103766890124. Its workflow revision is distinct from the tested OpenClaw revision. The log endpoint redirected to a host blocked by this review environment, so the previously accepted terminal evidence could not be independently reread here; that limitation does not invalidate the supplied proof. (314b8c2a6321)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-13T18:09:20.872Z sha b6d3369 :: blocked before merge. :: none
  • reviewed 2026-09-13T18:18:42.976Z sha b6d3369 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 13, 2026
@vincentkoc
vincentkoc force-pushed the fix/install-node-runtime-link-preservation branch from 8fd304a to f3d75ea Compare September 13, 2026 18:48
Base automatically changed from fix/install-node-runtime-link-preservation to main September 13, 2026 19:17
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M and removed size: S labels Sep 13, 2026
@vincentkoc
vincentkoc force-pushed the fix/install-cli-path-search branch from b6d3369 to 9170bc5 Compare September 13, 2026 19:19
@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 19:19
@vincentkoc
vincentkoc merged commit 305bcbe into main Sep 13, 2026
147 of 149 checks passed
@vincentkoc
vincentkoc deleted the fix/install-cli-path-search branch September 13, 2026 19:46
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR 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. scripts Repository scripts size: M 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