Skip to content

fix(aot): resolve extensionless plugin aliases and hardened GNU checks - #208

Closed
steipete wants to merge 21 commits into
openclaw/aot-typed-3from
openclaw/aot-rd-P6
Closed

steipete wants to merge 21 commits into
openclaw/aot-typed-3from
openclaw/aot-rd-P6

Conversation

@steipete

@steipete steipete commented Oct 25, 2026 •

Copy link
Copy Markdown

Linux AOT qualification exposed two independent failures in the fork's runtime and build checker.

Runtime aliases such as openclaw/plugin-sdk/channel-core never reached Bun.plugin's onResolve callback: resolution reused an onLoad prefilter that accepts only names with an extension or namespace. Split namespace parsing from load eligibility so extensionless package names and subpaths reach resolution hooks. Preserve the existing load filter, namespace boundaries and compiled-entry restrictions.

Hardened GNU builds can fail the release post-link check with __memcpy_chk (required import) even with _FORTIFY_SOURCE=2: bounds-proven copies can inline without an out-of-line reference. Remove only that required import while retaining exact __stack_chk_fail and __snprintf_chk checks, hardening flags, ELF checks and the symbol-version ceiling.

The branch integrates b838e73072227c2652a41c689299284f1965cdc6 by an ordinary merge to preserve the retained run external-script behavior. It adds runtime alias controls and an AOT external-module regression, without a source-transform fallback or weaker string-code-generation policy.

Validation:

  • The alias regression reproduced on native Linux arm64 before the fix. The unchanged native compiler failed the original fortified-copy checker and passed the corrected checker; all 13 focused hardening tests passed.
  • Native arm64 standard and physical ShadowRealm-off compilers at Bun 150c9620c53710060186b8b0cd50985e035408b0 / WebKit aaa690bfbf34c9d50775716ac2fc3c7d0573e0b8 built and passed revision/platform/ELF checks, runtime alias tests, eight selected AOT runtime-hook tests and embedded SDK controls. The three standard/C2 policy configurations passed 96 cases on Linux 7.2.12. These are compiler proofs, not full application qualification.
  • Native x64 compiler run 40214829538 succeeded for the same source pins. Both compiler images import GLIBC 2.17 or older and no DT_RELR; this does not establish the application or sidecar floor. Owned container cleanup was verified.
  • Broad PR CI remains red in unchanged source: a Clippy warning in worker_vm_trace.rs, a parser-erasure ChildCount assertion, and formatting findings. This attribution comes from source comparison, not a baseline rerun. The AOT job passed 2,886 unit tests and 105 IR tests before the parser assertion.

The manual workflow also qualifies native Linux x64 application builds and same-host comparisons. It pins public-source inputs, imports the verified compiler pair, bounds each phase, preserves failure evidence, and cleans owned containers and temporary paging. A selected-input builtin/worker preflight now runs before application compilation: it caught the subsequent OpenClaw Knowledge worker incompatibility on both Linux architectures. The full-dist census is retained as diagnostic evidence; only the maintained selected module and native-worker graph gates compilation.

The earlier application run 40225514150 lost runner communication during TS. Its JS/C2 workflow steps succeeded, but no artifacts were exported and cleanup could not be verified. Those steps do not establish application qualification.

The R4 application run 40242181670 is pinned to workflow a61fc72a57672fafe87fc1bda9a8e231a5f98bc7 and OpenClaw main 4fa442e332745f1f58ccedd27106abdafcf4e019. Native JS and physical ShadowRealm-off C2 builds passed. Exported artifact hashes, core/config/Doctor, synthetic streamed turns, NodeVM, PTY, plugin lifecycle, Docker image, cron, all ten natural Gateway shutdowns and cleanup are verified. Nine ELF files have a maximum GLIBC 2.34 import and no RELR. TS was explicitly unselected. The final requested-completion check failed; no complete application or shipping qualification is claimed.

