Skip to content

fix(core): exclude native AE loading from the workerd SDK #91

Closed

Description

@trmosala

Problem and impact

The shared internal-plugin graph statically imports the native CM AE loader even when desktop activation is disabled. The packed workerd SDK therefore includes native-only code. The existing hosted SDK gate first rejects Bun.Glob in skill discovery. Replacing that glob alone clears the bundle guards but then the unchanged Miniflare health boot fails with ERR_MODULE_DYNAMIC_SPEC, because the native loader contains a variable import(url).

This is a verified SDK portability failure and CI blocker on V2 descendant 98b57d5349e7ce36805df08013f839d6a9b62320.

Reproduction and evidence

Run bun run verify:package from packages/sdk with locked dependencies installed. The hosted Linux job passes its full serial unit suite, then rejects the packed bundle at script/verify-package.ts:223 with Packed workerd bundle references Bun globals: Bun.Glob.

Skill discovery uses Bun.Glob. The common internal-plugin module imports the native AE plugin unconditionally, and the native loader dynamically imports a filesystem URL.

An independent local glob-only candidate passed Bun/Node imports, the unchanged bundle guards, and Wrangler dry-run, but failed the real worker health boot with ERR_MODULE_DYNAMIC_SPEC. The final candidate adds an existing-style workerd/default package-import boundary and reuses the portable Glob helper. Its full local packed SDK gate passes through the actual Miniflare health boot. Review and canonical lint/type-check verification are still required before integration.

Acceptance criteria

  • Exclude the native AE bundle loader from workerd registration and its import graph.
  • Retain native desktop AE plugin registration in Bun/Node.
  • Use the existing portable glob helper for shared skill discovery while preserving absolute file-only results and symlink traversal.
  • Preserve reviewed skill writes, backups, receipt rejection and unsafe storage-root checks.
  • Pass the unchanged full packed SDK gate, including Bun/Node imports, bundle guards and the workerd health boot.
  • Pass focused platform/skill tests and the canonical root lint/type-check gate.

Verification

Run bun test test/cm-ae-platform.test.ts test/cm-ae-skills.test.ts from packages/core, bun run verify:package from packages/sdk, and bun run check from the root. Keep all existing assertions. No public Protocol or HttpApi change is required.

Related CI repair #87.

Activity

  1. changed the title [-]fix(core): keep AE skill discovery portable in the packed SDK[/-] [+]fix(core): exclude native AE loading from the workerd SDK[/+] on Oct 20, 2026
  2. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    Candidate PR #92, commit 28eaf96c19f8291fb4dd51fffb1437e345e7e362, now passes:

    • Four actual platform/skill tests with 13 expectations.
    • The unchanged full packed SDK verifier, including Bun/Node consumers, bundle guards, Wrangler dry-run and a real Miniflare worker health boot.
    • Separate serial type-check verification, all 37 tasks.
    • Canonical root bun run check and the normal push hook, lint zero errors and all 37 type-check tasks.

    The workerd/default boundary removes the native AE loader from worker registration. Bun/Node retain the desktop plugin; shared skill scanning reuses the existing portable glob helper.

    Independent CM review and hosted Linux/Windows verification remain pending. The issue stays open until reviewed integration is verified. The installed desktop has not been updated.

  3. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    Hosted Linux now passes the entire unit job on exact SDK commit 28eaf96c19f8291fb4dd51fffb1437e345e7e362, including the unchanged packed SDK gate: job 118550926085. This independently confirms the local Bun/Node, bundle-guard and worker-runtime verification.

    The Windows unit job again fails only the loading fixture at cm-loading.test.ts:74, tracked in #90, and skips SDK verification after that failure. The issue remains open until the reviewed combined V2 changes pass the required matrix and are integrated.

  4. trmosala commented on Oct 21, 2026

    @trmosala
    OwnerAuthor

    Merged into CM-Split-v2 as 290d7d6353c0c7a4a356af780b5687f2dcfe5cfc through PR #96. Its tree exactly matches reviewed source 68ab9205709350385471eb2d383b3cff3c18e678.

    Implemented in PR #96, reviewed source 68ab9205709350385471eb2d383b3cff3c18e678.

    Shared AE skill discovery uses the existing portable glob helper, and workerd resolves a separate registration module that excludes the native loader. Bun/Node retain native registration. Platform/skill tests and the unchanged packed SDK gate cover imports, bundle guards and actual workerd health boot.

    Final verification is deferred at the user's explicit request to finish and close the implementation issues before one final test pass. This closure records implementation completion, not a claim that the final combined/platform checks have passed. Any failure in that pass will be recorded against the relevant issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions