Skip to content

fix(runtime): gate dynamic execution in AOT hosts - #182346

Merged
steipete merged 2 commits into
mainfrom
fix/runtime-execution-profiles
Oct 24, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/runtime-execution-profiles

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes opaque VM and plugin-loading failures when an AOT standalone host is asked to execute JavaScript that was not compiled into its image.

User Impact

AOT standalone users get an actionable error directing them to a Node/Bun or JIT/bytecode host, or to rebuild the artifact with the required plugin. Normal Node/Bun and non-AOT standalone behavior stays available. The existing QuickJS executor is not silently substituted, and declarative QA actions and statically declared imports remain usable.

Why This Change Was Made

One runtime-profile owner derives a process-stable decision from the immutable standalone bootstrap facts, with the existing manifest fallback. It consumes the shared build-facts owner added in #182309. Code Mode, plugin loading, QA evaluation, and the SDK use that owner before attempting dynamic host execution. Plugin admission uses compiler-owned image membership rather than a filename, directory, or installation-success heuristic.

This is a compatibility contract, not a security sandbox. It adds no user configuration and does not globally patch evaluators or enable a strict string-codegen flag. Fixed-path validator/parser/codec compatibility and full-artifact qualification remain separate work. Guest/external runtimes retain their own qualification requirements.

Evidence

Owning tests used pnpm test <file> --maxWorkers=1 with Node; wall times include wrapper/startup overhead on a busy host. The table records the initial candidate, before the shared build-facts integration.

Boundary Initial candidate result Wall time
Runtime profile owner 6 passed (also 6 passed with Bun) 82.80s Node / 195.92s Bun
Code Mode profile 3 passed 44.60s
Fetched CJS/TS plugins 2 passed 59.64s
QA profile, declarative actions and static imports 5 passed 62.35s
Existing Code Mode executor 4 passed 49.82s
Existing plugin loader 12 passed 758.15s
Failed plugin acquisition cleanup 1 passed 59.28s
Native SDK aliases and registration 20 passed 384.26s
Standalone metadata and image membership 51 passed 31.13s
CLI invocation 6 passed 36.15s

The new regressions fail against the original owner implementations: retained Node execution completes when it should be unavailable; fetched CJS/TS execute when they should be rejected; QA expressions/lambdas evaluate and unknown imports lack profile guidance. Baseline runs took 55.28s, 46.39s, and 29.93s respectively. Exact candidate bytes were restored afterward.

Small probes compiled with experimental Bun exercise the actual profile owner. The ordinary string-codegen ban still lets a VM control return 42; strict mode instead produces a raw EvalError. The profile gate returns runtime-switch guidance before evaluation. A late plugin import changes from ERR_MODULE_NOT_FOUND to rebuild/runtime guidance. The integrated owner probe compiled six modules in 0.94s under the strict flag; gated runs took 0.02–0.83s. It also proves that immutable AOT bootstrap facts win over a contradictory JIT disk manifest. Fresh Node processes select the expected AOT/JIT/bytecode profile and retain it after manifest edits. Ordinary Bun selects dynamic-execution and returns 42. No interpreter tripwire or whole-application compilation was used.

The final main integration preserves the new source-loader capability declaration and WebAssembly documentation. The range comparison shows context-only changes; the reviewed runtime additions are unchanged. On that head, all four profile boundaries pass (16 tests, 30.74s combined), CLI and metadata pass (62 tests, 12.40s), and focused types, core lint, and formatting pass. Earlier cache-disabled attempts stalled without a verdict; the fresh isolated-cache runs close those local gaps.

Focused source and metadata types, the required tooling type leaf, core/script/metadata lint, formatting, docs links (15,889; zero broken), and glossary validation pass. Codex review is clean through P2.

The initial exact-head CI passed runtime, extension lint, and package-boundary checks. Its two failing tooling shards exposed a missing runtime-profile entry in the extracted PR wrapper inventory; this revision adds that required entry. Both inventory regression assertions now pass locally with an isolated cache (69.62s wall). The local QA package-boundary lint attempt had timed out during SDK declaration preparation, before lint, so the CI result supplies that broader proof. One existing QA test (loads bundled QA runtime modules through qaImport) timed out at its unchanged 120s limit (507.72s wall), with 18 other cases passing. That exact test also times out with the original base implementations (1041.36s wall, including cold compilation and cache verification). It is retained as an investigated baseline failure, not counted as passing.

The scoped tooling repair run passed both inventory assertions and the disabled-acceleration/count cold-provisioning cases. The parameters transport case exceeded its unchanged 120s test limit (475.00s whole invocation). The exact same 120s timeout reproduces on the clean PR base (210.77s wall), where the test and provisioning owner match this PR. It remains a recorded local baseline failure; no timeout or assertion was weakened.

Final exact-head CI run 40080809504, attempt 1, completed all 90 jobs. Runtime, tooling, types, lint, docs, and security checks passed. UI shards 2/9 and 4/9 failed, making the aggregate gate red. The failing cases are active turn recovery > restores the active assistant and tool after navigation (the /usage route does not settle) and offers Undo when an individual archive completes after navigate on the Sessions page (Undo never appears). Both reproduce on a clean worktree at the exact tested main parent d95a32ccfcde1246d4175f6e22e442f4d8f53784: 2 failed / 15 skipped, 138.85s wall. The full UI tree and its package, lockfile, Vitest setup/config, and shared helper inputs are identical in the tested merge. These mocked Gateway browser flows do not execute the changed host-profile paths. The initial classifier marked them new because the scheduled main job passed without scope comparison; this direct baseline reproduction establishes the inherited failures. Landing uses the native pre-existing-failure exception and retains the red CI result; no CI rerun or UI assertion change was requested.

