Skip to content

improve(startup): avoid repeated plugin path resolution - #152127

Merged
steipete merged 2 commits into
mainfrom
codex/startup-plugin-native-realpath-b0a1
Sep 18, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/startup-plugin-native-realpath-b0a1

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Startup plugin metadata inspection resolves the same plugin roots twice within one operation.

User Impact

Path resolution and plugin selection stay unchanged, with 157 fewer native filesystem calls in the measured normal-config inspection. No configuration changes or migrations are required. Installed Windows startup latency has not been measured for this patch.

Why This Change Was Made

Reuse the existing native-result cache slot while retaining the exact absolute-path identity check, JavaScript fallback for aliases and errors, and explicit cache invalidation.

Evidence

  • The extended existing cache test fails on the original owner (two native calls instead of one); all 20 cache cases pass with the change, including alias, fallback, and invalidation behavior.
  • Real inspection proof: identical selection results; native calls fall from 1,556 to 1,399 in both instrumented inspections. The repeated calls cost about 0.5 ms on the Linux baseline; this is attribution, not an end-to-end startup gain.
  • Scoped changed checks pass. The preceding run stopped because task-only diagnostic files were outside duplicate-scan targets; the gate-only successor corrected their placement without changing product source or repeating tests.
  • Fresh independent P2 review: no findings. No full build was needed for this cache-owner change; imports, package inputs, and execution boundaries are unchanged.

@clawsweeper

clawsweeper Bot commented Sep 18, 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 size: XS maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 19:59
@steipete steipete self-assigned this Sep 18, 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 Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 4:50 PM ET / 20:50 UTC (Revision 2).

ClawSweeper review

What this changes

Plugin metadata inspection reuses cached native filesystem path results and extends regression coverage for resolver ordering and cache invalidation.

Merge readiness

⛔ Blocked before merge - 1 item remains

The optimization remains useful on current main, and the reviewed patch introduces no actionable correctness finding. The previous review’s log-access limitation does not establish a merge blocker.

Priority: P3
Reviewed head: c16258b0e6c553c73f456c5000e04e6077d6a752

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with meaningful regression coverage and no identified correctness or security blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. The body reports real Linux plugin-inspection results for this cache owner; linked logs were inaccessible, and no material authority change introduces a separate proof requirement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. The body reports real Linux plugin-inspection results for this cache owner; linked logs were inaccessible, and no material authority change introduces a separate proof requirement.
Evidence reviewed 8 items Introduced change preserves resolver separation: The native lookup uses the existing nativeRealpath slot; failure returns null and still reaches JavaScript resolution. The exact absolute-path identity check remains intact. No public API, configuration, dependency, or persistent storage changes are introduced.
Existing lifecycle clears both result slots: Metadata invalidation clears each root's path facts and root aliases. Cache ownership remains scoped or process-owned, so this optimization does not introduce a second cache or a new freshness policy.
Focused regression coverage: The existing real-filesystem fixture now checks both resolver orders, one native call per cache generation, and renewed resolution after invalidation. Adjacent coverage retains native-error fallback and distinct JavaScript results. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

OpenClaw resolves plugin paths while discovering packages and preparing startup metadata. Its lifecycle-owned cache supplies those facts to plugin selection and loading.

flowchart TD
  A[Plugin package paths] --> B[Metadata inspection]
  B --> C[Path cache]
  C --> D{Native result matches absolute path?}
  D -->|Yes| E[Reuse canonical path]
  D -->|No or unavailable| F[JavaScript path resolver]
  E --> G[Plugin selection]
  F --> G
  H[Explicit metadata invalidation] --> C
Loading

Before merge

  • Resolve merge risk (P1) - The reported Linux measurements could not be independently inspected because the execution-log download was blocked by the reviewer environment.
Agent review details

Security

None.

PR surface

Source -3, Tests +15. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 6 -3
Tests 1 18 3 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 21 9 +12

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Reuse the existing native-result slot while preserving separate resolver identities and explicit lifecycle invalidation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Reuse the existing native-result slot while preserving separate resolver identities and explicit lifecycle invalidation.

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

Yes, source establishes the repeated call: JavaScript-mode resolution of a canonical absolute path invokes native resolution without populating its cache slot, so a subsequent native-mode request invokes it again. No tests or runtime reproduction were executed here.

Is this the best way to solve the issue?

Yes. Reusing the existing cache owner is the narrowest repair, and the added assertions cover resolver ordering and invalidation without adding production seams.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded startup-efficiency improvement with unchanged plugin selection and no claimed urgent user-facing failure.
  • 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: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. The body reports real Linux plugin-inspection results for this cache owner; linked logs were inaccessible, and no material authority change introduces a separate proof requirement.

Evidence

What I checked:

  • Introduced change preserves resolver separation: The native lookup uses the existing nativeRealpath slot; failure returns null and still reaches JavaScript resolution. The exact absolute-path identity check remains intact. No public API, configuration, dependency, or persistent storage changes are introduced. (src/plugins/plugin-cache-files.ts:61, c16258b0e6c5)
  • Existing lifecycle clears both result slots: Metadata invalidation clears each root's path facts and root aliases. Cache ownership remains scoped or process-owned, so this optimization does not introduce a second cache or a new freshness policy. (src/plugins/plugin-cache.ts:180, c16258b0e6c5)
  • Focused regression coverage: The existing real-filesystem fixture now checks both resolver orders, one native call per cache generation, and renewed resolution after invalidation. Adjacent coverage retains native-error fallback and distinct JavaScript results. Tests were inspected, not executed during this read-only review. (src/plugins/plugin-cache.test.ts:39, c16258b0e6c5)
  • Current main still performs the duplicate lookup: Fetched main still directly calls fs.realpathSync.native inside resolveRealpath without filling the native cache slot. The central optimization therefore remains absent from the inspected main revision; no implemented-on-main or release claim is made. (src/plugins/plugin-cache-files.ts:61, 56173343fe59)
  • Review continuity: The two reviewed files are unchanged from the previous reviewed head. The supplied previous review contained no findings or published rank-up moves; its next-step text described inaccessible logs, not a source defect. (src/plugins/plugin-cache-files.ts:61, c16258b0e6c5)
  • Runtime evidence and inspection limit: The captured PR body reports identical plugin selections and native calls falling from 1,556 to 1,399 during real Linux metadata inspections, while explicitly declining an installed-Windows latency claim. The linked run https://github.com/openclaw/openclaw/actions/runs/35385637959 has an overall cancelled status; that alone neither verifies nor disproves the reported measurements. Downloading its job log was blocked by the review environment's storage-host allowlist.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (1 earlier review cycle)
  • reviewed 2026-09-18T20:11:30.640Z sha 13c729f :: blocked before merge. :: none

@steipete
steipete merged commit 1a52f6c into main Sep 18, 2026
207 checks passed
@steipete
steipete deleted the codex/startup-plugin-native-realpath-b0a1 branch September 18, 2026 21:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 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