Skip to content

test(plugins): drop duplicate SDK-alias loader case that timed out under load - #125134

Merged
steipete merged 1 commit into
mainfrom
steipete/musing-torvalds-4c6e25
Aug 17, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/musing-torvalds-4c6e25

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where developers running the plugin test suite hit spurious
failures from src/plugins/loader.native-module-loader.test.ts. Its
loads the released pre-managed llama.cpp provider import through the SDK alias
case took ~54s on its own and blew through the 120s per-test timeout whenever the
machine was under CPU contention, then passed on an immediate standalone rerun.
It was observed as the sole failure of a 1171-file / 18320-test run while landing
#125037.

The cost was structural, not incidental. In a source checkout there is no
dist/, so the fixture's openclaw/plugin-sdk/memory-core-host-engine-embeddings
import resolves to TypeScript source. The loader's fallback path deliberately
drops openclaw from jiti's nativeModules
(src/plugins/plugin-module-loader-cache.ts:200), so jiti transformed and
evaluated the full core graph reachable from that subpath — roughly 3,000 modules
per run — just to prove an alias resolves.

Why This Change Was Made

The expensive case proved nothing that was not already proven elsewhere, so it is
deleted rather than given a bigger timeout (raising timeouts to hide a slow test
is explicitly a masking pattern under the Repair Doctrine).