@clawsweeper

clawsweeper Bot commented Oct 24, 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 docs Improvements or additions to documentation scripts Repository scripts agents Agent runtime and tooling extensions: qa-lab plugin: file-transfer labels Oct 24, 2026
@steipete
steipete marked this pull request as ready for review October 24, 2026 07:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T09:11:20.507387Z 4f275a5 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug 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. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR rejects dynamic host execution and non-embedded plugin loading in AOT standalone builds with runtime-switch or rebuild guidance.

Example: An AOT host attempts a Node Code Mode cell containing return 42 under strict string-codegen restrictions.

  • Before: Execution reaches the VM and fails with a raw EvalError.
  • After: Code Mode returns runtime_unavailable with guidance before creating the VM worker.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has no actionable findings and resolves the prior blocker; behavior evidence remains at compiled-owner and focused-test scope.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; its body records compiled probes of the actual profile owner, strict AOT rejection, immutable-fact precedence, and normal Bun execution, with no full-artifact qualification claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: AOT users encounter opaque execution or plugin-loading failures when requesting code outside the compiled image.
Reason: The maintainer-approved direction gives actionable compatibility errors through existing owners without adding configuration or silently changing executors.

Merge readiness

✅ Ready for maintainer review

The prior wrapper-inventory blocker is fixed, and no new actionable correctness or security defect was found; current main still lacks these AOT gates.

Priority: P2
Reviewed head: 4f275a53788c4e0824cc4e9f542bf0ec05e32e50

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not include a full packaged AOT Gateway run through Code Mode and bundled/fetched plugin loading.
Agent review details

How this fits together

Standalone bootstrap facts feed a shared runtime-profile owner, which Code Mode, plugin loaders, QA evaluation, and the Plugin SDK consult before dynamic host execution.

flowchart TD
 A[Standalone build facts] --> B[Runtime profile owner]
 C[Compiler module inventory] --> B
 B --> D[Code Mode executor]
 B --> E[Plugin loading]
 B --> F[QA evaluation and SDK]
 D --> G[Execution or actionable error]
 E --> G
 F --> G
Loading

Technical review

Best possible solution:

Keep capability selection in the shared artifact-backed owner and reject unsupported AOT work at the existing execution boundaries.

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

Current-main source reaches host evaluation and plugin loading without these gates, and the author records baseline failures and compiled AOT probes; this read-only review ran no target code.

Is this the best way to solve the issue?

The change uses one small profile owner and the existing compiler inventory, preserves executor choice, and avoids global evaluator patches or a parallel loading subsystem.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 42da9c996d84.

Provenance checked

  • Node Code Mode execution keeps the original intent (09e0649: Selectable Node and QuickJS executors deliberately preserve the selected engine across resumes and fail explicitly instead of falling back.)
  • Plugin source loading and standalone documentation changes intended behavior with a stated reason (feat: shrink standalone sidecars and bundle SQLite #172802: Standalone packaging retained Jiti and Babel support for installed TypeScript plugins; this PR explicitly limits that behavior to dynamic-execution hosts.)
  • QA expressions, lambdas, and imports changes intended behavior with a stated reason (9bf3482: The markdown-only QA runner evaluates expressions and lambdas through its existing flow owner; the PR explains why AOT must reject those operations while preserving declarative actions and declared imports.)
  • Plugin instance ownership and preparation keeps the original intent (05a2844: Managed plugin instances retain code and lifecycle ownership through work completion; the added compatibility assertions leave those owners and cleanup paths intact.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +72, Tests +227, Docs +130, Other +10. Total +439 across 20 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 7 73 1 +72
Tests 5 227 0 +227
Docs 4 131 1 +130
Config 0 0 0 0
Generated 0 0 0 0
Other 4 10 0 +10
Total 20 441 2 +439

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded compatibility improvement for experimental AOT hosts.
  • merge-risk: 🚨 compatibility: The PR adds public SDK capability exports and intentionally rejects AOT execution paths previously attempted; the maintainer-authored body explicitly accepts that contract.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-24T07:25:47.880Z sha 4fa3cb4aa3b8450ffcda86ef4e761e73156c7a00 :: needs changes before merge. :: [P1] Add the runtime-profile module to the trusted wrapper inventory

Reviewed October 24, 2026, 5:20 AM ET / 09:20 UTC (Revision 2).

@steipete
steipete force-pushed the fix/runtime-execution-profiles branch from 4fa3cb4 to 450ed39 Compare October 24, 2026 08:31
Select execution capabilities from standalone build facts and reject unsupported host evaluation or non-embedded plugin modules with actionable guidance. Preserve dynamic Node/Bun hosts and expose the same policy through the plugin SDK.
@steipete
steipete force-pushed the fix/runtime-execution-profiles branch from 450ed39 to 4f275a5 Compare October 24, 2026 09:08
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The runtime profile now consumes immutable build facts, and its module is included in the trusted wrapper inventory. Current profile/CLI tests and strict AOT probes pass. The separate cold-provisioning timeout reproduces on the PR base; evidence is in the PR body.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 24, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Oct 24, 2026
@steipete
steipete merged commit 34bdb7d into main Oct 24, 2026
189 of 194 checks passed
@steipete
steipete deleted the fix/runtime-execution-profiles branch October 24, 2026 09:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
* fix(runtime): gate dynamic execution in AOT hosts

Select execution capabilities from standalone build facts and reject unsupported host evaluation or non-embedded plugin modules with actionable guidance. Preserve dynamic Node/Bun hosts and expose the same policy through the plugin SDK.

* fix(runtime): use immutable standalone profile facts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: qa-lab merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M 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