Skip to content

refactor(infra): reuse canonical PATH prepend normalization - #129028

Merged
steipete merged 1 commit into
mainfrom
codex/cleanup4-path-normalization
Aug 25, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cleanup4-path-normalization

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Configured executable PATH prepends were normalized by a private handwritten trim, filtering, and deduplication loop even though the repository already owns an equivalent canonical string-list normalizer. Keeping both implementations invites input-validation and ordering drift in the exec runtime.

Why This Change Was Made

Keep the existing exported normalizePathPrepend function and its signature, but delegate its implementation to the existing normalizeUniqueTrimmedStringList helper from the same normalization module already imported by the owner. The strict primitive-string contract, blank rejection, Unicode whitespace trimming, first-seen ordering, single indexed-getter reads, and Windows PATH key casing are preserved. No configuration, plugin SDK, public API, security, or test behavior changes.

Production LOC: +2/-17 (net -15). Tests: +0/-0.

User Impact

No user-visible behavior change. Executable PATH configuration now follows the same canonical strict normalization contract as other core consumers, with less duplicated production code.

Evidence

  • Existing owner, normalization-core, and actual agent exec PATH suites: 106/106 passing across three Vitest configurations.
  • Executable before/after differential probe: 41,380 mixed primitive, non-string, boxed-string, non-array, whitespace, Unicode, duplicate, sparse-array, and insertion-order cases match the original implementation.
  • Indexed accessor executes exactly once; a Windows-style Path environment key retains its original casing through the real PATH application helper.
  • Exact changed-file oxlint, formatter check, and git diff --check pass.
  • Independent source review: accepted with no findings.
  • Fresh structured autoreview: clean, confidence 0.99.
  • Exact-head hosted CI and mandatory repository-native Testbox landing gates will verify the published commit before merge.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 1:49 AM ET / 05:49 UTC.

ClawSweeper review

What this changes

The PR replaces the local executable-PATH prepend cleanup loop with the shared trimmed unique-string-list normalizer.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No actionable defect found: this maintainer-owned, protected PR replaces duplicate logic with a contract-matched canonical helper and should remain open for normal exact-head validation.

Priority: P3
Reviewed head: 78cb3907882a82f24255a54ad0e6bfcc8f066739

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow contract-matched deletion refactor with relevant existing coverage and no actionable defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: Maintainer-authored internal refactor; the external-contributor real-behavior-proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Maintainer-authored internal refactor; the external-contributor real-behavior-proof gate does not apply.
Evidence reviewed 5 items Current-main baseline: The base helper filters non-strings, trims, removes blanks, and preserves first-seen values before PATH merging.
First-party normalizer contract: The imported helper accepts arrays only, trims primitive strings, rejects blank or non-string entries, and preserves insertion-order uniqueness.
Caller boundary: Agent exec normalizes configured path prepends once; request preparation applies them only to gateway or sandbox environments.
Findings None None.
Security None None.

Live Verification

Command: pnpm test src/infra/path-prepend.test.ts

Result: FAIL (partial) — step 2 expect_output path prepend helpers: expected terminal output was not visible within 30 seconds: "path prepend helpers"

pnpm test src/infra/path-prepend.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129028-qODbN5/target$ pnpm test src/infra/path-prepend.test.ts
$ node --import tsx scripts/test-projects.mts src/infra/path-prepend.test.ts
pnpm test src/infra/path-prepend.test.ts
[test] starting test/vitest/vitest.unit-fast.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129028-qODbN5/target

 ✓  unit-fast  src/infra/path-prepend.test.ts (20 tests) 7ms

 Test Files  1 passed (1)
      Tests  20 passed (20)
   Start at  05:50:25
   Duration  295ms (transform 98ms, setup 96ms, import 37ms, tests 7ms, environment 0ms)

[test] passed 1 Vitest shard in 11.14s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129028-qODbN5/target$ pnpm test src/infra/path-prepend.test.ts
$ node --import tsx scripts/test-projects.mts src/infra/path-prepend.test.ts
[test] starting test/vitest/vitest.unit-fast.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129028-qODbN5/target

 ✓  unit-fast  src/infra/path-prepend.test.ts (20 tests) 7ms

 Test Files  1 passed (1)
      Tests  20 passed (20)
   Start at  05:50:36
   Duration  211ms (transform 23ms, setup 31ms, import 19ms, tests 7ms, environment 0ms)

[test] passed 1 Vitest shard in 10.87s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129028-qODbN5/target$




















Assertions:

  • FAIL expect_output: path prepend helpers

How this fits together

Configured executable paths are normalized before the agent exec tool or update helpers merge them into a process environment. The resulting PATH determines which binaries a process can find.

flowchart LR
  A[Configured PATH entries] --> B[PATH prepend normalizer]
  B --> C[PATH merge helper]
  C --> D[Agent exec or updater]
  D --> E[Process environment]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed because review found no discrete defect; standard exact-head validation remains.
Agent review details

Security

None.

PR surface

Source -15. Total -15 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 2 17 -15
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 2 17 -15

Review metrics

Metric Value Why it matters
Production and test delta production -15 net (+2/-17), tests 0 The refactor deletes duplicated production logic without adding configuration, API, or test surface.

Technical review

Best possible solution:

Retain the shared normalizer as the sole implementation and land after exact-head CI and repository Testbox validation complete.

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

Not applicable: this is a behavior-preserving refactor; source equivalence and existing PATH/normalization tests provide the relevant check.

Is this the best way to solve the issue?

Yes: the shared helper preserves the current array-only, primitive-string, trim, blank-rejection, and first-seen-deduplication contract while removing duplicate logic.

AGENTS.md: found but not applied because it conflicted with ClawSweeper's review contract.

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

Labels

Label changes:

  • add P3: This is a narrow behavior-preserving internal cleanup with no user-visible impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored internal refactor; the external-contributor real-behavior-proof gate does not apply.

Label justifications:

  • P3: This is a narrow behavior-preserving internal cleanup with no user-visible impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored internal refactor; the external-contributor real-behavior-proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame assigns both the PATH helper and shared normalization contract to Peter Steinberger; he also authored this refactor. (role: original feature author and recent area contributor; confidence: high; commits: 5f9fda20c930, 78cb3907882a; files: src/infra/path-prepend.ts, packages/normalization-core/src/string-normalization.ts)

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.

@steipete
steipete merged commit 28c9f9a into main Aug 25, 2026
240 checks passed
@steipete
steipete deleted the codex/cleanup4-path-normalization branch August 25, 2026 06:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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