Hmbown / Hmbown/Codewhale

Structured concurrency: converge fleet and sub-agent fan-out on JoinSet with child cancellation

Open
#6,148 1 comment 0 reactions 0 assignees View on GitHub
rust subagents
Dominant language
Rust
Stars
41k
Forks
3.6k
Avg merge
13h 59m
Merged PRs (30d)
299

Description

From the 0.9.14 refactor backlog.

92 `tokio::spawn` sites vs 9 `JoinSet`/`FuturesUnordered`, plus a hand-rolled `await_retained_completion`. Fleet and sub-agent fan-out are where detached tasks can outlive their parent's cancellation. `CancellationToken::child_token()` plus a `JoinSet` gives cancel-the-turn, reap-the-children for free, and `JoinSet::join_next` replaces the hand-rolled wait. Hot spots: the fleet scheduler, `tools/subagent/coord.rs`, `mailbox.rs`.

Pairs with #6127/#6128 (workers vs operator replies; fan-out bounds). Size: M.

Contributor guide

Open the contributing guide

Research direction

Read the fleet scheduler, tools/subagent/coord.rs, and mailbox.rs, focusing on the fan-out and cancellation paths. Replace detached task handling with child-token cancellation and JoinSet-based collection, including join_next instead of await_retained_completion. Done means a cancelled turn cancels and reaps its fleet and sub-agent children.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.