Skip to content

fix(standalone): load fetched plugins in typed AOT builds - #183756

Merged
steipete merged 1 commit into
mainfrom
steipete/aot-ts-native-resolution
Oct 25, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/aot-ts-native-resolution

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes fetched plugins failing to load in original-TypeScript AOT standalone builds with Cannot find package 'acorn', even when plugin installation and dependency checks succeed.

User Impact

Typed AOT builds preserve the same lazy package loading as emitted-JavaScript builds after the runtime's package-manager tree is removed. This repairs the packaging prerequisite for fetched plugin setup and loading; rebuilt signed-artifact qualification remains pending.

Why This Change Was Made

Original-source build contexts contain anonymous module-type scopes that share the runtime package. Native resolution stopped at those scopes and skipped the existing static package-resolution transform. Continue to the enclosing owner for anonymous scopes while preserving named package boundaries and platform filtering. The regression uses an actual typed source context and checks conditional exports, lazy evaluation, pruning, and relocation.

Evidence

  • Before the fix: the emitted case passed, while the typed case failed with ERR_MODULE_NOT_FOUND on its first lazy package load after pruning and relocation.
  • After the fix: all 118 tests across native routing, conditional resolution, source graphs, import rewriting, and source parsing passed. The affected conditional-resolution file ran in 41 ms; the complete focused command took 3.76 s. CI timings pending.
  • Targeted tooling and scripts typechecks, file-scoped lint, formatting, and independent review passed.
  • No full AOT rebuild was run for this patch before publication; the production-readiness lane owns the next signed artifact build and fetched-plugin replay.

Let anonymous module scopes inherit their enclosing native runtime owner so original-TypeScript AOT preserves lazy conditional package resolution after pruning. Keep named package boundaries and platform filtering intact.
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 25, 2026 18:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T18:03:03.936576Z fd090ae Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Oct 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd090ae381

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +364 to +368
if (manifest.name) {
found = register(directory, manifest);
break;
}
// Anonymous module scopes, including typed contexts, share their enclosing owner.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve anonymous scopes when determining module format

For a dependency with a named "type":"module" root and an anonymous cjs/package.json containing {"type":"commonjs"}, skipping the anonymous scope now makes ownerOf(cjs/index.js) return the ESM owner. Consequently, collectRuntimeReferences() passes "module" to isCommonJsEntry() and omits this opaque require target from commonJsEntries. The standalone require adapter then skips its loaded.default ?? loaded unwrapping, so callers receive a module namespace instead of the CommonJS export (breaking callable exports, for example). Previously the undefined owner caused this .js target to be classified as CommonJS. Share package ownership across anonymous scopes, but retain their effective module type for entry classification.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit d465bda into main Oct 25, 2026
174 of 176 checks passed
@steipete
steipete deleted the steipete/aot-ts-native-resolution branch October 25, 2026 18:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…83756)

Let anonymous module scopes inherit their enclosing native runtime owner so original-TypeScript AOT preserves lazy conditional package resolution after pruning. Keep named package boundaries and platform filtering intact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant