Skip to content

feat: run V8 WebAssembly on native host imports and remove the JavaScript runner - #2140

Draft
NathanFlurry wants to merge 11 commits into
security/v8-upgradefrom
agentos-v8-followup-2
Draft

NathanFlurry wants to merge 11 commits into
security/v8-upgradefrom
agentos-v8-followup-2

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member

Stacked on #2139 (V8 upgrade). Retarget to main after it merges.

  • Run every V8 WebAssembly command with native Rust host imports bound directly to the module. The JavaScript WASM runner and its sync-RPC bootstrap are removed; no JavaScript runs in the WASM guest path.
  • Move the host-import handlers into agentos-executor-wasm-host, shared by V8 and Wasmtime, so both engines run one implementation of the ABI.
  • Each guest runs in its own V8 isolate. A small warm pool pre-creates isolates (never reused across guests), each image is admitted and compiled once per process, and the sidecar hands the executor the bytes it already loaded at spawn.
  • Shared outcomes use engine-neutral ERR_AGENTOS_WASM_* codes on both engines, including ERR_AGENTOS_WASM_STACK_EXHAUSTED; engine prefixes remain only for engine-specific machinery.
  • A panic in a host import fails only that guest instead of aborting the sidecar.
  • The platform smoke test now runs WASM commands, including a stack overflow, on every release target.
  • Docs: design note with benchmark results (docs/design/v8-native-wasm-imports.md), raw medians in packages/benchmarks/results/, and docs/wasmvm/executors.md describing V8 as the shipped engine and Wasmtime as an opt-in build feature.

Release sidecar, warm medians: true 50.5 to 17.0 ms, sqlite3 104 to 27.8 ms, sh pipeline 173 to 45.6 ms. With 100 commands at once, 119 to 348 per second and peak memory 1,334 to 220 MiB.

Known follow-ups: V8 guests do not yet reserve against runtime.resources.maxWasmMemoryBytes (the runner had the same gap); the runner's _processWasmSyncRpc bridge handlers are still installed for JavaScript isolates.

@NathanFlurry NathanFlurry added ci: native-all Build and smoke-test the native sidecar on every release platform aggregate-ci Run exhaustive aggregate CI, including both WASM backends labels Nov 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📟 Pip-Boy · 873c6f9

📦 Packages

Skipped: this PR doesn't change any published package.

🧹 Rust dependencies · cargo deny + cargo shear

check new in this PR fixed existing on base
advisories ✅ 0 0 2
licenses ✅ 0 0 0
sources ✅ 0 0 0
bans ✅ 0 0 0
unused 🟡 1 1 74
new finding via
unused dependency 'agentos-executor-wasm-abi-generator' crates/executor-conformance/Cargo.toml

🦀 Binaries · publish Dockerfiles, --release

Base: main@df1fafa, the newest main commit with native builds before the merge base. Size changes merged to main since then show up here too.

artifact npm @latest base this PR Δ vs base
🔴 agentos-native-sidecar darwin-arm64 120.9 MB 128.7 MB 161.1 MB +32.3 MB (+25.1%)
🔴 agentos-native-sidecar darwin-x64 128.0 MB 135.8 MB 168.2 MB +32.4 MB (+23.8%)
🔴 agentos-native-sidecar linux-arm64-gnu 141.9 MB 150.7 MB 184.2 MB +33.5 MB (+22.3%)
🔴 agentos-native-sidecar linux-x64-gnu 142.4 MB 151.4 MB 185.2 MB +33.7 MB (+22.3%)
`agentos-native-sidecar linux-arm64-gnu` · crates that changed most (from symbol sizes, approximate)
crate base this PR Δ
agentos_executor_v8_runtime 2.4 MB 11.1 MB +8.7 MB (+360.9%)
v8 16.9 MB 22.4 MB +5.5 MB (+32.7%)
[c/other] 12.6 MB 11.1 MB −1.6 MB (−12.4%)
icu_78 0 B 1.5 MB +1.5 MB (new)
icu_74 1.4 MB 0 B −1.4 MB (−100.0%)
agentos_executor_wasm_host 0 B 310.9 KB +310.9 KB (new)
std 1.9 MB 2.2 MB +281.6 KB (+14.1%)
temporal_rs 0 B 159.9 KB +159.9 KB (new)
simdutf 0 B 156.2 KB +156.2 KB (new)
__llvm_libc_cr 0 B 153.2 KB +153.2 KB (new)
`agentos-native-sidecar linux-x64-gnu` · crates that changed most (from symbol sizes, approximate)
crate base this PR Δ
[c/other] 23.4 MB 12.5 MB −11.0 MB (−46.8%)
agentos_executor_v8_runtime 2.6 MB 11.2 MB +8.7 MB (+336.6%)
v8 17.4 MB 23.2 MB +5.9 MB (+33.8%)
icu_78 0 B 1.5 MB +1.5 MB (new)
icu_74 1.5 MB 0 B −1.5 MB (−100.0%)
simdutf 0 B 428.4 KB +428.4 KB (new)
agentos_executor_wasm_host 0 B 426.1 KB +426.1 KB (new)
std 2.1 MB 2.3 MB +206.0 KB (+9.7%)
__llvm_libc_cr 0 B 194.6 KB +194.6 KB (new)
temporal_rs 0 B 172.0 KB +172.0 KB (new)

⏱ Timing

job wall time slowest step
zizmor 9s checkout · 3s
changes 27s checkout · 22s
self-test 34s Run pnpm --filter pipboy test · 11s
native · linux-x64-gnu 4m58s Build with the publish Dockerfile · 4m38s
native · darwin-arm64 4m43s Build with the publish Dockerfile · 4m21s
hygiene 48s checkout · 21s
native · darwin-x64 4m32s Build with the publish Dockerfile · 4m11s
native · linux-arm64-gnu 10m38s Build with the publish Dockerfile · 10m13s
⏭ footprint — skipped
execute · darwin-arm64 54s Run pnpm install --frozen-lockfile --ignore-scripts --filter '@rivet-dev/agentos...' · 23s
execute · darwin-x64 56s Execute the release sidecar through its matching public client · 18s
execute · linux-arm64-gnu 23s Run pnpm install --frozen-lockfile --ignore-scripts --filter '@rivet-dev/agentos...' · 6s
execute · linux-x64-gnu 36s checkout · 7s
report 25s setup-node · 7s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for 873c6f9: every job and step, with the sizes above attached. Run after CI finishes.

pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha 873c6f96cd23f57807f878392a1135709d88b8fa

Add --otlp <url> to send it to any OTLP/HTTP collector.

Agent instruction: From a rivet-dev/agentos checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.

This branch has not been deployed

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

Labels

aggregate-ci Run exhaustive aggregate CI, including both WASM backends ci: native-all Build and smoke-test the native sidecar on every release platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant