Issue #3011: async: a task that never pauses runs where it starts instead of on the pool (ADR-async-v7 D20)

Open and answer this issue on GitHub.

async, wip · opened 2026-11-30 · updated 2026-12-01 · 9 comments

Part of #983, and of #557 / #125 for the Rust it adds under the #1214 exception. Found while #990 (an analysis of a migrated program). Pausing tasks are the question of “Decision: pausing tasks on several threads, and who pays for it” (#1232); this issue is only about tasks that never pause and does not wait for that decision.

Decided (owner, 2026-12-01): option (b+) of the decision paper (https://github.com/nikaia-foundation/nikaia/issues/3011#issuecomment-7295667829, second version), from “Decision: D20 pool placement” (#3012). The paper holds the grounds, the probes and the measurements. This body is the work order.

What is wrong

An async e whose computation never pauses always runs right away and to its end where it is started, at user-parallelism yes and at no. The specification says otherwise: Part I 8.1.2, Part II 12.7 and ADR-async-v7 D20 (“A task that never pauses runs on the pool where tasks run in parallel; at no, it runs when the main line next pauses or waits”). D20 replaces ADR-328 D10 on purpose. This is a defect (I6), not a gap.

Cause (traced): emit_async_task (emit_core_args.nika) starts a never-pausing task on the current thread at both settings (Scope::start_here, Scope::start_kept_gated, task.rs). The only pool path is the old task::scope (PoolScope, PausedPoolScope), which did not come along to async. Every program #990 moved to async lost its parallelism. “async: remove overlap, task::scope and spawn” (#991) waits for this issue.

Probe (ADR-async-v7 D6, at yes on 4 cores): let a = async heavy(400000000), let b = async heavy(400000001), let c = heavy(400000002). Expected: all three at once. Actual: one after another.

The decided D20 text

Replaces the D20 paragraph in ADR-async-v7 and the matching sentence of Part I 8.1.2 and Part II 12.7 (To build 1):

Where tasks run in parallel, a child task that never pauses runs on the pool beside the main line. It runs from its start where its captured values can be copied, moved or shared with it for its run, or where the main line does not pause before its value is first needed; otherwise it runs from the start of the part of the main line that needs its value. Where its value is first needed, the group’s thread waits for it. The setting and the group change the duration, not the meaning.

At no D20 is unchanged: the task runs when the main line next pauses or waits.

How (b+) works

A stretch is a part of the main line with no pause in it. The compiler knows every pause point per call site (task_pauses / expr_pauses, emit_core_below.nika:451-490; emit_calls.nika:36-66).

  1. A pool scope per stretch. A task started in a stretch runs on the pool from its start, inside a rayon::in_place_scope around that stretch. Its first use waits only for that task. The scope joins the rest at the stretch’s end, before the pause. A stretch never contains the start of a pausing child.
  2. Start placement. A task whose first use lies beyond a pause starts at the beginning of the stretch that needs its value. A task whose value is never named is joined at the group’s end.
  3. Copy, move or share instead of borrow. Such a task becomes an owned ('static) pool task and runs from its start across pauses:
    • numbers, views and handles are copied (takes_away, check_values.nika:12);
    • a value the main line does not read after the task’s start is moved there (last-use analysis as reads_on_paths, check_takes.nika:1805, extended to names from outside the group);
    • a value that is not cheap to copy and that the main line reads again is shared for the task’s run: at the task’s start it moves into an Arc (O(1), the data stays put), the task gets a clone, the main line reads through its own handle. At the first write or move after the join it comes out with Arc::into_inner; where the main line never writes it again, the handle is dropped where the value would have been. D8 refuses every write and move of the binding in the window, per binding, so nothing is observable. The handle is never in the source and never in the --sharing report; no destructor moves (6.2, ADR-037 D3 hold; precedent: Kept, emit_core_args.nika:803). A view the task hands back into the shared value carries a clone of the handle as in ADR-tether-v1 D11; the value comes out after the view’s last use.
    • A large value the function does not own (a lent parameter, or a field of one) cannot be shared by it: that task runs from the start of the stretch that needs it (item 2). Written Shared[T], the parameter is a handle and the task runs from its start.
  4. in_place_scope, not scope (rayon-core 1.13.0): it runs the body on the current thread and needs no Send body.
  5. Stay in place where there is nothing to overlap (one task alone in a stretch, no work after it before its use), and for a small task: a body with no loop, no recursion and no call that is not inlined.

To build

  1. First: “NK2104 misses a main-line write to a value a running task reads (ADR-async-v7 D8)” (#3026). Item 3’s sharing is sound only with that check.
  2. Specification: the D20 text above into ADR-async-v7 (D20, with the date and this issue), Part I 8.1.2 and Part II 12.7. Delete the corrected 5,500-instruction estimate wherever it was carried over.
  3. Tests first (.nika with .stdout / .stderr in tests/compiler/tests/), without a clock:
    • at yes, thread::id() of a task differs from the main line’s (not a handshake over a SharedMut: that draws NK2104, D7);
    • one test per row of the paper’s section 6 table;
    • 1-thread rayon pool and 1-thread task pool; a group inside par_iter;
    • a crash in each position (task, main line inside a stretch, pausing task started before the stretch); admission order (D37);
    • a shared value read by the main line beside the task and written after the join; a task handing back a view into it; a lent parameter with and without Shared[T]. If Nikaia has no form to write one of these, that is a Found: (Result: blocked), not a reason to drop it.
  4. Thread safety: at yes, a child that runs on the pool counts as a crossing (a_crossing_reaches) and NK2501 checks it (today it skips children, check_core_ops.nika:1550; SharedMut would stay Rc + RefCell, sharing.nika:425-441, 1518-1528). A shared value needs Send + Sync.
  5. Runtime at yes (Rust in task.rs, under the specification-first exception, #1214; the report lists it for #557 / #125), reusing PoolScope and par_iter:
    • the stretch scope over rayon::in_place_scope, the memory block per task (ADR-327), a crash on another thread as par_iter reports it;
    • the wait is a loop that wakes on “a task ended” and starts the next queued task in written order (D37);
    • a group inside a task that holds a Frame gives its places back while it waits and takes them again (D38);
    • the budget (block::granted, block.rs:64) is carried into the job;
    • an unwind guard sets crashed when the main line crashes inside a stretch, so queued tasks do not start;
    • where WorkerThread::current() is set, the wait runs rayon work (rayon::yield_now() loop) instead of a blocking receive, which deadlocks on the worker’s own deque.
  6. Lowering at yes in emit_async_task and the group lowering: stretches, start placement, copy / move / share (item 3 of How), stay in place. Regenerate lowered/*.rs and lowered.rs.
  7. At no: deferred (owner, 2026-12-01). Whether the switch user-parallelism stays at all is being decided separately (a decision paper on removing it and choosing the representation per value). This item is not built in this issue; it is rewritten or dropped once that is decided.

Measured (paper, sections 5 and 7)

Hand-off on the group’s thread: 51 instructions in place, 928 for in_place_scope with 1 task, 629 / 485 / 356 per task with 2 / 4 / 8 tasks. The pool pays off from about 1,000 instructions of work per task with awake workers. Sharing plus taking back: about 210 instructions, independent of size. Count new figures with callgrind (docs/measuring.md).

Done when

At yes, the tests of To build 2 pass and the D6 probe runs a and b on the pool beside c. #3026 is closed. The suite is green. The last commit carries Fixes #3011, and the report has one Found: line per finding.

Files

No time limit is raised.


Generated by Claude Code

Comments

keywan-ghadami, 2026-11-30

Driver: #3011 is not queued, its form misses what a builder needs (nikaia run scripts/issue-check.nika -- 3011, docs/issues.md, #2003):

Label swapped from ready to decision: add what is missing (a Needs #M line for an issue it waits for, or Part of #M), then set ready again.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Brief queued: issue-3011


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #3011

Your work order is issue #3011, inlined below with its comments. There is no brief written around it: plan your own steps from its To build list, build them in order, commit after each finished step, and end when its Done when holds (or at the limits of builder.md, reporting what is left). The facts in your prompt are Core of docs/builder-facts.md; more on a topic: nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.

Measure the issue against docs/issues.md while you work: what it lacked, what was wrong in it. That answer goes into the report’s Issue: field. A finding, a changed plan or a finished item also goes into the issue as a comment (gh api repos/Nikaia-Foundation/Nikaia/issues/3011/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/async/issue-3011.md.report.md)

Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.


Generated by Claude Code

keywan-ghadami, 2026-11-30

Run: issue-3011, Result: blocked

Tokens: input 122, cache read 3848577, cache write 152256, output 56212 Cost: 3.31 USD, time 11 min 50 s, turns 61

Report

Result: blocked Files: none Commit: none Body: nothing committed; a draft runtime (task/pooled.rs: a cell that holds the body, a pool job, a future that waits in Drop) was written, refused by nikaia-std’s #[deny(unsafe_code)], and removed; the tree is unchanged Pushed: none Tests: none run (nothing committed); cargo check -p nikaia-std on the draft gave pooled.rs:31:1: error: implementation of an unsafe trait, pooled.rs:133:16: error: usage of an unsafe block (6 errors, deny(unsafe_code)) Gate: green Deviation: none Found: Pooling a never-pausing group task at yes (ADR-async-v7 D20) has no sound safe Rust form, no decision yet. The task’s body borrows the group function’s locals: today’s lowering of fn work(n: i64) -> i64 throws { let a = async heavy(n) ... } writes __group_n83.start_kept_gated(&__rest_3, &__group_n83_waiting, async || -> Result<_, ..> { let __value = nikaia_std::error::started((|| -> Result<_, ..> { let __nikaia_value = heavy(n); Ok(__nikaia_value) })(), &"work")?; Ok(__value) }), a non-move closure over n, so the body is not ‘static. A worker that runs it while the main line goes on needs a lifetime erasure that is sound only if the task’s future is never forgotten, and the type system cannot hold that, which is why std::thread::scope and rayon::scope block. ADR-218 D1/D4 puts unsafe only in a crates/unsafe/ crate with a safe API, keeps it out of nikaia-std (`#[deny(unsafe_code)]`), and lets emitted code write it only for FFI and proven-index, so no such API can be written. The choices are: (a) a new unsafe topic crate (e.g. a borrowing pool job whose handle waits in Drop) with an `unsafe fn` that nikaia-std or the lowering calls, as a new ADR-218 exception; (b) the group as a blocking scope (rayon/std scope, with the main line driven by a nested block_on), which stalls the outer group's pausing siblings while it lasts; (c) pool only bodies whose captures are moved or copied ('static + Send, checked by rustc), with borrowing bodies kept in place, which leaves D20 partly unbuilt Needs: supervisor decision Changelog: none Issue: broke I-rule on scope: the To build's item 2 ("start a never-pausing task on the pool and join it at the group's end") and item 5 ("captured borrows are Send/Sync") take borrowing pool tasks as given, but ADR-218 D4 leaves them no unsafe-free form; the issue should name the decision it rests on. Item 1's suggested handshake between two tasks is refused by design: `SharedMut` written by one task and read by another draws NK2104 (ADR-async-v7 D7). A clock-free test can instead compare each task's `thread::id()` with main's Owner: none Comment: #3011 Blocked on a decision. Pooling a never-pausing group task needs to run a borrowing (not 'static) body on a worker while the main line goes on. That needs unsafe, which ADR-218 D4 keeps out of nikaia-std and out of emitted code. Options: (a) a new crates/unsafe topic with an unsafe fn as an ADR-218 exception, (b) the group as a blocking scope, (c) pool only bodies whose captures are moved or copied. At no (item 4), putting the task off needs no unsafe and can be built as soon as the yes design is chosen, since both are written as one runtime call Friction: the issue's item 1 handshake costs turns: `SharedMut` set by one task and polled by another draws NK2104, channels have no try_recv, and std has no atomics Disk freed: 0; target/nikaia-project-tests absent; / 9.0G free of 252G (77% used); no new cache entry over 100 MB Attribution: Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UVxJDv58s4ABZjDMtxcbrQ

Debrief

  1. Most cost: I designed and wrote the whole pooled runtime (task/pooled.rs) before I checked whether unsafe was allowed in nikaia-std. The first cargo check refused it under #[deny(unsafe_code)], and only then did I see that a borrowing pool job has no safe form. Before that, I spent many turns on item 1’s handshake test (SharedMut drew NK2104, channels have no try_recv, std has no atomics).
  2. Looked up: ADR-218 D1/D4 (where unsafe may go), ADR-async-v7 D7/D20, the gated lowering path (start_kept_gated, not start_here), Waiting::pump_waiting and during, block::for_a_task and for_a_piece, and rt::handle().user_pool(). The brief could have handed over the ADR-218 constraint and the fact that tasks in a pausing function go through start_kept_gated.
  3. Checks: lowering probes of d6 and sync at both settings were useful: they showed one lowered output for both settings and closures that borrow. The handshake probes were wasted (refused by design). The single cargo check was the decisive one and should have come first, on a 5-line unsafe stub.
  4. Change: builder.md should say: before writing runtime Rust that crosses threads or erases lifetimes, check ADR-218 (no unsafe in nikaia-std or emitted code) with a one-line stub.
  5. Issue lacked:
    • broke I7: item 2 takes borrowing pool tasks as buildable and does not mark that as a hypothesis or give a settling check. Not forgetting the future is the only thing that would make a lifetime erasure sound, and safe Rust cannot express it. My report’s Issue: field said “broke I-rule on scope”, which is not a real rule number; I7 is what I meant.
    • wrong I5: the handshake that item 1 suggests is refused by NK2104 (ADR-async-v7 D7).
    • knowledge: Core | Tasks in a function with a group lower to start_kept_gated with a non-move closure that borrows the function's locals, whatever the user-parallelism setting.
  6. Traps:
    • Fact: Core | nikaia-std denies unsafe_code and ADR-218 D4 lets emitted code write unsafe only for FFI and proven-index, so code that sends borrowed task bodies to another thread needs a decision first.
    • Fact: Core | Two tasks of one group cannot handshake: SharedMut written by one and read by another draws NK2104 (ADR-async-v7 D7); compare thread::id() values instead.
  7. Work area:
    • Fact: async runtime | Key files: crates/nikaia-std/src/task.rs (Scope, group_paused), task/group.rs (ChildHandle, InBlock), task/gate.rs (Waiting::pump_waiting, during), rt/pool.rs (Pool::start_task); emit_async_task in compiler/emit_core_args.nika.
    • Fact: async runtime | Measured nothing this run (2026-11-30); the issue says one async costs about 5,500 instructions, source not re-run.

Generated by Claude Code

keywan-ghadami, 2026-11-30

From the report of the run of issue-3011 (#3011):

Blocked on a decision. Pooling a never-pausing group task needs to run a borrowing (not ‘static) body on a worker while the main line goes on. That needs unsafe, which ADR-218 D4 keeps out of nikaia-std and out of emitted code. Options: (a) a new crates/unsafe topic with an unsafe fn as an ADR-218 exception, (b) the group as a blocking scope, (c) pool only bodies whose captures are moved or copied. At no (item 4), putting the task off needs no unsafe and can be built as soon as the yes design is chosen, since both are written as one runtime call


Generated by Claude Code

keywan-ghadami, 2026-11-30

Decision paper: where a never-pausing child task runs at user_parallelism = yes when it borrows (ADR-async-v7 D20)

Rewritten 2026-12-01, second version. It adds the refined option (b+), the measured hand-off cost, and the answers to the open points of the first version. Each fact names its source. What is still not shown is marked open.

1. What the specification already decides

So the meaning is fixed. Every option below gives the same output. Only when the work runs at yes is open, and so how long the program takes.

The gap (#3011’s builder):

Why the gap shows only now:

2. Which threads exist

  no yes
I/O workers (compiler’s threads, ADR-303 D4) yes yes
main thread, drives main (rt/exec.rs block_on) yes yes
task pool for futures (rt/pool.rs) — yes
rayon pool for closures (par_iter, PoolScope; rt/pool.rs header) — yes

What “blocking” blocks: while a group’s thread waits for pool work, nothing else on that thread is polled:

I/O already in flight goes on (section 8, item 2).

3. At user_parallelism = no the question does not arise

4. At yes: what exists today

5. The options

(a) A new unsafe topic crate, e.g. crates/unsafe/scoped-pool: a pool job that may borrow, behind an unsafe fn whose precondition is “the handle is joined or dropped before what it borrows ends”.

(b) The pool per group, without unsafe (the first version’s recommendation):

(b+) (b), refined case by case. Each refinement keeps the meaning and removes a case where (b2) waits.

  1. A pool scope per stretch. A stretch is a part of the main line with no pause in it. The compiler knows every pause point per call site: a call pauses unless its contract says sync (task_pauses/expr_pauses, emit_core_below.nika:451-490; emit_calls.nika:36-66).
    • A task started in a stretch runs on the pool from its start, beside the main line, in a rayon::in_place_scope around that stretch.
    • Its first use waits only for that task. The scope joins the rest at the stretch’s end, before the pause.
    • A stretch never contains the start of a pausing child (section 2), so nothing polled at its start sits inside the scope.
    • Never worse than today: the thread would have been busy for the whole stretch anyway.
  2. Start placement. A task whose first use lies beyond a pause starts at the beginning of the stretch that needs its value, so it overlaps that stretch’s work. A task whose value is never named is collected for the group’s end, as in (b2).
  3. Copy, move or share instead of borrow. A task whose captures can be copied, moved or shared for its run becomes an owned ('static) pool task. It runs from its start across pauses, beside the main line, as (a) would. This does not change the meaning:
    • D7 already forbids the main line to change a value the task reads while the task runs. So a copy and a borrow read the same value.
    • Numbers, views and handles are copied (takes_away, check_values.nika:12).
    • A value the main line does not read after the task’s start is moved at that point. The last-use analysis exists (reads_on_paths, check_takes.nika:1805, used by NK1350). Applying it to names from outside the group is new.
    • A value that is not cheap to copy and is read again by the main line is shared for the task’s run (item 6).
  4. Share for the run (closes the case the first draft of (b+) left open). The binding the task borrows is owned by the function: a local, or a parameter it owns.
    • At the task’s start, the value moves into a shared handle (Arc). Only the handle moves; the data stays where it is. The task gets a clone of the handle. The main line reads through its own handle.
    • At the first write or move after the join, the value comes out again with Arc::into_inner, also O(1). Where the main line never writes it again, the handle is simply dropped where the value would have been.
    • Why the meaning does not change: D8 refuses every write and every move of the binding while the task runs. The rule is per binding, not per field, so the whole binding is shared and no field path is split. The value has one owner before and after; its destructor runs where it ran before. This keeps 6.2 and ADR-037 D3 (“Shared is written, never inferred, because inferring it moves a destructor”): nothing moves a destructor, and the handle never appears in the source or in the --sharing report. There is a precedent: Kept is already lowered as an Arc nobody wrote (emit_core_args.nika:803).
    • A task that hands back a view into the shared value: the view carries a clone of the handle, as ADR-tether-v1 D11 already lowers views that leave with a task, without unsafe. The value comes out of the handle after the view’s last use. The view rules already put that before any write.
    • Measured (probe-freeze/ in the supervisor’s scratchpad, rayon 1.12.0): overlap across a pause holds (50 ms instead of 70 ms for a 50 ms task and a 20 ms pause). The data address is unchanged before and after. A view keeps the value shared until it ends. Sharing plus taking it back costs about 210 instructions, independent of size (callgrind, list of 1,000 to 3,000 entries), mostly one allocation and its release.
    • Prerequisite, a defect found on the way: the checker does not yet refuse a main-line write beside a task, although D8 requires it. Today rustc’s borrow check stands in for it and reports an internal error. Behind a handle, rustc would no longer see it. Filed as “NK2104 misses a main-line write to a value a running task reads (ADR-async-v7 D8)” (#3026), with the decision that a move in the window is NK2104 too. It is part of this build.
    • Requires Send + Sync for the shared value. Section 8 item 3 checks that.
  5. in_place_scope, not scope (rayon-core 1.13.0): rayon::scope from a thread that is not a rayon worker runs its body on a pool thread (in_worker_cold, registry.rs:496) and needs a Send body (scope/mod.rs:277). in_place_scope (scope/mod.rs:398) runs the body on the current thread and needs no Send.
  6. Stay in place where there is nothing to overlap: one task alone in a stretch, and no work after it before its use.

What remains after (b+): one case, and it has a written remedy. A task that borrows a large value its function does not own (a lent parameter, or a field of one), across a pause. The caller owns that value, so the function cannot share it. Such a task runs from the start of the stretch that needs it; the meaning is the same. If the author wants it to run from its start, they write the parameter Shared[T]. That is the language’s own rule (6.2: sharing is written where the reader sees it), and the task then gets a handle like any other. How often: about 6 of roughly 415 task lines in tests/compiler/tests/; none in examples/, packages/ or the compiler’s own .nika.

(c) Pool only 'static + Send bodies. No unsafe, but whether a task runs in parallel depends on how it captures. (b+) item 3 takes (c)’s gain without making it the rule.

6. Gain per case at yes

Case today (a) (b) (b+)
Group that does not pause: 3 equal computations (a, b as tasks, c on the main line) 3 1 1 1
Pausing group: a task, then main-line work in the same stretch, then its use serial overlapped serial, then the task overlapped (item 1)
Pausing group: a task, an await, then its use; captures copied or moved serial overlapped after the await overlapped (item 3)
The same, but borrowing a large value the main line reads again serial overlapped after the await overlapped (item 6)
The same, the value a lent parameter serial overlapped after the await from the stretch after the await (item 2); overlapped where the parameter is written Shared[T]
Pausing group: 2 tasks, value needed at the end 2 1 1 1
Outer siblings while the tasks run stall for the sum no stall stall for the longest stall only for stretch work, as today

(Units are the duration of one computation.)

Neighbouring question: “Decision: pausing tasks on several threads, and who pays for it” (#1232, future). Deciding (b+) does not prejudge it. Its variant B5 rests on the same sharing as item 6.

7. The hand-off cost (measured)

Counted with callgrind (docs/measuring.md), rayon 1.12.0 / rayon-core 1.13.0, 4 threads:

  instructions on the group’s thread
in place 51
rayon::scope, 1 task 697
in_place_scope, 1 task 928
per task with 2 / 4 / 8 tasks per scope 629 / 485 / 356

Small tasks. The compiler has no cost estimate (only @inline / fold_callees, emit_function.nika:1296). Proposed, to be decided in the build: a task body with no loop, no recursion and no call that is not inlined stays in place. Every other task goes to the pool.

8. Answered points, and what the build must contain

  1. Deadlock: answered (probe with 1-thread pools).
    • On the main thread or a task-pool worker, in_place_scope waits on a latch and never runs rayon jobs itself (scope/mod.rs:405-411, latch.rs). The jobs go to the global injector, so a wait for one task cannot starve them. Nested par_iter and nested scopes inside the task, two group threads at once, and a busy rayon worker all finished.
    • It deadlocks when the group’s thread is itself a rayon worker and waits with a blocking receive: the job sits in that worker’s own deque. A wait that runs rayon work while it waits (rayon::yield_now() loop) finishes. Build: where WorkerThread::current() is set, the wait runs rayon work.
  2. I/O pilot: answered. A worker takes the pilot seat only in idle(), between polls, and gives it up before it returns (pool.rs). A worker blocked in a scope is never the pilot. Other workers take the seat within one 20 ms slice, and no wake is lost (moved_since_rearm, #2729). What stalls is the blocked worker’s own pinned tasks, until it returns. With a 1-worker task pool, the main thread’s park still reaps (rt/mod.rs:1291): this costs delay, not loss.
  3. Thread safety: new, must be built.
    • At yes a group child does not count as a crossing: SharedMut is then lowered as Rc + RefCell (sharing.nika:425-441, 1518-1528), and NK2501 skips children (check_core_ops.nika:1550).
    • Build: at yes, a child that runs on the pool counts as a crossing (a_crossing_reaches), and NK2501 checks it. Without this, (b) and (b+) would be unsound.
  4. Admission (D37, D38) and crashes: new, must be built. No pool scope uses a Gate today, and Gate is Rc, so it stays on the group’s thread. Build:
    • the wait is a loop that wakes on “a task ended” and starts the next queued task in written order (D37);
    • a group inside a task that holds a Frame gives its places back while it waits and takes them again (D38);
    • the budget (block::granted, a thread-local, block.rs:64) is carried into the job;
    • an unwind guard sets crashed when the main line crashes inside a stretch, so queued tasks do not start;
    • a crash of a pausing task started before the stretch is seen at the stretch’s end. Test that this order is the specified one.
  5. Hand-off cost: answered (section 7).
  6. Sharing for the run (item 6): new, must be built. The last-use analysis for names from outside the group, the handle at the task’s start and its release at the first write or move, the view’s handle (ADR-tether-v1 D11), and #3026 first.

Tests (D20 lane): thread::id() differs between task and main line (#3011 item 1); every row of section 6; 1-thread rayon and task pools; a group inside par_iter; a crash in each position; admission order; a shared value read by the main line beside the task and written after the join; a task handing back a view into it; a lent parameter with and without Shared[T].

9. Recommendation: (b+), with this D20 text

Where tasks run in parallel, a child task that never pauses runs on the pool beside the main line. It runs from its start where its captured values can be copied, moved or shared with it for its run, or where the main line does not pause before its value is first needed; otherwise it runs from the start of the part of the main line that needs its value. Where its value is first needed, the group’s thread waits for it. The setting and the group change the duration, not the meaning.

Why:

10. Corrections to #3011, whichever option is chosen


Generated by Claude Code

keywan-ghadami, 2026-12-01

Driver: not queued, this issue waits for #3012, which is still open (#1819). Set ready again when it is closed.


Generated by Claude Code

keywan-ghadami, 2026-12-01

From the report of the run of issue-3026 (#3026):

NK2104 now refuses every main-line change or move of a binding a task names in its window (#3026), per binding; a write after the task’s join but inside the group is still a rustc borrow error (the group’s Scope keeps the task’s borrow), filed separately.


Generated by Claude Code

keywan-ghadami, 2026-12-01

Run: issue-3011, Result: blocked

Tokens: input 10, cache read 202013, cache write 36734, output 2189 Cost: 0.41 USD, time 0 min 28 s, turns 5

Report

Result: blocked Files: none Commit: none Body: none Pushed: none Tests: none (blocked before the first edit) Gate: green Deviation: none Found: #3011 To build 0 waits for “NK2104 misses a main-line write to a value a running task reads (ADR-async-v7 D8)” (#3026), still open: its fix (commit “check: NK2104 for a main-line change or move of a binding a running task names (ADR-async-v7 D8)”, Fixes #3026) is committed locally on develop but not on origin/develop (git merge-base –is-ancestor against origin/develop after fetch: not an ancestor), so the issue is not closed, and #3011’s Done when names #3026 closed Needs: #3026 Changelog: none Issue: broke I4: To build 0 and Done when depend on #3026 but no Needs #3026 line names it, so the driver queued #3011 while #3026 was open Owner: none Comment: #3011 Run of issue-3011 stopped before the first edit: To build 0 needs #3026 closed; its fix is committed locally but not yet pushed. Queue again once #3026 is closed; adding a Needs #3026 line keeps the driver from queuing it early. Friction: none Disk freed: none (nothing built or cached in this run) Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDv58s4ABZjDMtxcbrQ

Debrief

  1. Most turns: few. The run took four tool calls: the brief, the git log grep for the #3026 fix, the commit’s message and branches, and a fetch to check origin/develop. Writing the report cost the most.
  2. Lookups: none on the language or ADRs. The one thing I had to settle was whether #3026’s fix had been pushed. The prompt lists #3026 as open, but git log --grep='Fixes #3026' finds a local commit.
  3. Checks: git log -400 --grep, git branch -r --contains, then git fetch and git merge-base --is-ancestor against origin/develop. branch -r --contains was wasted: remote refs can be stale, and the fetch-plus-ancestor check is what answered it. I ran no build or probe, rightly, because the run was blocked.
  4. One change: builder.md should say that a dependency’s local Fixes #N commit that is not on origin/develop still counts as open. The current rule only says a git log hit means closed for an issue the state list does not name.
  5. What the issue lacked:
    • broke I4: To build 0 and Done when both depend on #3026, but no Needs #3026 line names it, so the driver queued #3011 while #3026 was open.
    • rules-gap: a work order this large (spec, checker, Rust runtime, lowering, many tests) has no rule asking for it to be split into issues that fit one run.
  6. Traps for the next builder:
    • Fact: Core A Fixes #N commit on the local develop that is not an ancestor of origin/develop (git fetch origin develop && git merge-base --is-ancestor SHA origin/develop) means #N is still open, so a run that needs #N is blocked.
  7. Work area: Fact: none. I measured nothing and worked in no topic section.

Generated by Claude Code

keywan-ghadami, 2026-12-01

Driver: not queued, this issue waits for #3029, which is still open (#1819). Set ready again when it is closed.


Generated by Claude Code

Back to Open Issues