Repository navigation
Description
Child of #32; ordered before the owned child-thread bootstrap.
Scope
Implement the private, feature-gated root execution substrate for the exact ThreadedRustV1 artifact admitted by #31/#33. Retain the admitted Wasmtime engine/module privately, allocate exactly one engine-owned SharedMemory with the required 17 initial / 16,384 maximum pages, and define it as env.memory.
Build one Linker<ThreadStoreState> and one reusable InstancePre. Use an Arc<ThreadController> with OnceLock<Arc<InstancePre<ThreadStoreState>>> to break the host-function/prelink cycle: host callbacks obtain the controller through store state, rather than capturing an uninitialized prelink.
Add only deterministic, no-authority compatibility shims for the exact closed imports: kernal-api:v1::kernel-yield, wasi::thread-spawn, and P1 clock_time_get, environ_get, environ_sizes_get, fd_write, proc_exit, and sched_yield. Environment is empty; fd output is not forwarded; no filesystem, network, random, process, or ambient clock authority is granted. In this slice thread-spawn is a deterministic typed rejection stub; it must not bootstrap children.
Root execution creates one fresh Store, instantiates the prelink, and therefore runs the module start. Do not separately call kernal-api-run: Wasmtime start execution is distinct from exported _start, and the deterministic Rust command reaches its main from start. Contain proc_exit(0) as controlled root completion and map nonzero exit/trap/prelink/allocation failures to facade-owned semantic errors. Store state clones the caller-provided kernal_api::async_engine::RuntimeHandle; it never constructs a Tokio runtime.
RED → GREEN
- RED: the existing direct, real Soldr-built artifact admits but has no private root execution path.
- GREEN: direct real artifact test proves exactly one compilation/prelink, an engine-owned shared memory with 17/16,384 pages linked as
env.memory, one root Store/Instance, start execution, one facade RuntimeHandle identity, deterministic no-authority P1 behavior, and typedproc_exit/trap outcomes. thread-spawnreturns the documented deterministic rejection and creates no TID, Store, Instance, native thread, or registration.- Public API exposes semantic run/result/error values only—no Wasmtime, Tokio, Linker, Store, InstancePre, or SharedMemory types.
Platform and safety
Target Linux/macOS/Windows on x86-64 and ARM64 using Wasmtime 45 Cranelift. Use synchronous Wasmtime calls for v1. Shared-memory concurrent bytes are accessed only with atomics. No Store/Instance crosses a native thread boundary.
Non-goals
No owned child threads, thread joins, async resources/streams, capabilities, pooling, broad WASI, Tauri, worker-process containment, forced teardown, quotas, fuel, or epoch policy.
Dependencies and related work
- Parent: feat(wasm): bootstrap real threaded guest instances over shared memory #32; parent chain feat(wasm): add threaded Rust guest and owned thread bootstrap #26 and feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15; contributes to feat(wasm): prove a streamed kernal-api Rust sketch runtime with zccache and extension2 cores #13 and feat(wasm): drive a Tauri screenshot task through the async kernal API #14.
- The source-only real artifact build remains blocked by soldr#2919; keep a direct-artifact test gated on the supplied artifact until Soldr materialization is fixed.
- Followed by the child-thread bootstrap issue created from this issue.
Activity
zackees commentedon Aug 27, 2026
Implementation merged in #39 (squash merge 9aacf67).
Validation passed locally on Windows/Soldr and in managed Linux Bosn 0.1.3 with CARGO_BUILD_JOBS=1: fmt, all-features lint/test, and focused threaded-root/artifact tests all returned 0. The issue remains open intentionally: the Cargo-built real Rust threaded-artifact execution proof is blocked by forge-ci/soldr#2919.