Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Context
Implementation child of #15, following #25 and #26, and required by #13/#14. Make the real threaded guest execution safe and measurable under resource pressure before application capabilities exist.
Depends on
- feat(wasm): add engine policy and strict module admission validation #25 strict engine/admission policy.
- feat(wasm): add threaded Rust guest and owned thread bootstrap #26 real threaded guest, owned bootstrap, and shared-memory execution model.
Proposal
Add private scheduling and lifecycle controls for the selected Wasmtime baseline:
- bounded execution using fuel and epoch interruption where the selected engine supports them;
- explicit kernel-owned shared-memory accounting independent of Store limiter/pooling allocator;
- configured per-sketch guest thread, memory, execution, and pending-work limits;
- cancellation/timeout coordination with the single facade-owned kernel runtime;
- teardown instrumentation proving cleanup of guest execution, host registrations, permits, and memory-accounting state.
Policy uses facade-owned semantic configuration/errors and keeps engine details private. Fuel/epoch settings must be verified against the resolved Wasmtime version, not assumed from the researched baseline.
Invariants
- The threaded profile does not rely on a pooling allocator for shared-memory limits.
- Limits are enforced by
kernal-apiand are not delegated solely to Wasmtime Store limiting. - Timeout/cancellation must not create another Tokio runtime or block the host event loop.
- Instrumentation identifies logical sketch, guest thread, Store/Instance lifetime, configured/observed memory, interrupts, terminal reason, and live-host-resource count without exposing backend types.
default = []stays independent of all engine/scheduling dependencies.
Non-goals
- Worker-process implementation (handled by the following containment issue).
- Async guest capability/resources/streams/blobs/output, Tauri, and screenshots.
- Claiming atomic-wait interruption is reliable before empirical proof.
Acceptance criteria
- RED: tests demonstrate no configured execution/memory accounting boundary currently exists for the feat(wasm): add threaded Rust guest and owned thread bootstrap #26 threaded guest.
- RED: fixtures demonstrate excess thread/memory/execution demand is not yet rejected or observable with facade-owned diagnostics.
- GREEN: resolved Wasmtime configuration for fuel, epoch interruption, and shared memory is recorded and exercised, or unsupported portions produce an explicit typed unsupported result.
- GREEN: configured fuel/epoch execution budget interrupts non-cooperative guest compute deterministically where supported.
- GREEN: shared-memory maximum is accounted/enforced by
kernal-apiindependently of Store limiter and pooling allocator. - GREEN: thread, memory, execution, and pending-work limits reject excess demand deterministically with facade-owned errors.
- GREEN: cancellation/timeout cleanup leaves no live guest scheduling registrations, permits, or accounted memory after normal completion, trap, fuel exhaustion, and epoch-check interruption; blocked atomic waits and host-blocked waits explicitly defer to feat(wasm): add killable threaded-sketch worker containment #28 containment.
- GREEN: instrumentation proves one kernel runtime and reports shared versus per-thread execution state.
- GREEN: focused test coverage compiles on Linux, macOS, and Windows x86-64/ARM64; runtime reports identify native coverage.
- GREEN: no-default-feature checks remain isolated from engine/scheduling dependencies.
Deliverables
- Private limit/scheduling configuration and facade-owned diagnostics.
- Fuel/epoch/shared-memory accounting implementation and regression suite.
- Structured teardown/resource instrumentation and focused Soldr documentation.
- Compatibility record tied to actual Cargo-resolved engine version.
Decisions
- Treat fuel/epoch as configurable containment signals, not substitutes for worker-process cleanup.
- Account shared memory outside Store limiter because feat(wasm): prove a streamed kernal-api Rust sketch runtime with zccache and extension2 cores #13 explicitly requires that boundary.
Related issues
- feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15 owns parent lifecycle requirements.
- feat(wasm): add engine policy and strict module admission validation #25 validates engine/config admission.
- feat(wasm): add threaded Rust guest and owned thread bootstrap #26 provides actual threaded execution.
- feat(wasm): prove a streamed kernal-api Rust sketch runtime with zccache and extension2 cores #13 defines the limits/backpressure/teardown contract.
- feat(wasm): drive a Tauri screenshot task through the async kernal API #14 will require these controls before remote-content webview work runs in a sketch.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
zackees commentedon Aug 27, 2026
Acceptance-criteria clarification, following merged #43 (PR #47) and scoped characterization work in #44: deterministic epoch interruption means deterministic semantic terminal-winner selection and facade classification, not an exact deterministic wall-clock deadline. For plain running compute, epoch observation is finite under the configured tick/deadline but its precise timing is scheduler-dependent. Cancellation wins a same-tick deadline; a real fuel trap remains OutOfFuel.
Blocked atomic.wait and host-blocked calls remain explicitly containment-required and belong to #28; #44 characterizes that boundary with a killable subprocess rather than treating an in-process epoch interrupt as cleanup. Platform evidence must distinguish native-run from compile-only/not-run results. See #44, #43, and #28.
zackees commentedon Aug 27, 2026
Closure evidence:
All children are closed. The merged set preserves default-feature isolation and keeps backend details private.
atomic.waitand host blocking remain explicitly deferred to #28 worker-process containment rather than claimed as in-process interruptibility.