Strict zero-disk-JS fails for both variants: 254 positive reads each include the retained runtime/node_modules/@openclaw/plugin-loader/index.cjs, plus browser and Control UI assets. Linux 6.8 guest traces corroborate main-process MDWE bits3, anonymous RWX and RW-to-RX denial, and a successful private file-backed RX control. The original guest parser failed because the SQLite child re-execs the same binary; separate offline reanalysis with exact-argv selection passes the named memory checks without rewriting the original failure. This is not a universal ban on executable mappings.

The qualification harness now uses the source-owned Gateway shutdown budget and records forced termination explicitly. Synthetic native Linux checks cover signal preservation and finished-zombie handling. Runtime supervisors permit the service budget plus cleanup time; build/install defaults remain unchanged. The R4 selector/source integration passed 99 focused checks and independent/isolated reviews.

Follow-on comparison includes a separate untimed Knowledge worker control through an operator-created direct session, scripted agent tool discovery/dispatch and operator RPCs. This replaces an invalid HTTP-only fixture: the HTTP tool surface intentionally has no memory audience. Actual Linux Knowledge execution remains pending.

The opt-in mode=teams workflow restores exact exported app artifacts on a fresh native x64 runner and exercises pinned fetched CommonJS Teams loading through the compiled SDK. Replay 40248973814 passed for both unchanged R4 binaries. The actual 625-byte @openclaw/msteams@2026.10.7 entry was loaded/imported with channel msteams; the admitted PATH contained no external JavaScript runtime. All 53 exported files, origin/current pins, input-artifact immutability, deadlines and cleanup were verified. This is fetched-CJS boundary proof, not live Teams messaging or full application qualification.

Commit 637ba5fd6ca71d148d6bfde1c559c5ddf29e18fd adds an untimed restored-artifact replay to the existing benchmark mode. It fixes three qualification fixtures: Git 2.45+ is required by the frozen source, the native-worker diagnostic must obtain both flags from its existing environment owner, and the ClawHub assertion needs the admitted standalone SDK root rather than the npm layout. The Docker overlay applies only to the verified AOT image; the canonical assertion fix is OpenClaw PR184000. The same commit integrates exact-argv guest trace selection while retaining all syscall checks. Ordinary replay failures remain recorded, timeout/signal stops work, and forced child recovery cannot become passing requalification. All 53 focused checks and independent/isolated P0–P2 reviews pass. Native replay and repeated comparison remain pending.

Compiler source and the verified compiler pair are unchanged by these workflow updates. No upstream PR or comment is opened by this branch.

Final restored-artifact follow-on: run 40257051437 used the unchanged R4 JS/C2 executables on a fresh native x64 host. Canonical package creation, the isolated npm installation and inventory passed after fixing npm 11's duplicate user/global config path in 6629868b; the offline regression failed before the fix and all 16 integration tests passed afterward. Untimed backup create/verify passed under Node, Bun JIT, JS AOT and C2. Both Docker images built.

Full requalification still failed. Docker gateway-network and kitchen-sink stopped before their application workloads because the container could not read the mounted test helpers. The native-worker Code Mode turns returned the visible expected reply and both Gateways exited naturally with code 0, but some child-process traces lacked end footers; strict worker-lifecycle qualification remains failed. The post-backup host-quiet gate then rejected persistent unclassified/runtime processes, so functional timing controls and the complete performance cohort never ran. No startup, RSS or CPU advantage is established. Current-run and child-container cleanup and all 185 indexed exported payload files are verified; no paging was activated. These failures are preserved rather than counted as passes.

Separate TS-only run 40251675887 lost runner communication and exported no binary, compiler/OOM result or cleanup proof. Current-cut ARM application builds were not attempted before their launch window closed. Neither Linux platform is qualified to ship; strict zero-disk-JS still fails, general-app strict hardening is unqualified, and the tested OpenClaw cut is behind current main. All compiler, fixture, runtime and missing-evidence findings retain their separate scopes.

Terminal measurement follow-up

