Skip to content

fix: prevent plugin dependencies from slowing unrelated imports - #146486

Merged
steipete merged 2 commits into
mainfrom
codex/swarm-plugin-imports
Sep 12, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/swarm-plugin-imports

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

TLS prerequisite: #146412 (landed on main).

Related: #130741

What Problem This Solves

Loading unrelated modules does more work as active plugins accumulate captured dependencies.

User Impact

Plugin-heavy Gateways avoid repeated ownership scans during unrelated imports. Plugin selection, lazy loading, reload behavior, and captured source integrity remain unchanged; no configuration or migration is required.

Why This Change Was Made

Every captured package root and dependency link belongs to one artifact directory. Checking that directory first lets unrelated imports return before walking the captured packages.

Evidence

  • The regression fails on the base: 24 dependencies increase ownership comparisons from 1 to 49. It passes with this change.
  • Five focused artifact, package ownership, native loading, and interop test files: 214 passed, one existing Bun-only skip.
  • Normal pnpm build, changed-file formatting, and targeted lint passed.
  • The built OpenAI plugin entrypoint profile passed: 118.94 MiB peak RSS, 75.39 MiB above the fresh-process baseline.
  • Independent isolated review: scoped-clean at P1, no findings.
  • The full canonical changed gate passed on the published head, including types, lint, dead-export scans, and runtime guards.

End-to-end Swarm responsiveness proof remains with #130741; this slice makes no new 500 ms latency claim.

@clawsweeper

clawsweeper Bot commented Sep 12, 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 gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 21:28
@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 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:53 PM ET / 21:53 UTC (Revision 2).

ClawSweeper review

What this changes

The branch avoids scanning captured plugin dependencies for unrelated imports, adds a scaling regression test, and corrects TLS renewal shutdown registration.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful on current main, and review found no actionable patch defect. The merged TLS prerequisite does not supersede the plugin fix; this maintainer-protected PR should remain open for normal landing.

Priority: P2
Reviewed head: 7518a717af15ce700fc8a9712913447feb2d1b3c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with a meaningful scaling regression, reported targeted validation, and no actionable review findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository context identifies a maintainer-authored PR, so the external-contributor proof gate does not apply. The artifact regression and reported entrypoint profile support this narrow optimization; broader Swarm media does not establish import latency.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository context identifies a maintainer-authored PR, so the external-contributor proof gate does not apply. The artifact regression and reported entrypoint profile support this narrow optimization; broader Swarm media does not establish import latency.
Evidence reviewed 8 items Current-main necessity: Fetched main still calls the captured-package scan without the artifact-directory guard. The latest release tag does not contain this artifact module, so neither inspected surface establishes that the requested optimization has shipped.
Artifact containment preserves ownership: The complete artifact owner constructs captured roots and dependency links beneath its private directory. The added guard retains the existing lookup for those paths; source capture, admission, integrity checks, and disposal remain unchanged.
Production trigger and documented boundary: The module resolver calls prepareModule for resolved file imports, making unrelated imports encounter the package scan. Architecture documentation explicitly preserves native loading outside captured instances. This is OpenClaw's module-loading implementation; the change makes no Codex harness or protocol compatibility claim.
Findings None None.
Security None None.

How this fits together

OpenClaw captures plugin source and dependencies into an instance-owned directory before loading them. Module resolver hooks consult that artifact to prepare captured modules while leaving unrelated imports alone.

flowchart TD
  A[Module import] --> B[Plugin resolver hook]
  B --> C{Inside artifact directory?}
  C -->|No| D[Continue unrelated import]
  C -->|Yes| E[Find captured package]
  E --> F[Prepare captured module]
  F --> G[Native module loading]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +50. Total +53 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 5 2 +3
Tests 1 50 0 +50
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 55 2 +53

Review metrics

None.

Technical review

Best possible solution:

Keep unrelated imports independent of captured dependency count while preserving the existing package lookup, lazy loading, and source-integrity lifecycle.

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

Yes, source establishes that unrelated resolved imports scan every captured package and dependency link on current main; the supplied regression targets that growth. No runtime tests were executed in this read-only review.

Is this the best way to solve the issue?

Yes. The existing artifact boundary provides a narrow early return without adding a cache, competing owner, configuration option, or changed loading contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded performance repair for plugin-heavy Gateways, with no demonstrated urgent outage.
  • 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 repository context identifies a maintainer-authored PR, so the external-contributor proof gate does not apply. The artifact regression and reported entrypoint profile support this narrow optimization; broader Swarm media does not establish import latency.

Evidence

What I checked:

  • Current-main necessity: Fetched main still calls the captured-package scan without the artifact-directory guard. The latest release tag does not contain this artifact module, so neither inspected surface establishes that the requested optimization has shipped. (src/plugins/plugin-generation-artifact.ts:588, 5270db64d8d0)
  • Artifact containment preserves ownership: The complete artifact owner constructs captured roots and dependency links beneath its private directory. The added guard retains the existing lookup for those paths; source capture, admission, integrity checks, and disposal remain unchanged. (src/plugins/plugin-generation-artifact.ts:590, 7518a717af15)
  • Production trigger and documented boundary: The module resolver calls prepareModule for resolved file imports, making unrelated imports encounter the package scan. Architecture documentation explicitly preserves native loading outside captured instances. This is OpenClaw's module-loading implementation; the change makes no Codex harness or protocol compatibility claim. (src/plugins/plugin-module-loader-cache.ts:589, 7518a717af15)
  • Containment dependency verified: The introduced guard uses isPathInside through OpenClaw's path facade. The lockfile pins fs-safe 0.8.5; its inspected implementation normalizes paths and handles Windows case and extended prefixes. Repository ownership was verified through GitHub, and the version tag resolves to this commit. (src/path.ts:60, eb2294eeb6af)
  • Verified merge scope: Raw test-merge parents match the pinned base followed by the exact PR head. Comparing that merge against its base leaves only the plugin guard and regression test. The TLS correction is already supplied by merged fix(gateway): register TLS renewal with sidecar owner #146412. (src/gateway/server-startup-finish.ts:416, 07b9f3a31c83)
  • Regression and supplied validation: The regression compares unrelated-module preparation with zero and 24 dependencies, enforcing bounded comparison growth and unchanged foreign source. The captured PR body reports a base failure, 214 passing focused tests, build, entrypoint profiling, and the changed gate. These were not rerun during this read-only review; git diff --check passed. (src/plugins/plugin-generation-artifact.ownership.test.ts:16, 7518a717af15)

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 (1 earlier review cycle)
  • reviewed 2026-09-12T21:35:56.784Z sha 7518a71 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 8465e1f into main Sep 12, 2026
259 checks passed
@steipete
steipete deleted the codex/swarm-plugin-imports branch September 12, 2026 22:04
@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 13, 2026
…claw#146486)

* fix(gateway): stop TLS renewal through the shutdown owner

* fix: prevent plugin dependencies from slowing unrelated imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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