lumbda/wasm
russell@unturf.com 63808f72a5
repl: fix cancel + immediate-resubmit race that wedged the new eval
Three converging bugs let a cancel-then-send sequence land in a
broken state:

1) cancelAllPendingInActiveTab didn't touch the toolbar — the user
   had to wait for the cancelled promise's .catch.then to drain
   before send re-enabled. fox saw clicks register as noops because
   the button was still disabled.

2) Even after the rejection settled, the stale .then path
   re-enabled sendBtn from inside the FIRST run's closure — but by
   then the user had already submitted a SECOND run that set
   sendBtn disabled. The stale .then clobbered the in-flight state.

3) The OLD worker's last-queued "done" or "error" message could be
   delivered after a fresh run had already taken state.pending[k];
   the OLD handler would then delete the NEW run's pending entry.

Fixes:

* cancel handler now re-enables send / disables cancel + pause
  synchronously and clears tab.activeInput.
* The completion .then re-checks isEvalInFlight(tab) before resetting
  toolbar state, so a stale settle from a cancelled run can't
  override the fresh run's UI.
* evalInTier's done/error handler only deletes state.pending[k] when
  the entry still has the runId we started with.

Verified headlessly: long loop → cancel → submit (+ 1 2) immediately
→ first entry shows error: cancelled, second entry shows result 3,
send re-enabled.
2026-06-15 14:11:55 -04:00
..
app playground streaming: single text node — fixes 5 functional test regressions 2026-06-15 14:04:16 -04:00
asm asm streaming: recycle the 64 KB output buffer after each flush 2026-06-15 06:36:00 -04:00
c repl: auto-pause + portal-save when leaving a tab mid-eval, resume on return 2026-06-15 09:02:53 -04:00
dist-repl repl: fix cancel + immediate-resubmit race that wedged the new eval 2026-06-15 14:11:55 -04:00
python python tier: SAB-backed pause poll — auto-pause now works on python too 2026-06-15 11:16:50 -04:00
repl repl: fix cancel + immediate-resubmit race that wedged the new eval 2026-06-15 14:11:55 -04:00
tests wasm asm: stream output line-by-line via new emit_chunk env import 2026-06-14 20:35:13 -04:00
Makefile repl: auto-pause + portal-save when leaving a tab mid-eval, resume on return 2026-06-15 09:02:53 -04:00
serve-coop.py repl: auto-pause + portal-save when leaving a tab mid-eval, resume on return 2026-06-15 09:02:53 -04:00