7c250086a6 fixes the terminal-exit review finding in both measurement owners. A timeout (124) or signal status (negative signal or >=128) now propagates as SystemExit, so the existing backup/functional callers stop the campaign. Ordinary workload failures retain ValueError reporting and optional-variant continuation. Working directory, environment, argv and signal handlers are restored on every path. Existing payload hash seals were regenerated with sync-process-stop.py; the unbound native-input snapshot remains unchanged because the supported binder regenerates it.

Validation of this follow-up:

  • The focused regression failed on the prior owner implementations with ValueError instead of terminal SystemExit; it passes with the fix. It covers both owners, success, ordinary failure, timeout and signal exits, plus process-state restoration.
  • python3 -B scripts/openclaw-p6/app/test_runtime_cleanup.py: 11 tests, 6 passed and 5 platform-specific skips on macOS.
  • Benchmark unit suite: 53 tests, initially one localhost HTTP error; all 7 Knowledge tests passed on the focused rerun with NO_PROXY=127.0.0.1,localhost and no_proxy=127.0.0.1,localhost. The other 46 tests passed in the initial run.
  • Packet/benchmark payload hashes match their regenerated manifests; git diff --check passed. Fresh independent review found no remaining blocking findings in this narrow patch.

This does not qualify the full AOT application cut or clear the existing timeout/native AOT findings. Current-head CI must complete before any landing decision.

Review follow-up at 1d162e288d

Removed only the two newly introduced per-test timeout overrides from the retained-run ESM/CommonJS and opt-in offline npm regressions, following the test owner's existing timeout policy. Behavioral assertions remain unchanged. TypeScript syntax and git diff --check pass; these checks do not replace native AOT execution.

The upstream sync overlaps this stack but does not supersede every fork fix. The hardened GNU verifier correction was ported with Peter Steinberger's original authorship into #218 (commit 2f741a3). This migration is necessary because upstream now owns the new verifier while this PR targets the older AOT typed stack. Retained-run behavior, extensionless runtime resolution, Darwin handler behavior, and the qualification harness remain under review; this PR is not being closed or described as fully migrated.

Current integration status — November 12

The rewritten integration at signed 3666c0447f retains this PR's production intents: extensionless runtime aliases, hardened GNU verification, retained-run support and Darwin handling. The standalone external-ESM alias regression is now restored through the current AOT harness. Exact test replay 43187688823 passes 1 test / 0 failures / 0 skips on native cd861bb9f5 / engine 651eeaca6e27; its independent control fails without the hook, and the compiled executable observes a postcompile external-file edit. Verified report 13929177885, SHA-256 9556a61608fae0f8dd02407869e757d0757b7fe296556e0b98f8084dce1e68ea.

The current Bun integration has not yet landed. Keep this PR open until that integration lands, then close it as superseded; merging this retired stack is unnecessary. Tracking PR 221 records the native evidence and pending full shipping qualification.

Known-bounds copies can inline under _FORTIFY_SOURCE=2, leaving no
__memcpy_chk import. Keep exact stack-protector and __snprintf_chk
requirements as hardening witnesses without requiring the optimizer
to preserve an out-of-line memory-copy check.

Exercise the verifier CLI with accepted and missing-import controls.
The existing hardened arm64 compiler passes without any binary change;
the ordinary compiler still fails the checked-formatting requirement.
@chatgpt-codex-connector

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

Copy link
Copy Markdown

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-26T02:05:26.606816Z 6629868 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.

@autofix-troubleshooter

Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

steipete and others added 3 commits October 24, 2026 23:44
Backport macOS SIGBUS recognition for removed-code entry from upstream
8614cd7, preserving the intentional exit-70
response when the command line was omitted.

When compile.trim.allow retains run, keep its external-script runtime,
startup package loaders, built-in module sources and locale data. Preserve
SharedArrayBuffer on macOS when the JIT was intentionally removed, rather
than treating JIT removal as evidence of a sandbox restriction.

Cover external ESM, a CommonJS CLI package, SharedArrayBuffer/Atomics, and an
opt-in real npm CLI offline install. Document retaining jit for disk FFI and
custom SQLite loaders. The default AOT command-line/JIT removal is unchanged.

