You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Task.is_done() returns false after .await (await appears to invalidate the handle) #637
t.is_done() is FALSE immediately after t.await completes — reproduced twice (sync stepping and async-main). §14.7 says is_done reports completion, so post-await it should be true (or the handle's post-await state should be specified).
Repro sketch
let t = work() // async fn
let r = t.await // completes
assert(t.is_done()) // FAILS — is_done() is false
Stepping the scheduler (is_done false→true via with_runtime_run_one_step) works correctly; only the post-await path disagrees. Likely await consumes/moves the handle, leaving is_done querying an invalidated task.
Spec §14.7
Either is_done should remain true after await, or the spec should state the handle is consumed by await (in which case calling is_done post-await should be a compile error, not a silent false).
Found
Coverage sweep #531, 2026-07-03. Fixtures assert is_done false→true via scheduler stepping, avoiding the await path.
Fixed in 1056ff5, taking the issue's first fork: is_done remains true after await (§14.7's is_done (&Task[T]) -> bool signature is a borrow and promises a completion report; silent false was the one wrong answer).
Root cause:with_runtime_fiber_is_completed returned 0 whenever the generational slot lookup failed — which is exactly the state after .await, because await reaps the fiber (slot released, generation superseded). The generational SlotMap was correctly refusing a stale handle, but the query layer translated "stale" into "not done".
Fix: handles are minted only by spawn, and every reap path is terminal-only (verified: result-take gated on DONE, panic-take gated on DONE+has_panic, runtime shutdown). So a well-formed handle that no longer resolves names a finished task — both fiber cores now report completed for that case. Valid-handle behavior is untouched (false after spawn, true after the scheduler completes it — the existing stepping fixtures still pin that). Bonus: cancel() on an already-reaped handle now reports "already completed" instead of issuing a no-op cancel request.
Residual, noted for the record:was_cancelled() on a reaped handle still returns false — after reaping, the runtime cannot distinguish cancelled-then-joined from completed-normally without a per-slot tombstone. If that combination matters, it needs a small design decision (tombstone bit vs documenting the post-reap contract).
Pinned by the extended test/spec/spec_ss14_7_task_is_done.w (post-await assertion added alongside the original spawn/step assertions). Windows core changed in lockstep and target-validated (--target x86_64-pc-windows-msvc --no-prelude --validate-all); not executed on a Windows host (that work is milestone post-v0.16.0).
Gates on 1056ff5: build 0, FIXPOINT, audit:all violations=0, :test all targets ok, test-green/last-green recorded.
Activity
test: coverage-sweep batch 4 (#497 #504 #506 #524 #525 #531 #534)
Runtime: is_done() on a reaped task handle reports done, not false (#637
ehartford commentedon Jul 16, 2026
Fixed in 1056ff5, taking the issue's first fork: is_done remains true after await (§14.7's
is_done (&Task[T]) -> boolsignature is a borrow and promises a completion report; silent false was the one wrong answer).Root cause:
with_runtime_fiber_is_completedreturned 0 whenever the generational slot lookup failed — which is exactly the state after.await, because await reaps the fiber (slot released, generation superseded). The generational SlotMap was correctly refusing a stale handle, but the query layer translated "stale" into "not done".Fix: handles are minted only by spawn, and every reap path is terminal-only (verified: result-take gated on DONE, panic-take gated on DONE+has_panic, runtime shutdown). So a well-formed handle that no longer resolves names a finished task — both fiber cores now report completed for that case. Valid-handle behavior is untouched (false after spawn, true after the scheduler completes it — the existing stepping fixtures still pin that). Bonus:
cancel()on an already-reaped handle now reports "already completed" instead of issuing a no-op cancel request.Residual, noted for the record:
was_cancelled()on a reaped handle still returns false — after reaping, the runtime cannot distinguish cancelled-then-joined from completed-normally without a per-slot tombstone. If that combination matters, it needs a small design decision (tombstone bit vs documenting the post-reap contract).Pinned by the extended
test/spec/spec_ss14_7_task_is_done.w(post-await assertion added alongside the original spawn/step assertions). Windows core changed in lockstep and target-validated (--target x86_64-pc-windows-msvc --no-prelude --validate-all); not executed on a Windows host (that work is milestone post-v0.16.0).Gates on 1056ff5: build 0, FIXPOINT, audit:all violations=0, :test all targets ok, test-green/last-green recorded.
Docs: record #637 fix, #676 minicoro deferral, #650 escalation in han…
join_cleanup consumes its Task: a later use is a use of a moved value…
join_cleanup consumes its Task: a later use is a use of a moved value…
`.await` consumes the task: a later read is a use of a moved value (#…
join_cleanup consumes its Task: a later use is a use of a moved value…
`.await` consumes the task: a later read is a use of a moved value (#…
join_cleanup consumes its Task: a later use is a use of a moved value…
`.await` consumes the task: a later read is a use of a moved value (#…
join_cleanup consumes its Task: a later use is a use of a moved value…
`.await` consumes the task: a later read is a use of a moved value (#…
Cancellation: indirect callees that may suspend get the cancelled-ret…