Skip to content

fix: retain minified lazy parser targets in standalone builds - #198639

Merged
steipete merged 2 commits into
mainfrom
fix/standalone-lazy-parser-resolution
Nov 14, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/standalone-lazy-parser-resolution

Conversation

@steipete

@steipete steipete commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Standalone plugin preparation fails to load its embedded Acorn parser when the minifier spells static strings as constant templates. The native dependency resolver recognizes only quoted literals, so the lazy module lookup falls through to a removed node_modules tree. Fetched Teams and TypeScript plugins report a missing Acorn package.

User Impact

Retain the existing lazy ESM parser dependency in standalone executables without requiring the original source package. Package-map helpers stay lazy, and plugin contracts and parser identity stay unchanged.

Why This Change Was Made

Teach the existing native module-resolution owner to read constant template specifiers and export conditions alongside quoted strings. This preserves the private parser loader instead of changing its module format or adding a runtime fallback. The earlier CJS-loader proposal in this PR was disproved by a signed artifact and has been replaced.

Evidence

  • The regression runs the real source through dependency discovery, native transformation and image-loader rewriting, removes node_modules, then scans a plugin import. Before the fix, the literal control passes and the minified-template case fails with the real missing-package error; both pass afterward. Distinct ESM/CJS export targets guard parser identity.
  • 35 focused native/parser and source-inspection tests pass. Tooling test typecheck, scoped lint, formatting and diff checks pass. The normal candidate build passes.
  • Codex autoreview of the complete candidate from base e883a78ec5f3563cb755da1a460f815f3bfabb1d to the staged patch committed as 8c4111ac68ebe79eb5eebe7b95a220886787ae04 is P2 scoped-clean, with no accepted findings.
  • A byte-matched qualification copy passes signed AOT core smoke, Teams install/load, CJS/ESM/published/local TypeScript, all 34 late API checks, SDK identity, npm child/re-entry, PDF Worker and real Codex activation/turn. The existing query-resolution limitation remains visible as the sole failed wrapper gate; it is not presented as a full compatibility pass.
  • Exact-head CI and Darwin tooling are green. No admin exception.
  • Stock-main AOT separately fails in compiler Lower on the full graph. No compiler workaround, production pin or default-AOT change is included.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR loads Acorn lazily through the runtime loader instead of first resolving its physical package metadata.

Example: A standalone executable prepares /plugin/index.mjs containing import './dependency.mjs' after its original node_modules tree is removed.

  • Before: Source preparation fails with Cannot find package 'acorn'.
  • After: The runtime loader supplies the embedded parser and discovers ./dependency.mjs.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation is source-consistent and has a meaningful regression, but the required shipped-entry-point proof is not yet supplied.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Standalone users cannot prepare affected fetched or local plugins because source inspection cannot find the embedded Acorn package.
Reason: The maintainer-authored direction restores documented standalone plugin loading with a smaller production path and preserves lazy initialization.

Regression provenance

Regression provenance — verified: source commit a1fd3d77ea86 by RoboClaw; canonical PR #182613 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a source-visible standalone plugin-loading failure still present on current main; no introduced correctness defect was found.

Priority: P2
Reviewed head: 1932efc716aac9422252a567e4fba6a406564b04

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted terminal output or logs from the rebuilt standalone executable successfully preparing an affected plugin with its original package tree absent, removing IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

Plugin source preparation inspects JavaScript and transformed TypeScript to discover module and asset references; standalone packaging supplies embedded dependencies through its existing loader adapters.

flowchart TD
  A[Plugin preparation] --> B[Source reference inspection]
  B --> C[Lazy Acorn acquisition]
  C --> D[Runtime require loader]
  D --> E[Embedded Acorn parser]
  E --> F[Module and asset references]
Loading

Technical review

Best possible solution:

Keep the existing lazy parser owner and let the established runtime loader resolve its literal Acorn dependency.

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

The physical Acorn lookup on current main precedes the embedded loader, and the supplied regression removes that package tree before invoking source inspection; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete production repair: remove the filesystem prerequisite, preserve lazy acquisition, and reuse the established standalone loader without changing plugin contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 41d0dec31bfc.

Provenance checked

  • Lazy Acorn acquisition and module selection changes intended behavior with a stated reason (a1fd3d7: Avoid loading Acorn for package captures that never inspect source, while sharing the ESM parser instance with native imports.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source -2, Tests +108. Total +106 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 2 4 -2
Tests 1 108 0 +108
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 110 4 +106

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression code Production +2/-4 lines; tests +108 lines The production repair removes a redundant prerequisite; the test growth exercises the distinct embedded-loader boundary using existing adapters.

Labels

Label changes:

  • add P2: Standalone plugin source preparation can fail, but the demonstrated scope is an opt-in packaging/runtime path rather than a general core-runtime outage.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Standalone plugin source preparation can fail, but the demonstrated scope is an opt-in packaging/runtime path rather than a general core-runtime outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Complete the standalone artifact replay described in the proof assessment.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 13, 2026, 11:25 PM ET / November 14, 2026, 04:25 UTC.

@steipete
steipete marked this pull request as ready for review November 14, 2026 04:30
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T04:44:06.504417Z 8c4111a New commits
ℹ️ 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.

Preserve constant-template package specifiers and export conditions at the standalone native adapter. Keep the existing lazy ESM parser identity and exercise discovery, transformation, and loading after source removal.
@steipete steipete changed the title fix: resolve lazy plugin parser through the runtime loader fix: retain minified lazy parser targets in standalone builds Nov 14, 2026
@steipete
steipete merged commit bdfd1c0 into main Nov 14, 2026
124 of 126 checks passed
@steipete
steipete deleted the fix/standalone-lazy-parser-resolution branch November 14, 2026 05: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 Nov 15, 2026
…aw#198639)

* fix: resolve lazy plugin parser through the runtime loader

* fix: resolve minified native module targets

Preserve constant-template package specifiers and export conditions at the standalone native adapter. Keep the existing lazy ESM parser identity and exercise discovery, transformation, and loading after source removal.
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
)

* fix(build): isolate standalone native export resolution

Capture package exports in a fresh instance of the build runtime so earlier bundling cannot exhaust the resolver state used to build the native lookup table. Verify ambiguous missing entries independently and fail before publishing an incomplete artifact.

* test: reconcile standalone regression allocation with CI base

* test: share standalone native fixture setup

(cherry picked from commit 00a9c52)

Release adaptation: Exact fresh-process resolver/finalizer and unnamed-owner filtering; kept existing standalone test fixtures rather than importing broad refactor. Later parser-target fix bdfd1c0 and fixture cleanups independent/out of scope. No compiler/dependency/version changes.

Follow-up dispositions: d44f263 fix(test): retain standalone fixtures after cleanup failure (openclaw#202227); 1aced63 fix(test): retain standalone resolver fixtures after cleanup failure (openclaw#201662); bdfd1c0 fix: retain minified lazy parser targets in standalone builds (openclaw#198639); 5f99927 fix: restore desktop standalone packaging on current build output (openclaw#198567)

Validation: Baseline resolver regressions 2/2 failed with actual missing alias and swallowed error; candidate resolver+existing native tests 30/30 passed under pinned test runtime; node --check and diff --check passed. Full large standalone distribution build not run.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit b305470dfd611795999ecbee9d5d14c172e58484)
(cherry picked from commit 63a60fa78bba92bec04a43a1686b78d896a6d887)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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