Validation: 232 trimming unit tests and 15 AOT command-line tests pass.

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Merge the qualified b838e73 runtime retention change into the P6 task branch so subsequent compiler fixes preserve its run-only external-script behavior.
Let runtime onResolve hooks see extensionless package names and subpaths before native package resolution. Keep the existing onLoad eligibility filter and namespace parsing, including Windows path handling.

Add runtime namespace controls and an AOT external-module SDK import regression. The old pinned compiler fails the new behavior; native rebuilt validation follows the exact source commit.
@steipete steipete changed the title fix(build): accept inlined fortified copies in hardened GNU links fix(aot): resolve extensionless plugin aliases and hardened GNU checks Oct 25, 2026

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

Copy link
Copy Markdown

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: 8c71f9c89c

ℹ️ 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".

exitCode: 0,
});
expect(await run([app], folder)).toEqual({ stdout: "compiled entry\n", stderr: "", exitCode: 0 });
}, 600_000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove explicit timeouts from the new retained-run tests

Both new retained-run tests override the runner timeout with 600_000, allowing a stalled build or subprocess to occupy the test worker for ten minutes per case. The scoped instructions in test/AGENTS.md explicitly prohibit setting test timeouts; use the runner's existing timeout instead of adding these overrides.

AGENTS.md reference: test/AGENTS.md:L118-L120

Useful? React with 👍 / 👎.

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

Copy link
Copy Markdown

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: 4d7de000b3

ℹ️ 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 +31 to +33
except BaseException as e:
if isinstance(e,(owner.BuildInterrupted,KeyboardInterrupt,SystemExit)):raise
error=str(e)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve terminal measurement exits in the backup phase

If a backup measurement times out or exits with a signal-derived status, owner.measure() converts its SystemExit(124) (or other nonzero status) into a ValueError. This handler therefore records it as an ordinary failure and continues running the remaining backup cells, ultimately returning 1. Consequently, benchmark/host.py never sees the terminal status and can launch the functional probes and full cohort after reconciliation, despite its explicit terminal-exit gate. Preserve the measurement's timeout/signal status and propagate it before continuing to another cell.

Useful? React with 👍 / 👎.

steipete and others added 12 commits October 25, 2026 12:19
Replay restored R4 artifacts through the existing runtime controller before benchmark quiet admission. Preserve failed or forcibly recovered qualification separately from comparator evidence, and retain partial variant availability.

Pin the Git prerequisite, scope the standalone SDK assertion adapter to the selected AOT image, reuse native-worker diagnostic environment ownership, and select guest traces by the admitted invocation.
Use Git 2.56.0 documented NO_RUST switch for build and install so the qualification prerequisite works with the existing C toolchain. Keep source pins, dependencies, and nice priority unchanged.
Move only the private package clone generated declaration boundary before the unchanged external-link guard. Preserve canonical source, retain the fixture contents, and reject unexpected symlink shapes or existing preservation destinations.

Add filesystem regressions for canonical preservation and unrelated external links, and refresh the benchmark payload manifest.
vincentkoc added a commit that referenced this pull request Nov 6, 2026
Adapt the focused retained-run regression from #208 to the current AOT test owner. Exercise external ESM, CommonJS package loading and shared clone memory while the JIT is removed, plus normal embedded-entry execution.

Co-authored-by: Peter Steinberger <steipete@gmail.com>

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
@vincentkoc

Copy link
Copy Markdown
Member

Superseded by the canonical upstream integration in #221, landed at 9debcc4. This older branch overlaps the AOT rewrite: the extensionless resolver is already represented upstream, the compiled external-plugin regression is preserved in 3666c04, and the hardened GNU checks were ported in 2f741a3 with Peter Steinberger's authorship retained. Credit to @steipete and Jarred Sumner for the fixes. Exact integration proof: https://github.com/openclaw/bun/actions/runs/43739822593 and https://github.com/openclaw/bun/actions/runs/43739822507. Closing the overlapping pre-rewrite branch; the old application benchmark campaign is not claimed as replacement qualification.

@vincentkoc vincentkoc closed this Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants