From 1be02810563ddf36d4fcf8a45841682d8d576996 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Feb 2026 08:46:58 +0000 Subject: [PATCH] fix: clear outbox when guest handle traps When a guest calls swactor.send() then traps, the outbox entries from the incomplete operation survived and leaked into the next successful handle() call, delivering messages from a failed context. Now clears the outbox on trap, consistent with the "drop everything from failed operations" semantics. Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski --- crates/wasm-actor/src/actor.rs | 1 + crates/wasm-actor/tests/wasm_actor.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-actor/src/actor.rs b/crates/wasm-actor/src/actor.rs index c9ba97e..93d1c0a 100644 --- a/crates/wasm-actor/src/actor.rs +++ b/crates/wasm-actor/src/actor.rs @@ -50,6 +50,7 @@ impl ActorInterface for WasmActor { // 3. Call guest handle if self.handle.call(&mut self.store, (ptr, len)).is_err() { + self.store.data_mut().outbox.clear(); // discard sends from incomplete operation return; // handle trapped — drop message, keep actor alive } diff --git a/crates/wasm-actor/tests/wasm_actor.rs b/crates/wasm-actor/tests/wasm_actor.rs index 3a4735c..13f610e 100644 --- a/crates/wasm-actor/tests/wasm_actor.rs +++ b/crates/wasm-actor/tests/wasm_actor.rs @@ -743,7 +743,6 @@ fn native_actor_communicates_with_wasm_actor() { // ── Stale outbox: sends before trap leak into next handle ───────────────────── #[test] -#[ignore] // BUG: outbox not cleared on handle trap — stale entries leak into next call fn outbox_entries_from_trapped_handle_do_not_leak_into_next_call() { // A guest that calls swactor.send() successfully, then traps. // The outbox contains the send from before the trap.