Its two invariants are each already owned somewhere cheaper:

  • Released-shape ESM plugin resolves openclaw/plugin-sdk/* through the loader
    alias
    — covered by the sibling
    loads published pre-split SDK bridge imports case in the same file. That
    fixture spans both alias visibility classes on purpose: runtime-doctor is
    private-local-only (same class as the deleted subpath) and channel-feedback /
    channel-outbound are public, so removing the llama.cpp case loses no alias
    class.
  • memory-core-host-engine-embeddings still exports
    createLocalEmbeddingProvider, and it rejects with upgrade guidance instead of
    reviving the retired runtime
    — covered by
    extensions/llama-cpp/index.test.ts, added in the same PR (fix(plugin-sdk): installed llama providers fail to load after upgrade #124041) that
    introduced the deleted case.

An inline comment now records why the surviving fixture's subpath list is what it
is, so the trap does not come back the next time someone extends it.

User Impact

Developer-facing only; no runtime or product behavior changes. The test file
drops from ~67s to ~30s, and the flakiest test in the plugins lane is gone. No
coverage is lost.

Evidence

Per-test timings before, on this machine (--reporter=verbose):

✓ loads bundled JavaScript without creating a module loader                1381ms
✓ loads packaged JavaScript without creating a module loader                131ms
✓ loads the released pre-managed llama.cpp provider import ...            54214ms
✓ loads published pre-split SDK bridge imports ...                        10904ms
  Duration 66.96s

After:

✓ loads bundled JavaScript without creating a module loader                1432ms
✓ loads packaged JavaScript without creating a module loader                129ms
✓ loads published pre-split SDK bridge imports ...                        28571ms
  Duration 30.47s

The surviving bridge case absorbs the cold jiti/core-graph warm-up the deleted
case used to pay first, which is why it rises from 10.9s to 28.6s while the file
total still drops by more than half.

Commands run:

  • node scripts/run-vitest.mjs src/plugins/loader.native-module-loader.test.ts — 3 passed
  • node scripts/run-vitest.mjs src/plugins — 1171 files / 18320 tests, same result before and after
  • autoreview --mode uncommitted (codex, gpt-5.6-sol) — clean, no accepted findings

Production LOC delta: 0. Test LOC delta: +3 / -73.

Known follow-up, not introduced here: the broad run-vitest src/plugins run
produces a small, non-deterministic set of failures under CPU contention that all
pass in isolation — provider-auth-choices.test.ts in one run;
contracts/tts.contract.test.ts, web-search-providers.runtime.test.ts, and
status-effective-plugin-discovery.test.ts in another. Verified pre-existing
(present on the unmodified tree, absent when the files are run on their own) and
unrelated to this diff; main CI is green.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 17, 2026 06:58
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Pre-empting the obvious objection to deleting this case: "that was the only
installed-plugin/jiti regression proof for the released llama.cpp import."

It was not. The loader has no per-subpath logic for openclaw/plugin-sdk/*,
so a test pinned to one specific subpath proves nothing a test pinned to any
other subpath does not. buildPluginLoaderAliasMap
(src/plugins/sdk-alias.ts:1454) derives the whole SDK alias set generically
from package.json exports["./plugin-sdk/*"] via
listPluginSdkSubpathsFromPackageJson (src/plugins/sdk-alias.ts:167), and
plugin-sdk-native-resolver.ts registers whatever that map contains.

The invariant is therefore covered as a chain, with an owner for each link:

Link Owner
./plugin-sdk/memory-core-host-engine-embeddings stays in package.json exports src/plugins/contracts/plugin-sdk-subpaths.test.ts:489 asserts it against plugin-sdk-entrypoints.json + plugin-sdk-private-local-only-subpaths.json; pnpm plugin-sdk:surface:check gates it
Alias map picks up every exported subpath generic derivation, no per-subpath branch
An installed released-shape ESM plugin resolves and loads openclaw/plugin-sdk/* through that alias under jiti the surviving loads published pre-split SDK bridge imports case in this same file
createLocalEmbeddingProvider still exists and rejects with upgrade guidance instead of reviving the retired runtime extensions/llama-cpp/index.test.ts, added by the same PR (#124041) that added the deleted case

The surviving loader case deliberately spans both alias visibility classes:
runtime-doctor is private-local-only — the same class as the deleted
memory-core-host-engine-embeddings — while channel-feedback and
channel-outbound are public. So no alias class lost coverage.

What the deleted case uniquely contributed was cost, not proof: it picked the
single heaviest subpath in the SDK, and in a source checkout (no dist/) that
alias lands on TypeScript source. The loader's fallback path intentionally drops
openclaw from jiti's nativeModules
(src/plugins/plugin-module-loader-cache.ts:200), so jiti evaluated roughly
3,000 core modules per run — 54s — to re-prove a subpath-agnostic mechanism.
That is what crossed the 120s per-test timeout under CPU contention.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 17, 2026, 4:00 AM ET / 08:00 UTC.

ClawSweeper review

What this changes

The PR deletes a slow installed-plugin SDK-alias test and adds comments explaining that the retained fixture covers public and private SDK alias classes.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the retained fixture proves generic alias registration, but this PR removes the only test that evaluates the retired llama.cpp bridge through the installed-plugin loader and Jiti fallback path.

Priority: P2
Reviewed head: fe9532ecbf95efa2accd2df103672007ddc73942
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The cleanup is well-scoped, but it currently removes a unique loader-boundary compatibility regression.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned internal test-coverage change has no user-visible behavior requiring contributor real-behavior proof.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned internal test-coverage change has no user-visible behavior requiring contributor real-behavior proof.
Evidence reviewed 5 items Distinct loader-boundary contract: The deleted test loaded a released-shape ESM plugin importing the legacy embedding bridge; the retained fixture instead imports runtime-doctor and channel helpers.
Generic mapping is covered, evaluation is not: The alias map iterates every selected SDK subpath, but the legacy embedding bridge has its own broad re-export graph that the retained lightweight imports do not evaluate.
Real loader path: The production loader builds the alias map and the runtime candidate evaluates the plugin module; the fallback deliberately transforms OpenClaw SDK dependencies through Jiti.
Findings 1 actionable finding [P2] Retain loader coverage for the legacy llama bridge
Security None None.

How this fits together

Installed plugins import OpenClaw SDK subpaths through the plugin loader, which maps those imports to the local SDK and evaluates the plugin module. The changed test protects that upgrade-time loader boundary for previously published plugin packages.

flowchart LR
  A[Installed legacy plugin] --> B[Plugin discovery]
  B --> C[Plugin module loader]
  C --> D[SDK alias map]
  D --> E[Jiti source fallback]
  E --> F[Legacy embedding bridge]
  F --> G[Plugin registration]
Loading

Decision needed

Question Recommendation
May this PR remove the only installed-plugin/Jiti evaluation of the legacy llama.cpp embedding bridge, or should that exact loader-boundary contract remain protected? Retain or replace the bridge proof: Keep the existing test until a cheaper focused test exercises the same released plugin import through the loader.

Why: The desired test-runtime reduction conflicts with a shipped upgrade compatibility contract; generic alias and direct-export tests do not establish equivalent module-graph evaluation.

Before merge

  • Retain loader coverage for the legacy llama bridge (P2) - The retained fixture proves the generic alias map, but it never evaluates memory-core-host-engine-embeddings through the installed-plugin/Jiti fallback. The direct llama.cpp test calls that export under Vitest, so it cannot catch loader-time failures in this bridge's distinct re-export graph. Keep this regression or replace it with a cheaper test at the same loader boundary.
  • Resolve merge risk (P1) - The branch is behind current main and its provided check snapshot still has two in-progress jobs; landing needs a refreshed clean merge result and exact-head validation after preserving the loader-boundary contract.
  • Complete next step (P2) - A maintainer must resolve the coverage-versus-runtime tradeoff because the proposed deletion removes the direct proof for a shipped upgrade path.

Findings

  • [P2] Retain loader coverage for the legacy llama bridge — src/plugins/loader.native-module-loader.test.ts:116-118
Agent review details

Security

None.

PR surface

Tests -70. Total -70 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 3 73 -70
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 3 73 -70

Review metrics

Metric Value Why it matters
Production versus test delta production 0; tests +3 / -73 The net-negative diff is test-only, but it removes a compatibility regression rather than redundant setup alone.

Stored data model

Persistent data-model change detected: serialized state: src/plugins/loader.native-module-loader.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve the legacy bridge regression (recommended)
    Retain the installed-plugin test or replace it with a cheaper test that still loads memory-core-host-engine-embeddings through the production loader.
  2. Pause the cleanup
    Defer this deletion until the compatibility owner agrees that another proof fully replaces the legacy loader contract.

Technical review

Best possible solution:

Keep a focused installed-plugin loader regression for memory-core-host-engine-embeddings, or replace it with a cheaper proof that still evaluates that exact legacy bridge through the real loader.

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

Yes, from source: the proposed deletion removes the only fixture that loads the legacy embedding bridge through the installed-plugin loader; the retained and direct tests exercise different boundaries.

Is this the best way to solve the issue?

No: removing the test is not the best solution until a cheaper replacement evaluates the same legacy bridge through the real loader rather than only its generic alias class or direct export.

Full review comments:

  • [P2] Retain loader coverage for the legacy llama bridge — src/plugins/loader.native-module-loader.test.ts:116-118
    The retained fixture proves the generic alias map, but it never evaluates memory-core-host-engine-embeddings through the installed-plugin/Jiti fallback. The direct llama.cpp test calls that export under Vitest, so it cannot catch loader-time failures in this bridge's distinct re-export graph. Keep this regression or replace it with a cheaper test at the same loader boundary.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The patch removes regression coverage for an existing installed-provider upgrade contract, with limited immediate blast radius.
  • add merge-risk: 🚨 other: Merging would leave the legacy embedding bridge's installed-plugin loader path without its only direct regression proof.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-owned internal test-coverage change has no user-visible behavior requiring contributor real-behavior proof.

Label justifications:

  • P2: The patch removes regression coverage for an existing installed-provider upgrade contract, with limited immediate blast radius.
  • merge-risk: 🚨 other: Merging would leave the legacy embedding bridge's installed-plugin loader path without its only direct regression proof.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-owned internal test-coverage change has no user-visible behavior requiring contributor real-behavior proof.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame attributes both the removed and retained loader fixtures to this contributor in commit 3d1185f. (role: introduced current loader-test coverage and recent area contributor; confidence: high; commits: 3d1185f1373c, fe9532ecbf95; files: src/plugins/loader.native-module-loader.test.ts)
  • fuller-stack-dev: The merged compatibility change linked in the PR context introduced the legacy load-only bridge whose installed-plugin contract this test covers. (role: related compatibility-change author; confidence: medium; commits: a02ed2cfda80; files: extensions/llama-cpp/index.test.ts, src/plugin-sdk/memory-core-host-engine-embeddings.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Retain or replace the installed-plugin/Jiti test for memory-core-host-engine-embeddings.
  • Refresh the merge result and complete exact-head checks after the coverage fix.

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-08-17T07:46:15.030Z sha 0f7d319d761aca8890d4b8d5e148e04a1e9b32d0 :: needs maintainer review before merge. :: none

…der load

The deleted case took ~54s and exceeded the 120s per-test timeout under CPU contention. Its coverage is already provided by the sibling pre-split SDK bridge case, which spans both private-local-only and public alias classes, and by extensions/llama-cpp/index.test.ts.
@steipete
steipete force-pushed the steipete/musing-torvalds-4c6e25 branch from 0f7d319 to fe9532e Compare August 17, 2026 07:54
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@steipete
steipete merged commit 8e44c90 into main Aug 17, 2026
113 checks passed
@steipete
steipete deleted the steipete/musing-torvalds-4c6e25 branch August 17, 2026 08:03
@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 18, 2026
…der load (openclaw#125134)

The deleted case took ~54s and exceeded the 120s per-test timeout under CPU contention. Its coverage is already provided by the sibling pre-split SDK bridge case, which spans both private-local-only and public alias classes, and by extensions/llama-cpp/index.test.ts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant