Replace the two-class completion lifecycle with one rule: once the
program returns, every promise still running - race losers, fail-fast
stragglers, and fire-and-forget calls alike - is interrupted rather
than awaited. Work whose completion matters must be awaited by the
program.
Waiting for un-awaited work before interrupting observed leftovers
could hold the execution open or deadlock it outright: a fire-and-
forget chain awaiting a race loser, or queued work needing tool-call
permits the losers occupied, blocked a drain that only the pending
interruption could unblock. Rejections that settled un-awaited before
the return still surface as Success.warnings diagnostics.
Give warnings their own output byte budget equal to maxOutputBytes so
a budget-consuming value can never starve runtime diagnostics, and
state the lifetime rule in the model-facing instructions. Port ten
curated Test262 combinator cases (duplicate members, already-settled
inputs, ordering, resolve/reject flattening) and cover the timeout-
during-cleanup path with a never-settling slow-cleanup harness tool.
Rework the execution promise lifecycle:
- Normal completion drains unobserved (fire-and-forget) promises to
empty, then interrupts remaining observed work (race losers,
fail-fast Promise.all stragglers) in one synchronous batch signal,
so abandoned losers no longer gate completion or eat the timeout.
- Replace Success.unhandledRejections/unhandledRejectionsTruncated
with a generic warnings diagnostics channel; byte-budget truncation
appends an in-band Truncated marker diagnostic.
- A timeout firing after the program returned keeps the computed
value and reports a leading TimeoutExceeded warning instead of
discarding the result.
- Make PromiseRuntime effect construction pure: split observe() into
synchronous markObserved() plus a pure await(), and allocate
creation ids at execution time before the fork.
- Replace the O(n^2) raceAll loop in Promise.all with fail-fast
Effect.all over waiter subscriptions; sibling work is never
cancelled at rejection time.
- Bind all per-execution state (tool runtime, logs, timeout
bookkeeping) at run time so a reused execution Effect starts clean.