Skip to content

poisoning: entry refusals name the original trap (#145 ask 1) - #148

Merged
lannbot merged 1 commit into
mainfrom
poison-cause-145
Aug 15, 2026
Merged

lannbot merged 1 commit into
mainfrom
poison-cause-145

Conversation

@lannbot

@lannbot lannbot commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Implements ask 1 of #145 — pure diagnosability, no semantic change.

What

  • task/scheduler.ts: the poisoned-instance WeakSet becomes a WeakMap keyed by instance, recording the first poisoning cause (follow-on failures against a corpse are noise). instancePoisonCause() exported; isInstancePoisoned() unchanged.
  • The entry-refusal sites — host entry (exec/boundary.ts), sync/async start-call (intrinsics/fact_calls.ts), enter-sync-call bracket (intrinsics/mod.ts), gated dtor (cabi/handles.ts) — append — instance poisoned by: <original trap> when, and only when, the target is poisoned. A transient reentrance refusal stays byte-identical, which is exactly the disambiguation Go components trap (and poison their instance) when the Go runtime reads the clock inside cabi_realloc #145 asked for.
  • Conformance-safe by construction: the suite matches trap messages by substring (harness/src/runner.ts:319); builtin-trap-poisons-instance.wast still passes.
  • Tests: runtime/tests/poison_cause_test.ts (first-cause-wins, suffix shape, transient unchanged, non-Error/unprintable causes); e2e after-poison refusal asserts the suffix; the sibling-cycle transient test asserts its absence.
  • Tracker: CGO-1 in upstream-consumer-findings.md — the componentize-go root cause (cabi_realloc calling clock imports under GC pacing), filing upstream is the operator's call. The adjacent deltic-side finding from the Go components trap (and poison their instance) when the Go runtime reads the clock inside cabi_realloc #145 review (host-entry lowering runs realloc outside the may_leave window) is Host-entry lowering runs cabi_realloc outside the may_leave window (context.ts v1 simplification) #147.

Not in scope

Gates

test-runtime (504/0, incl. 4 new), conformance (1254 passed / 0 failed / 95 expected xfail, no stale), sched-seeds (seeds 1 and 4242 + seeded conformance), test-wasi, test-ct-runner, test-bundle, publish-check. Browser/shell lanes untouched by this change run post-merge as usual.

"cannot enter component instance" covers two states an embedder cannot
tell apart: a transient reentrance overlap and a permanently poisoned
instance. #145's downstream investigation lost a day to that ambiguity,
chasing caller-side call overlap while the instance was simply dead.

The scheduler's poisoned-instance WeakSet becomes a WeakMap recording
the FIRST poisoning cause per instance (follow-on failures against a
corpse are noise); the entry-refusal sites (host entry in
exec/boundary.ts, sync/async start-call in intrinsics/fact_calls.ts,
enter-sync-call in intrinsics/mod.ts, gated dtor in cabi/handles.ts)
append "— instance poisoned by: <original trap>" via withPoisonCause.
The transient refusal stays byte-identical, and the suffix is
conformance-safe: the official suite matches trap messages by substring
(harness/src/runner.ts); builtin-trap-poisons-instance.wast still
passes. instancePoisonCause() is exported for programmatic queries; no
embedder-api amendment yet — the message carries the cause.

Also: CGO-1 in upstream-consumer-findings.md (componentize-go's
cabi_realloc can call clock imports under GC pacing — the #145 root
cause; filing is the operator's call), and the tracker scope line
widens to cover consumer toolchains. The host-entry lowering gap found
by the #145 review (realloc outside the may_leave window, the
cabi/context.ts v1 simplification) is #147.

Gates: test-runtime, conformance, sched-seeds, test-wasi,
test-ct-runner, test-bundle, publish-check.
@lannbot
lannbot enabled auto-merge August 15, 2026 04:03
@lannbot
lannbot merged commit 937614f into main Aug 15, 2026
3 checks passed
@lannbot
lannbot deleted the poison-cause-145 branch August 23, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants