Skip to content

fix(tasks): reject cancelled value results - #2906

Open
slepp wants to merge 2 commits into
mainfrom
fix/cancelled-task-result-authority
Open

fix(tasks): reject cancelled value results#2906
slepp wants to merge 2 commits into
mainfrom
fix/cancelled-task-result-authority

Conversation

@slepp

@slepp slepp commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

A value-returning task cancelled between allocation and entry published a zeroed value as a successful result. The caller received x=0 y=0 from a body that returns Point { x: 11, y: 22 }, with no indication anything had gone wrong.

An ABI-only zero looked complete because the wrapper published every return, and await consumed the payload bytes without first honouring terminal status. Completion was inferred from readable memory rather than established by the task.

Await now takes terminal status as its authority, and publication is suppressed when the task did not reach the point of producing a value.

Behaviour at each cancellation window

  • Before allocation — no result authority exists.
  • Allocation to entry, and mid-body — publication is suppressed and the join surfaces cancellation.
  • After the value is published — the value stands and is released by typed teardown.

Verification

A genuine zero return must remain distinguishable from a cancelled task, since that is the pair a naive fix conflates. Both are covered: cancellation surfaces as cancellation, and a task that really returns zero still succeeds with that value.

An owned result belonging to a cancelled task is released exactly once, checked with the leak oracle. Runtime task tests pass 66/66, task IR emission 2/2, the forced-cancel compiled probe passes, and the vertical-slice suite is green. New runtime exports are classified and make verify-ffi matches.

slepp added 2 commits August 17, 2026 02:38
I make task result publication explicit and preserve exact-once cleanup for unconsumed owned values.
I record the intentional shared final-suspend block in the native and WASM byte-identity corpus.
@slepp
slepp force-pushed the fix/cancelled-task-result-authority branch from d85305d to 70361c6 Compare August 17, 2026 08:39
@slepp

slepp commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

I rebased this onto current main and force-pushed 70361c6b4b46, preserving the cancellation result authority and updating the FFI ownership ratchet against the current baseline. The focused codegen, runtime, forced-cancel, and FFI checks pass, and CI is rerunning.

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.

1 participant